<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>tutorials.de - .NET Café</title>
		<link>http://www.tutorials.de/</link>
		<description>Alles rund um die .NET Programmierung</description>
		<language>de</language>
		<lastBuildDate>Wed, 08 Sep 2010 23:02:44 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>30</ttl>
		<image>
			<url>http://style.tutorials.de/v10/images/misc/rss.png</url>
			<title>tutorials.de - .NET Café</title>
			<link>http://www.tutorials.de/</link>
		</image>
		<item>
			<title>Datentyp - primitiv oder komplex</title>
			<link>http://www.tutorials.de/net-cafe/365990-datentyp-primitiv-oder-komplex.html</link>
			<pubDate>Tue, 07 Sep 2010 09:20:37 GMT</pubDate>
			<description>hi leute, 
 
ich steige gerade in C# ein und gleich bei den kapiteln über datentypen komme ich ins schwitzen. 
 
mich irritieren aussagen (in vielen büchern über C#), dass die in dort implementierten primitiven datentypen (wie int, long, char) je durch eine struktur implementiert sind. 
 
daraus...</description>
			<content:encoded><![CDATA[<div>hi leute,<br />
<br />
ich steige gerade in C# ein und gleich bei den kapiteln über datentypen komme ich ins schwitzen.<br />
<br />
mich irritieren aussagen (in vielen büchern über C#), dass die in dort implementierten primitiven datentypen (wie int, long, char) je durch eine struktur implementiert sind.<br />
<br />
daraus folgt für mich die frage: was passiert, wenn ich folgendes schreibe?<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><table class="" style="font-family:monospace;"><tbody><tr><td class="bbcode_code_linenumbers"><pre>1
</pre></td><td class="bbcode_code_highlight"><pre>int i = 2;</pre></td></tr></tbody></table></code><hr />
</div> <br />
<font color="red"><b>Wieviel Speicherplatz nimmt &quot;i&quot; ein: 4 Bytes (= 32-Bits) oder mehr bzw. soviel, wie für die gesamte Struktur notwendig ist</b></font>, bswp. 28 Bytes (falls die die Implmentierung der Integer-Struktur 28 Bytes einnehmen sollte) <font color="red"><b>?</b></font><br />
<br />
da mir letztendlich schon klar ist, dass jedes Datum (int, long, char) auf die Wort-Größe eines Prozessors abgebildet werden muss, frage ich mal anders:<br />
<br />
<font color="red"><b>Würde der o.g Code tatsächlich in folgendes übersetzt werden bzw. wäre mein obiges &quot;i&quot; nur ein Datenfeld einer Struktur oder Klasse ?</b></font><br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><table class="" style="font-family:monospace;"><tbody><tr><td class="bbcode_code_linenumbers"><pre>1
</pre></td><td class="bbcode_code_highlight"><pre>Integer i = new Integer(2);</pre></td></tr></tbody></table></code><hr />
</div> <br />
<font color="red"><b>Da in Java auch Datentyp-Klassen existieren, wie verhält es sich dort?</b></font></div>

 ]]></content:encoded>
			<category domain="http://www.tutorials.de/net-cafe/">.NET Café</category>
			<dc:creator>willeswissen</dc:creator>
			<guid isPermaLink="true">http://www.tutorials.de/net-cafe/365990-datentyp-primitiv-oder-komplex.html</guid>
		</item>
		<item>
			<title><![CDATA[[VB08] Outlook-MSG-Dateien lesen]]></title>
			<link>http://www.tutorials.de/net-cafe/365750-vb08-outlook-msg-dateien-lesen.html</link>
			<pubDate>Wed, 01 Sep 2010 06:19:19 GMT</pubDate>
			<description>Hallo, 
 
wie der Titel schon sagt, will ich Outlook-Dateien (.msg) auslesen. Dabei ist Outlook auf dem Computer nicht installiert (daher eben das auslesen). 
 
Ich hab im Netz eine Dokumentation zum Datenformat gefunden, es würde aber doch etwas an Aufwand benötigen, um mich hier einzuarbeiten und...</description>
			<content:encoded><![CDATA[<div>Hallo,<br />
<br />
wie der Titel schon sagt, will ich Outlook-Dateien (.msg) auslesen. Dabei ist Outlook auf dem Computer nicht installiert (daher eben das auslesen).<br />
<br />
Ich hab im Netz eine Dokumentation zum Datenformat gefunden, es würde aber doch etwas an Aufwand benötigen, um mich hier einzuarbeiten und noch mehr, das ganze umzusetzen.<br />
<br />
Gibt es irgendwie eine einfachere Möglichkeit (.NET-Komponente, API, Klasse etc), so eine Datei auszulesen und die Inhalte dann auch eventuell abspeichern zu können? Ich hab bisher nur Möglichkeiten gefunden, die ein installiertes Outlook voraussetzen, dies ist aber wie gesagt nicht der Fall.<br />
<br />
<br />
Der Doc!</div>

 ]]></content:encoded>
			<category domain="http://www.tutorials.de/net-cafe/">.NET Café</category>
			<dc:creator>DrSoong</dc:creator>
			<guid isPermaLink="true">http://www.tutorials.de/net-cafe/365750-vb08-outlook-msg-dateien-lesen.html</guid>
		</item>
		<item>
			<title>DeviceIoControl() - Problem bei übersetzen VB.NET Datei</title>
			<link>http://www.tutorials.de/net-cafe/365702-deviceiocontrol-problem-bei-uebersetzen-vb-net-datei.html</link>
			<pubDate>Tue, 31 Aug 2010 07:29:29 GMT</pubDate>
			<description><![CDATA[Hallo, 
 
ich will die S.M.A.R.T. Daten der Festplatten auslesen. Dazu habe ich eine VB.NET Klasse gefunden Hier! (http://www.vbarchiv.net/tipps/details.php?id=1862&print=1). 
 
Diese habe ich nun nach C# übersetzt und ab geändert so wie es halt nötig war. Mein problem, beim aufruf der DLL-Funktion...]]></description>
			<content:encoded><![CDATA[<div>Hallo,<br />
<br />
ich will die S.M.A.R.T. Daten der Festplatten auslesen. Dazu habe ich eine VB.NET Klasse gefunden <a href="http://www.vbarchiv.net/tipps/details.php?id=1862&amp;print=1" target="_blank">Hier!</a>.<br />
<br />
Diese habe ich nun nach C# übersetzt und ab geändert so wie es halt nötig war. Mein problem, beim aufruf der DLL-Funktion <i><b>DeviceIoControl()</b></i> wird das Programm einfach beendet. Der Output im VisualStudio:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Zitat:</div>
	<div class="bbcode_quote printable">
		<hr />
		
			The program '[3352] SmartView.vshost.exe: Managed (v2.0.50727)' has exited with code -1073740791 (0xc0000409).
			
		<hr />
	</div>
</div> Ich hänge mal meine von VB nach C# übersetzte Smart-Klasse dran. Aber wie gesagt manche Sachen musste ich ändern.<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code csharp:</div>
                <hr /><code class="bbcode_code"><table class="csharp" style="font-family:monospace;"><tbody><tr><td class="bbcode_code_linenumbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
</pre></td><td class="bbcode_code_highlight"><pre><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Collections.Generic</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Runtime.InteropServices</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Management</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Linq</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Text</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Collections</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Windows.Forms</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">namespace</span> SmartView
<span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; <span style="color: #008080;">#region ReadSmartResult Enum</span>
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">enum</span> ReadSmartResult
&nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; DRIVE_DOES_NOT_EXIST <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span>,
&nbsp; &nbsp; &nbsp; &nbsp; ACCESS_DENIED <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span>,
&nbsp; &nbsp; &nbsp; &nbsp; NO_SMART_AVAILABLE <span style="color: #008000;">=</span> <span style="color: #FF0000;">2</span>,
&nbsp; &nbsp; &nbsp; &nbsp; SUCCEEDED <span style="color: #008000;">=</span> <span style="color: #FF0000;">3</span>
&nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp; &nbsp; <span style="color: #008080;">#endregion</span>
&nbsp;
&nbsp; &nbsp; <span style="color: #008080;">#region Attributes Enum</span>
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">enum</span> Attributes
&nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Invalid attribute identifier</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_Invalid <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Frequency of errors while reading raw data</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_RAW_READ_ERROR_RATE <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Average efficiency of a hard disk</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_THROUGHPUT_PERFORMANCE <span style="color: #008000;">=</span> <span style="color: #FF0000;">2</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// needed to spin up</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_SPIN_UP_TIME <span style="color: #008000;">=</span> <span style="color: #FF0000;">3</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Number of spindle start/stop cycles</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_START_STOP_COUNT <span style="color: #008000;">=</span> <span style="color: #FF0000;">4</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Quantity of remapped sectors</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_REALLOCATION_SECTOR_COUNT <span style="color: #008000;">=</span> <span style="color: #FF0000;">5</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Reserve of channel while reading</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_Read_Channel_Margin <span style="color: #008000;">=</span> <span style="color: #FF0000;">6</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Frequency of errors while positioning</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_SEEK_ERROR_RATE <span style="color: #008000;">=</span> <span style="color: #FF0000;">7</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Average efficiency of operations while positioning</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_Seek_TimerPerformance <span style="color: #008000;">=</span> <span style="color: #FF0000;">8</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Number of hours elapsed in the power-on state</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_POWER_ON_HOURS_COUNT <span style="color: #008000;">=</span> <span style="color: #FF0000;">9</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Number of retry attempts to spin up</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_SPIN_RETRY_COUNT <span style="color: #008000;">=</span> <span style="color: #FF0000;">10</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// count Number of attempts to calibrate the device</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_RECALIBRATION_RETRIES <span style="color: #008000;">=</span> <span style="color: #FF0000;">11</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Number of power-on events</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_DEVICE_POWER_CYCLE_COUNT <span style="color: #008000;">=</span> <span style="color: #FF0000;">12</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Frequency of &#8216;program&#8217; errors while reading from a disk</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_SOFT_READ_ERROR_RATE <span style="color: #008000;">=</span> <span style="color: #FF0000;">13</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Fequency of mistakes as a result of impact loads</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_AIRFLOW_TEMPERATURE <span style="color: #008000;">=</span> <span style="color: #FF0000;">190</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Fequency of mistakes as a result of impact loads</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_G_Sense_Error_Rate <span style="color: #008000;">=</span> <span style="color: #FF0000;">191</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Number of power-off or emergency retract cycles</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_Power_Off_Retract_Count <span style="color: #008000;">=</span> <span style="color: #FF0000;">192</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Number of cycles into landing zone position</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_LOAD_UNLOAD_CYCLE_COUNT <span style="color: #008000;">=</span> <span style="color: #FF0000;">193</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Temperature of a hard disk assembly</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_HDA_TEMPERATURE <span style="color: #008000;">=</span> <span style="color: #FF0000;">194</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Number of ECC on-the-fly errors</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_Hardware_ECC_Recovered <span style="color: #008000;">=</span> <span style="color: #FF0000;">195</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Number of remapping operations</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_REALLOCATION_COUNT <span style="color: #008000;">=</span> <span style="color: #FF0000;">196</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Number of unstable sectors (waiting for remapping)</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_CURRENT_PENDING_SECTOR_COUNT <span style="color: #008000;">=</span> <span style="color: #FF0000;">197</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Number of uncorrected errors</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_UNCORRECTABLE_SECTOR_COUNT <span style="color: #008000;">=</span> <span style="color: #FF0000;">198</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Number of CRC errors during UDMA mode</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_ULTRA_DMA_CRC_ERROR_COUNT <span style="color: #008000;">=</span> <span style="color: #FF0000;">199</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Number of errors while writing to disk (or) multi-zone </span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// error rate (or) flying height</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_WRITE_ERROR_RATE <span style="color: #008000;">=</span> <span style="color: #FF0000;">200</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Number of off-track errors</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_Soft_Read_Error_Count <span style="color: #008000;">=</span> <span style="color: #FF0000;">201</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Number of Data Address Mark (DAM) errors (or) vendor-specific</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_Data_Address_Mark_Errors <span style="color: #008000;">=</span> <span style="color: #FF0000;">202</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Number of ECC errors</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_Run_Out_Cancel <span style="color: #008000;">=</span> <span style="color: #FF0000;">203</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Number of errors corrected by software ECC</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_Soft_ECC_Correction <span style="color: #008000;">=</span> <span style="color: #FF0000;">204</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Number of thermal asperity errors</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_Thermal_Asperity_Rate <span style="color: #008000;">=</span> <span style="color: #FF0000;">205</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Height of heads above the disk surface</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_Flying_Height <span style="color: #008000;">=</span> <span style="color: #FF0000;">206</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Amount of high current used to spin up the drive</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_Spin_High_Current <span style="color: #008000;">=</span> <span style="color: #FF0000;">207</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Number of buzz routines to spin up the drive</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_Spin_Buzz <span style="color: #008000;">=</span> <span style="color: #FF0000;">208</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Drive&#8217;s seek performance during offline operations</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_Offline_Seek_Performance <span style="color: #008000;">=</span> <span style="color: #FF0000;">209</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Shift of disk is possible as a result of strong shock loading </span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// in the store, as a result of falling (or) temperature</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_Disk_Shift <span style="color: #008000;">=</span> <span style="color: #FF0000;">220</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Number of errors as a result of impact loads as detected </span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// by a shock sensor</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_G_SENSE_ERROR_Count <span style="color: #008000;">=</span> <span style="color: #FF0000;">221</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Number of hours in general operational state</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_Loaded_Hours <span style="color: #008000;">=</span> <span style="color: #FF0000;">222</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Loading on drive caused by numerous recurrences of operations, </span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// like reading, recording, positioning of heads, etc.</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_Load_Unload_Retry_Count <span style="color: #008000;">=</span> <span style="color: #FF0000;">223</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Load on drive caused by friction in mechanical parts of the store</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_Load_Friction <span style="color: #008000;">=</span> <span style="color: #FF0000;">224</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Total number of load cycles</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_Load_Unload_Cycle_Count1 <span style="color: #008000;">=</span> <span style="color: #FF0000;">225</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// General time for loading in a drive</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_Load_In_Time <span style="color: #008000;">=</span> <span style="color: #FF0000;">226</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Quantity efforts of the rotating moment of a drive</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_Torque_Amplification_Count <span style="color: #008000;">=</span> <span style="color: #FF0000;">227</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Number of power-off retract events.</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_POWER_OFF_RETRACT_COUNT1 <span style="color: #008000;">=</span> <span style="color: #FF0000;">228</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Amplitude of heads trembling (GMR-head) in running mode</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_GMR_Head_Amplitude <span style="color: #008000;">=</span> <span style="color: #FF0000;">230</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Temperature of a drive</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_Drive_Temperature <span style="color: #008000;">=</span> <span style="color: #FF0000;">231</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Time while head is positioning</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_Head_Flying_Hours <span style="color: #008000;">=</span> <span style="color: #FF0000;">240</span>,
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Number of errors while reading from a disk</span>
&nbsp; &nbsp; &nbsp; &nbsp; SMART_ATTRIB_Read_Error_Retry_Rate <span style="color: #008000;">=</span> <span style="color: #FF0000;">250</span>
&nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp; &nbsp; <span style="color: #008080;">#endregion</span>
&nbsp;
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> Smart
&nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> Drives<span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> Names<span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> STORAGE_PREDICT_FAILURE SmartData<span style="color: #008000;">;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080;">#region Konstanten</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">const</span> <span style="color: #6666cc; font-weight: bold;">int</span> IOCTL_STORAGE_PREDICT_FAILURE <span style="color: #008000;">=</span> 0x2D1100<span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// uint könnte probleme geben</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">const</span> <span style="color: #6666cc; font-weight: bold;">uint</span> STATUS_INVALID_DEVICE_REQUEST <span style="color: #008000;">=</span> 0xC0000010<span style="color: #008000;">;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">const</span> <span style="color: #6666cc; font-weight: bold;">short</span> FILE_SHARE_NONE <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">const</span> <span style="color: #6666cc; font-weight: bold;">short</span> OPEN_EXISTING <span style="color: #008000;">=</span> <span style="color: #FF0000;">3</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">const</span> <span style="color: #6666cc; font-weight: bold;">short</span> INVALID_HANDLE_VALUE <span style="color: #008000;">=</span> <span style="color: #008000;">-</span><span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">const</span> <span style="color: #6666cc; font-weight: bold;">uint</span> GENERIC_READ <span style="color: #008000;">=</span> 0x80000000<span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// fehler beim casten?</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">const</span> <span style="color: #6666cc; font-weight: bold;">int</span> GENERIC_WRITE <span style="color: #008000;">=</span> 0x40000000<span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">const</span> <span style="color: #6666cc; font-weight: bold;">int</span> FILE_SHARE_READ <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">const</span> <span style="color: #6666cc; font-weight: bold;">int</span> FILE_SHARE_WRITE <span style="color: #008000;">=</span> <span style="color: #FF0000;">2</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080;">#endregion</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080;">#region DLL Deklaration</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#91;</span>DllImport<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;kernel32.dll&quot;</span>, SetLastError <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">true</span>, CharSet <span style="color: #008000;">=</span> CharSet<span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Auto</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #0600FF; font-weight: bold;">extern</span> IntPtr CreateFile<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> lpFileName,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">uint</span> dwDesiredAccess,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">int</span> dwShareMode,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IntPtr lpSecurityAttributes,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">int</span> dwCreationDisposition,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">int</span> dwFlagsAndAttributes,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IntPtr hTemplateFile<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#91;</span>DllImport<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;kernel32.dll&quot;</span>, SetLastError <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">true</span>, CharSet <span style="color: #008000;">=</span> CharSet<span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Auto</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #0600FF; font-weight: bold;">extern</span> <span style="color: #6666cc; font-weight: bold;">bool</span> CloseHandle<span style="color: #008000;">&#40;</span>IntPtr hObject<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#91;</span>DllImport<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;kernel32.dll&quot;</span>, ExactSpelling <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">true</span>, SetLastError <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">true</span>, CharSet <span style="color: #008000;">=</span> CharSet<span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Auto</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #0600FF; font-weight: bold;">extern</span> <span style="color: #6666cc; font-weight: bold;">int</span> DeviceIoControl<span style="color: #008000;">&#40;</span>IntPtr hDevice,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">int</span> dwioControlCode,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IntPtr lpInBuffer,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">int</span> nInBufferSize,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">out</span> STORAGE_PREDICT_FAILURE lpOutBuffer,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">int</span> nOutBufferSize,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">ref</span> <span style="color: #6666cc; font-weight: bold;">int</span> lpBytesReturned,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IntPtr lpOverlapped<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080;">#endregion</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080;">#region Funktionen</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Festplatten (und auch USB-Laufwerke) per WMI ermitteln</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">int</span> GetPhysicalDrives<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ManagementObjectSearcher searcher <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> ManagementObjectSearcher<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;SELECT * FROM Win32_DiskDrive&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hashtable ht <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Hashtable<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">int</span> i <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ManagementObjectCollection moc <span style="color: #008000;">=</span> searcher<span style="color: #008000;">.</span><span style="color: #0000FF;">Get</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Drives <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#91;</span>moc<span style="color: #008000;">.</span><span style="color: #0000FF;">Count</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Names <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#91;</span>moc<span style="color: #008000;">.</span><span style="color: #0000FF;">Count</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">try</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">foreach</span> <span style="color: #008000;">&#40;</span>ManagementObject wmi_HD <span style="color: #0600FF; font-weight: bold;">in</span> moc<span style="color: #008000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ht<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>wmi_HD<span style="color: #008000;">.</span><span style="color: #0000FF;">Properties</span><span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;deviceid&quot;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Value</span>, wmi_HD<span style="color: #008000;">.</span><span style="color: #0000FF;">Properties</span><span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;caption&quot;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Value</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Hier kommt die Exception</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Drives<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> wmi_HD<span style="color: #008000;">.</span><span style="color: #0000FF;">Properties</span><span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;deviceid&quot;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Value</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Names<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> wmi_HD<span style="color: #008000;">.</span><span style="color: #0000FF;">Properties</span><span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;caption&quot;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Value</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i<span style="color: #008000;">++;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">return</span> i<span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">catch</span> <span style="color: #008000;">&#40;</span>Exception ex<span style="color: #008000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">finally</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ht <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Smart-Werte für angegebenes Laufwerk lesen</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// stehen danach in SmartData zur Verfügung</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> ReadSmartResult ReadSmart<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> Drive<span style="color: #008000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IntPtr Device<span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">bool</span> Result<span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">int</span> ReturnedBytes <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">SmartData</span> <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> STORAGE_PREDICT_FAILURE<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IntPtr zeroPtr <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> IntPtr<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Laufwerk öffnen</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Device <span style="color: #008000;">=</span> CreateFile<span style="color: #008000;">&#40;</span>Drive,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GENERIC_READ,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FILE_SHARE_READ,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IntPtr<span style="color: #008000;">.</span><span style="color: #0000FF;">Zero</span>,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; OPEN_EXISTING,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">0</span>,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IntPtr<span style="color: #008000;">.</span><span style="color: #0000FF;">Zero</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>Device<span style="color: #008000;">.</span><span style="color: #0000FF;">ToInt32</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">==</span> INVALID_HANDLE_VALUE<span style="color: #008000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>Marshal<span style="color: #008000;">.</span><span style="color: #0000FF;">GetLastWin32Error</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">==</span> <span style="color: #FF0000;">2</span><span style="color: #008000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//Zugriff verweigert, wahrscheinlich fehlen Adminrechte</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">return</span> ReadSmartResult<span style="color: #008000;">.</span><span style="color: #0000FF;">ACCESS_DENIED</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">else</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// das angegebene Laufwerk existiert nicht</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">return</span> ReadSmartResult<span style="color: #008000;">.</span><span style="color: #0000FF;">DRIVE_DOES_NOT_EXIST</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// S.M.A.R.T. auslesen</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Result <span style="color: #008000;">=</span> Convert<span style="color: #008000;">.</span><span style="color: #0000FF;">ToBoolean</span><span style="color: #008000;">&#40;</span>DeviceIoControl<span style="color: #008000;">&#40;</span>Device,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IOCTL_STORAGE_PREDICT_FAILURE,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IntPtr<span style="color: #008000;">.</span><span style="color: #0000FF;">Zero</span>,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #FF0000;">0</span>,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0600FF; font-weight: bold;">out</span> SmartData,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Marshal<span style="color: #008000;">.</span><a href="http://www.google.com/search?q=sizeof+msdn.microsoft.com"><span style="color: #008000;">SizeOf</span></a><span style="color: #008000;">&#40;</span>SmartData<span style="color: #008000;">&#41;</span>,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0600FF; font-weight: bold;">ref</span> ReturnedBytes,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IntPtr<span style="color: #008000;">.</span><span style="color: #0000FF;">Zero</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CloseHandle<span style="color: #008000;">&#40;</span>Device<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>Result<span style="color: #008000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// erfolgreich</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">return</span> ReadSmartResult<span style="color: #008000;">.</span><span style="color: #0000FF;">SUCCEEDED</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">else</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// es konnten keine S.M.A.R.T. Eigenschaften gelesen werden</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">return</span> ReadSmartResult<span style="color: #008000;">.</span><span style="color: #0000FF;">NO_SMART_AVAILABLE</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Attributsnamen (falls vohanden) ausgeben</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> GetAttribute<span style="color: #008000;">&#40;</span>Attributes Index<span style="color: #008000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">string</span> outString<span style="color: #008000;">;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; outString <span style="color: #008000;">=</span> Index<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Wenn outString noch numerisch ist, dann ist kein </span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Beschreibungstext in der Definition angegeben, </span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Ersatztext wird ausgegeben</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>IsNumeric<span style="color: #008000;">&#40;</span>outString<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; outString <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;&lt;Herstellerspezifisch&gt;&quot;</span><span style="color: #008000;">;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">return</span> outString<span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Smart-Wert auswerten, 12Byte beginnend ab Offset</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Offset = X * 12 + 2</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> GetSmartValue<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span> Offset,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">ref</span> <span style="color: #6666cc; font-weight: bold;">int</span> Attribut,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">ref</span> <span style="color: #6666cc; font-weight: bold;">long</span> Value,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">ref</span> <span style="color: #6666cc; font-weight: bold;">long</span> Worst,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">ref</span> <span style="color: #6666cc; font-weight: bold;">long</span> Data<span style="color: #008000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Der S.M.A.R.T.-Wert setzt sich aus 12Byte zusammen</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// 1. Byte - Attributesnamen</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Attribut <span style="color: #008000;">=</span> SmartData<span style="color: #008000;">.</span><span style="color: #0000FF;">VendorSpecific</span><span style="color: #008000;">&#91;</span>Offset<span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// 2./3. Byte - Herstellerspezifisch</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// interessant ist hier das 1. Bit, falls der Wert dieses </span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Smartwertes unter dem Grenzwert liegt, gibt dieses bit an, </span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// ob die Festplatte innerhalb der nächsten 24h ausfallen wird!</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// 4. Byte - Wert</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Value <span style="color: #008000;">=</span> SmartData<span style="color: #008000;">.</span><span style="color: #0000FF;">VendorSpecific</span><span style="color: #008000;">&#91;</span>Offset <span style="color: #008000;">+</span> <span style="color: #FF0000;">3</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// 5.-12. Byte - RAW-Value (herstellerspezifisch)</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Worst <span style="color: #008000;">=</span> SmartData<span style="color: #008000;">.</span><span style="color: #0000FF;">VendorSpecific</span><span style="color: #008000;">&#91;</span>Offset <span style="color: #008000;">+</span> <span style="color: #FF0000;">4</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">string</span> str <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;&quot;</span><span style="color: #008000;">;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span> i <span style="color: #008000;">=</span> <span style="color: #FF0000;">11</span><span style="color: #008000;">;</span> i <span style="color: #008000;">&lt;=</span> <span style="color: #FF0000;">5</span><span style="color: #008000;">;</span> i<span style="color: #008000;">--</span><span style="color: #008000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; str <span style="color: #008000;">+=</span> Convert<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>SmartData<span style="color: #008000;">.</span><span style="color: #0000FF;">VendorSpecific</span><span style="color: #008000;">&#91;</span>Offset <span style="color: #008000;">+</span> i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span>, <span style="color: #FF0000;">16</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Data <span style="color: #008000;">=</span> Convert<span style="color: #008000;">.</span><span style="color: #0000FF;">ToInt64</span><span style="color: #008000;">&#40;</span>str, <span style="color: #FF0000;">16</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080;">#endregion</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Werte aus SmartData in Listview eintragen</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> AddSmartToListView<span style="color: #008000;">&#40;</span>ListView lv, <span style="color: #6666cc; font-weight: bold;">int</span> Index<span style="color: #008000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">int</span> Attribut <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">long</span> Value <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span>, Worst <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span>, Data <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span> i <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span> i <span style="color: #008000;">&lt;=</span> <span style="color: #FF0000;">29</span><span style="color: #008000;">;</span> i<span style="color: #008000;">++</span><span style="color: #008000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GetSmartValue<span style="color: #008000;">&#40;</span>i <span style="color: #008000;">*</span> <span style="color: #FF0000;">12</span> <span style="color: #008000;">+</span> <span style="color: #FF0000;">2</span>, <span style="color: #0600FF; font-weight: bold;">ref</span> Attribut, <span style="color: #0600FF; font-weight: bold;">ref</span> Value, <span style="color: #0600FF; font-weight: bold;">ref</span> Worst, <span style="color: #0600FF; font-weight: bold;">ref</span> Data<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// 0 ist kein gültiger Wert, d.h. dieser Speicherblock enthält</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// kein Attribut</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">!</span>Attribut<span style="color: #008000;">.</span><span style="color: #0000FF;">Equals</span><span style="color: #008000;">&#40;</span>Attributes<span style="color: #008000;">.</span><span style="color: #0000FF;">SMART_ATTRIB_Invalid</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// ins Listview eintragen</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ListViewItem lvi <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> ListViewItem<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//Attributes at = new Attributes();</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//string att = Enum.GetName(typeof(Attributes), Attribut);</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Attributes at <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>Attributes<span style="color: #008000;">&#41;</span><span style="color: #6666cc; font-weight: bold;">Enum</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Parse</span><span style="color: #008000;">&#40;</span><a href="http://www.google.com/search?q=typeof+msdn.microsoft.com"><span style="color: #008000;">typeof</span></a><span style="color: #008000;">&#40;</span>Attributes<span style="color: #008000;">&#41;</span>, Convert<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span>Attribut<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//string attributeName = Enum.GetName(typeof(Attributes), Convert.ToString(1));</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">//Attributes attr = (Attributes) Enum.Parse(typeof(Attributes), attributeName);</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lvi<span style="color: #008000;">.</span><span style="color: #0000FF;">Text</span> <span style="color: #008000;">=</span> Attribut <span style="color: #008000;">+</span> <span style="color: #666666;">&quot; - &quot;</span> <span style="color: #008000;">+</span> GetAttribute<span style="color: #008000;">&#40;</span>at<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lvi<span style="color: #008000;">.</span><span style="color: #0000FF;">SubItems</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>Value<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lvi<span style="color: #008000;">.</span><span style="color: #0000FF;">SubItems</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>Worst<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lvi<span style="color: #008000;">.</span><span style="color: #0000FF;">SubItems</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>Data<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span> j <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span> j <span style="color: #008000;">&lt;=</span> lv<span style="color: #008000;">.</span><span style="color: #0000FF;">Groups</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Count</span> <span style="color: #008000;">-</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span> i<span style="color: #008000;">++</span><span style="color: #008000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>lv<span style="color: #008000;">.</span><span style="color: #0000FF;">Groups</span><span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Name</span> <span style="color: #008000;">==</span> <span style="color: #666666;">&quot;LW&quot;</span> <span style="color: #008000;">+</span> Index<span style="color: #008000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lvi<span style="color: #008000;">.</span><span style="color: #0000FF;">Group</span> <span style="color: #008000;">=</span> lv<span style="color: #008000;">.</span><span style="color: #0000FF;">Groups</span><span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lv<span style="color: #008000;">.</span><span style="color: #0000FF;">Items</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>lvi<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080;">#region Hilfsklasse zur Zwischenspeicherung</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#91;</span>StructLayout<span style="color: #008000;">&#40;</span>LayoutKind<span style="color: #008000;">.</span><span style="color: #0000FF;">Sequential</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> STORAGE_PREDICT_FAILURE
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">int</span> PredictFailure<span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#91;</span>MarshalAs<span style="color: #008000;">&#40;</span>UnmanagedType<span style="color: #008000;">.</span><span style="color: #0000FF;">ByValArray</span>, SizeConst <span style="color: #008000;">=</span> <span style="color: #FF0000;">512</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">byte</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> VendorSpecific<span style="color: #008000;">;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> STORAGE_PREDICT_FAILURE<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VendorSpecific <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> <span style="color: #6666cc; font-weight: bold;">byte</span><span style="color: #008000;">&#91;</span><span style="color: #FF0000;">511</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080;">#endregion</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080;">#region IsNumeric Methode</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// IsNumeric Function</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">bool</span> IsNumeric<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> Expression<span style="color: #008000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Variable to collect the Return value of the TryParse method.</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">bool</span> isNum<span style="color: #008000;">;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Define variable to collect out parameter of the TryParse method. If the conversion fails, the out parameter is zero.</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">double</span> retNum<span style="color: #008000;">;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// The TryParse method converts a string in a specified style and culture-specific format to its double-precision floating point number equivalent.</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// The TryParse method does not generate an exception if the conversion fails. If the conversion passes, True is returned. If it does not, False is returned.</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; isNum <span style="color: #008000;">=</span> <span style="color: #6666cc; font-weight: bold;">Double</span><span style="color: #008000;">.</span><span style="color: #0000FF;">TryParse</span><span style="color: #008000;">&#40;</span>Convert<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span>Expression<span style="color: #008000;">&#41;</span>, <span style="color: #000000;">System.<span style="color: #0000FF;">Globalization</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">NumberStyles</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Any</span>, <span style="color: #000000;">System.<span style="color: #0000FF;">Globalization</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">NumberFormatInfo</span><span style="color: #008000;">.</span><span style="color: #0000FF;">InvariantInfo</span>, <span style="color: #0600FF; font-weight: bold;">out</span> retNum<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">return</span> isNum<span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080;">#endregion</span>
&nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></tbody></table></code><hr />
</div> <br />
Und hier noch mein Aufruf der Klasse:<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code csharp:</div>
                <hr /><code class="bbcode_code"><table class="csharp" style="font-family:monospace;"><tbody><tr><td class="bbcode_code_linenumbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
</pre></td><td class="bbcode_code_highlight"><pre><span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> button1_Click<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, EventArgs e<span style="color: #008000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span> 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Smart smart <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Smart<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; listView1<span style="color: #008000;">.</span><span style="color: #0000FF;">Items</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Clear</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; listView1<span style="color: #008000;">.</span><span style="color: #0000FF;">Groups</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Clear</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Laufwerke ermitteln</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">int</span> j <span style="color: #008000;">=</span> smart<span style="color: #008000;">.</span><span style="color: #0000FF;">GetPhysicalDrives</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">-</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// S.M.A.R.T. Eigenschaften auslesen und ins Listview eintragen</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">for</span><span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span> i <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span> i <span style="color: #008000;">&lt;=</span> j<span style="color: #008000;">;</span> i<span style="color: #008000;">++</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">switch</span><span style="color: #008000;">&#40;</span>smart<span style="color: #008000;">.</span><span style="color: #0000FF;">ReadSmart</span><span style="color: #008000;">&#40;</span>smart<span style="color: #008000;">.</span><span style="color: #0000FF;">Drives</span><span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">case</span> ReadSmartResult<span style="color: #008000;">.</span><span style="color: #0000FF;">SUCCEEDED</span><span style="color: #008000;">:</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// S.M.A.R.T.-Werte wurden ausgelesen und werden </span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// ins Listview eingetragen</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; listView1<span style="color: #008000;">.</span><span style="color: #0000FF;">Groups</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;LW&quot;</span> <span style="color: #008000;">+</span> i, smart<span style="color: #008000;">.</span><span style="color: #0000FF;">Names</span><span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot; &nbsp;(&quot;</span> <span style="color: #008000;">+</span> smart<span style="color: #008000;">.</span><span style="color: #0000FF;">Drives</span><span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;)&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; smart<span style="color: #008000;">.</span><span style="color: #0000FF;">AddSmartToListView</span><span style="color: #008000;">&#40;</span>listView1, i<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">break</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">case</span> ReadSmartResult<span style="color: #008000;">.</span><span style="color: #0000FF;">NO_SMART_AVAILABLE</span><span style="color: #008000;">:</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// S.M.A.R.T. ist für dieses Laufwerk nicht verfügbar</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; listView1<span style="color: #008000;">.</span><span style="color: #0000FF;">Groups</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;LW&quot;</span> <span style="color: #008000;">+</span> i, smart<span style="color: #008000;">.</span><span style="color: #0000FF;">Names</span><span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot; &nbsp;(&quot;</span> <span style="color: #008000;">+</span> smart<span style="color: #008000;">.</span><span style="color: #0000FF;">Drives</span><span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;)&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ListViewItem lvi <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> ListViewItem<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lvi<span style="color: #008000;">.</span><span style="color: #0000FF;">Text</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;S.M.A.R.T. not available&quot;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lvi<span style="color: #008000;">.</span><span style="color: #0000FF;">Group</span> <span style="color: #008000;">=</span> listView1<span style="color: #008000;">.</span><span style="color: #0000FF;">Groups</span><span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; listView1<span style="color: #008000;">.</span><span style="color: #0000FF;">Items</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>lvi<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">break</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">case</span> ReadSmartResult<span style="color: #008000;">.</span><span style="color: #0000FF;">ACCESS_DENIED</span><span style="color: #008000;">:</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Zugriff uafs Laufwerk verweigert, wahrscheinlich fehlen </span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Adminrechte (v.a. unter Vista)</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; listView1<span style="color: #008000;">.</span><span style="color: #0000FF;">Groups</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;LW&quot;</span> <span style="color: #008000;">+</span> i, smart<span style="color: #008000;">.</span><span style="color: #0000FF;">Names</span><span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot; &nbsp;(&quot;</span> <span style="color: #008000;">+</span> smart<span style="color: #008000;">.</span><span style="color: #0000FF;">Drives</span><span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;)&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ListViewItem lvi2 <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> ListViewItem<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lvi2<span style="color: #008000;">.</span><span style="color: #0000FF;">Text</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Zugriff verweigert, Administratorrechte benötigt!&quot;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lvi2<span style="color: #008000;">.</span><span style="color: #0000FF;">Group</span> <span style="color: #008000;">=</span> listView1<span style="color: #008000;">.</span><span style="color: #0000FF;">Groups</span><span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; listView1<span style="color: #008000;">.</span><span style="color: #0000FF;">Items</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>lvi2<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">break</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">case</span> ReadSmartResult<span style="color: #008000;">.</span><span style="color: #0000FF;">DRIVE_DOES_NOT_EXIST</span><span style="color: #008000;">:</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Das angegebene Laufwerk existiert nicht</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// nichts ausgeben</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">break</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span></pre></td></tr></tbody></table></code><hr />
</div> <br />
Hoffentlich kann mir jemand helfen! :)</div>

 ]]></content:encoded>
			<category domain="http://www.tutorials.de/net-cafe/">.NET Café</category>
			<dc:creator>zer0</dc:creator>
			<guid isPermaLink="true">http://www.tutorials.de/net-cafe/365702-deviceiocontrol-problem-bei-uebersetzen-vb-net-datei.html</guid>
		</item>
		<item>
			<title><![CDATA[[C#] Nur Zahlen und Buchstaben in einen String schreiben]]></title>
			<link>http://www.tutorials.de/net-cafe/365669-c-nur-zahlen-und-buchstaben-einen-string-schreiben.html</link>
			<pubDate>Mon, 30 Aug 2010 12:11:04 GMT</pubDate>
			<description>Hallo, 
 
folgendes problem:  
ich frage ab ob auf der Tastatur was gedrückt wird und dass was gedrückt wird, wird in einem String reingeschrieben. Nun sollen aber nur Buchstaben und Zahlen übernommen werden. Zum beispel wenn ich tab drücke schriebt er das auch rein. 
Kann man das irgentwie...</description>
			<content:encoded><![CDATA[<div>Hallo,<br />
<br />
folgendes problem: <br />
ich frage ab ob auf der Tastatur was gedrückt wird und dass was gedrückt wird, wird in einem String reingeschrieben. Nun sollen aber nur Buchstaben und Zahlen übernommen werden. Zum beispel wenn ich tab drücke schriebt er das auch rein.<br />
Kann man das irgentwie aussortieren? Z.b. das in einem String alles gelöscht wird was keine Zahl oder kein Buchstabe ist?</div>

 ]]></content:encoded>
			<category domain="http://www.tutorials.de/net-cafe/">.NET Café</category>
			<dc:creator>Klasse Typ</dc:creator>
			<guid isPermaLink="true">http://www.tutorials.de/net-cafe/365669-c-nur-zahlen-und-buchstaben-einen-string-schreiben.html</guid>
		</item>
		<item>
			<title>Problem mit image in Picturebox / Clipboard</title>
			<link>http://www.tutorials.de/net-cafe/365484-problem-mit-image-picturebox-clipboard.html</link>
			<pubDate>Wed, 25 Aug 2010 13:10:45 GMT</pubDate>
			<description>Hallo, 
 
ich möchte einen live erzeugten Barcode in eine Word-Datei einfügen. 
Dazu füge ich das erzeugte Image ins Clipboard ein um dies an der entsprechenden Textmarke einzufügen. 
Da das aber nicht klappt, habe ich zu Testzwecken das Image in eine Picturebox gepackt - dort kann man es...</description>
			<content:encoded><![CDATA[<div>Hallo,<br />
<br />
ich möchte einen live erzeugten Barcode in eine Word-Datei einfügen.<br />
Dazu füge ich das erzeugte Image ins Clipboard ein um dies an der entsprechenden Textmarke einzufügen.<br />
Da das aber nicht klappt, habe ich zu Testzwecken das Image in eine Picturebox gepackt - dort kann man es einwandfrei sehen.<br />
Wie bekomme ich es nun aber ins Word?<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><table class="" style="font-family:monospace;"><tbody><tr><td class="bbcode_code_linenumbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="bbcode_code_highlight"><pre>&nbsp;
Try
&nbsp; &nbsp; &nbsp; &nbsp; Dim oWord As New Word.Application
&nbsp; &nbsp; &nbsp; &nbsp; Dim oDoc As New Word.Document
&nbsp; &nbsp; &nbsp; &nbsp; Dim LabNr As String = &quot;99999999&quot;
&nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; oDoc = oWord.Documents.Open(FileName:=&quot;c:\chargen_dok\ProdBglS.doc&quot;, &#91;ReadOnly&#93;:=True)
&nbsp; &nbsp; &nbsp; &nbsp; oWord.Visible = True
&nbsp; &nbsp; &nbsp; &nbsp; Dim range As Microsoft.Office.Interop.Word.Range
&nbsp; &nbsp; &nbsp; &nbsp; range = oDoc.Bookmarks.Item(&quot;labnr&quot;).Range
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; Dim c1bc As New C1.Win.C1BarCode.C1BarCode
&nbsp; &nbsp; &nbsp; &nbsp; c1bc.Text = &quot;99999999&quot;
&nbsp; &nbsp; &nbsp; &nbsp; c1bc.CodeType = C1.Win.C1BarCode.CodeTypeEnum.Code128
&nbsp; &nbsp; &nbsp; &nbsp; PictureBox1.Image = c1bc.Image
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; Clipboard.SetDataObject(PictureBox1.Image)
&nbsp; &nbsp; &nbsp; &nbsp; range.Paste()
&nbsp;
Catch ex As Exception
&nbsp; &nbsp; &nbsp; MsgBox(ex.Message)
End Try</pre></td></tr></tbody></table></code><hr />
</div> <br />
Egal, ob ich das Clipboard direkt mit 'c1bc.image' oder mit dem Inhalt der Picturebox füllen will, es kommt immer zu der Fehlermeldung:<br />
<br />
&quot;Diese Methode oder Eigenschaft ist nicht verfügbar, weil die Zwischenablage leer oder ungültig ist.&quot;</div>

 ]]></content:encoded>
			<category domain="http://www.tutorials.de/net-cafe/">.NET Café</category>
			<dc:creator>deusfalsus</dc:creator>
			<guid isPermaLink="true">http://www.tutorials.de/net-cafe/365484-problem-mit-image-picturebox-clipboard.html</guid>
		</item>
		<item>
			<title>Korrekt byteweise einlesen</title>
			<link>http://www.tutorials.de/net-cafe/365445-korrekt-byteweise-einlesen.html</link>
			<pubDate>Tue, 24 Aug 2010 13:47:42 GMT</pubDate>
			<description>Hallöle zusammen, 
 
ich kämpf mich gerade mit C# durch .NET, um mal was neues kennen zu lernen, und stecke gerade ein bisschen fest. Es geht darum eine Datei byteweise einzulesen. Leider kann ich die gerade nicht anhängen, da ich sie auf diesem PC nicht zur Verfügung habe, ich hoffe das hindert...</description>
			<content:encoded><![CDATA[<div>Hallöle zusammen,<br />
<br />
ich kämpf mich gerade mit C# durch .NET, um mal was neues kennen zu lernen, und stecke gerade ein bisschen fest. Es geht darum eine Datei byteweise einzulesen. Leider kann ich die gerade nicht anhängen, da ich sie auf diesem PC nicht zur Verfügung habe, ich hoffe das hindert jetzt nicht allzu sehr...<br />
<br />
Es geht jedenfalls erstmal um die ersten Zeichen. Folgende Methode habe ich bisher:<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code csharp:</div>
                <hr /><code class="bbcode_code"><table class="csharp" style="font-family:monospace;"><tbody><tr><td class="bbcode_code_linenumbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="bbcode_code_highlight"><pre><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> NFZImporter <span style="color: #008000;">&#123;</span>
&nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> NFZ Import<span style="color: #008000;">&#40;</span>FileStream source<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; BinaryReader reader <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> BinaryReader<span style="color: #008000;">&#40;</span>source<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; NFZ nfz <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> NFZ<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">String</span> fileInfo <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;&quot;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">byte</span> inByte<span style="color: #008000;">;</span>
&nbsp;
&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Read file information</span>
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">while</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>inByte <span style="color: #008000;">=</span> reader<span style="color: #008000;">.</span><span style="color: #0000FF;">ReadByte</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">!=</span> <span style="color: #666666;">'<span style="color: #008080; font-weight: bold;">\x</span>1A'</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span> <span style="color: #008080; font-style: italic;">// 1A = Strg + Z, das durchs Dateiformat vorgegebene Terminatorsymbol an dieser Stelle</span>
&nbsp; &nbsp; &nbsp; fileInfo <span style="color: #008000;">+=</span> inByte<span style="color: #008000;">;</span>
&nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp; &nbsp; 
&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Check identifier</span>
&nbsp; &nbsp; <span style="color: #6666cc; font-weight: bold;">String</span> identifier <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;&quot;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; identifier <span style="color: #008000;">+=</span> reader<span style="color: #008000;">.</span><span style="color: #0000FF;">ReadByte</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">+</span> reader<span style="color: #008000;">.</span><span style="color: #0000FF;">ReadByte</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">+</span> reader<span style="color: #008000;">.</span><span style="color: #0000FF;">ReadByte</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>identifier <span style="color: #008000;">!=</span> NFZ<span style="color: #008000;">.</span><span style="color: #0000FF;">IDENTIFIER</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span>identifier<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">throw</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> NFZInvalidException<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;...&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp;
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">return</span> nfz<span style="color: #008000;">;</span>
&nbsp; <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></tbody></table></code><hr />
</div> <br />
NFZ.IDENTIFIER ist folgendermaßen deklariert:<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code csharp:</div>
                <hr /><code class="bbcode_code"><table class="csharp" style="font-family:monospace;"><tbody><tr><td class="bbcode_code_linenumbers"><pre>1
2
3
4
5
</pre></td><td class="bbcode_code_highlight"><pre><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> NFZ <span style="color: #008000;">&#123;</span>
&nbsp; <span style="color: #008000;">...</span>
&nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #0600FF; font-weight: bold;">readonly</span> <span style="color: #6666cc; font-weight: bold;">String</span> IDENTIFIER <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;FZ<span style="color: #008080; font-weight: bold;">\x</span>C7&quot;</span><span style="color: #008000;">;</span>
&nbsp; <span style="color: #008000;">...</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></tbody></table></code><hr />
</div> <br />
So, nun zum Problem: In der Datei steht folgendes (nur der hier relevante Anfang):<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><table class="" style="font-family:monospace;"><tbody><tr><td class="bbcode_code_linenumbers"><pre>1
</pre></td><td class="bbcode_code_highlight"><pre>1A46 5AC7</pre></td></tr></tbody></table></code><hr />
</div> <br />
bzw.<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><table class="" style="font-family:monospace;"><tbody><tr><td class="bbcode_code_linenumbers"><pre>1
</pre></td><td class="bbcode_code_highlight"><pre>.FZÇ</pre></td></tr></tbody></table></code><hr />
</div> <br />
Also Strg + Z und dem Identifier, wie er auch in der NFZ-Klasse deklariert ist. Der Reader liest nun allerdings an dieser Stelle (gibt beim Console.WriteLine() aus):<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><table class="" style="font-family:monospace;"><tbody><tr><td class="bbcode_code_linenumbers"><pre>1
</pre></td><td class="bbcode_code_highlight"><pre>359</pre></td></tr></tbody></table></code><hr />
</div> <br />
und folglich wird auch die Exception geworfen. Wie kann ich nun richtig einlesen, sodass das gewünscht Ergebnis erzielt wird?</div>

 ]]></content:encoded>
			<category domain="http://www.tutorials.de/net-cafe/">.NET Café</category>
			<dc:creator>Tim Bureck</dc:creator>
			<guid isPermaLink="true">http://www.tutorials.de/net-cafe/365445-korrekt-byteweise-einlesen.html</guid>
		</item>
		<item>
			<title>Datei ohne Stream öffnen</title>
			<link>http://www.tutorials.de/net-cafe/365438-datei-ohne-stream-oeffnen.html</link>
			<pubDate>Tue, 24 Aug 2010 12:33:40 GMT</pubDate>
			<description>Hallo, 
 
ich habe ein Programm, dass schnell hintereinander etwas an eine Datei anhängt. (Die Datei öffne ich mit FileStream) Nun möchte ich das Programm schneller machen und hab über den Leistungsassistenten einen test durchführen lassen. Das Ergebnis hatt mich doch sehr erstaunt. 95% der Zeit...</description>
			<content:encoded><![CDATA[<div>Hallo,<br />
<br />
ich habe ein Programm, dass schnell hintereinander etwas an eine Datei anhängt. (Die Datei öffne ich mit FileStream) Nun möchte ich das Programm schneller machen und hab über den Leistungsassistenten einen test durchführen lassen. Das Ergebnis hatt mich doch sehr erstaunt. 95% der Zeit verbrauch mein Programm in der Stream.Close() Methode. <br />
<br />
Die Datei immer oder länger offen zu lassen ist keine Alternative! Es ist eine Anforderung, dass nach jedem Intervall (~funktionsaufruf) eine konsistente Datei vorhanden sein muss.<br />
<br />
Deshalb meine Frage: Kann man eine Datei in vc# ander als mit Streams öffen? <br />
<br />
hier noch meine Funktion die schnell hintereinander aufgerufen werden muss:<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code csharp:</div>
                <hr /><code class="bbcode_code"><table class="csharp" style="font-family:monospace;"><tbody><tr><td class="bbcode_code_linenumbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
</pre></td><td class="bbcode_code_highlight"><pre>&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> InsertFile<span style="color: #008000;">&#40;</span><span style="color: #008000;">...</span><span style="color: #008000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FileStream fileStream <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">;</span>
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">try</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
<span style="color: #008000;">...</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000FF;">fileStream</span> <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> FileStream<span style="color: #008000;">&#40;</span>GetFileName<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>, FileMode<span style="color: #008000;">.</span><span style="color: #0000FF;">Open</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">...</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000FF;">fileStream</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Seek</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">...</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fileStream<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">...</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fileStream<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">...</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fileStream<span style="color: #008000;">.</span><span style="color: #0000FF;">Flush</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">catch</span> <span style="color: #008000;">&#40;</span>Exception ex<span style="color: #008000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span>ex<span style="color: #008000;">.</span><span style="color: #0000FF;">Message</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">throw</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">finally</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>fileStream <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fileStream<span style="color: #008000;">.</span><span style="color: #0000FF;">Close</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span></pre></td></tr></tbody></table></code><hr />
</div> <br />
<br />
Gruß<br />
Col.Blake</div>

 ]]></content:encoded>
			<category domain="http://www.tutorials.de/net-cafe/">.NET Café</category>
			<dc:creator>colblake</dc:creator>
			<guid isPermaLink="true">http://www.tutorials.de/net-cafe/365438-datei-ohne-stream-oeffnen.html</guid>
		</item>
		<item>
			<title>C# wie Button auf fremde Form ankleben?</title>
			<link>http://www.tutorials.de/net-cafe/365389-c-wie-button-auf-fremde-form-ankleben.html</link>
			<pubDate>Mon, 23 Aug 2010 12:45:33 GMT</pubDate>
			<description>Hallo, 
 
habe ein Programm in Delphi geschrieben - sei es erstmal der einfach halber nur eine Form mit keinen Controls darauf. 
 
Wie kann ich nun auf dieses Delphi Form einen Button anbringen? 
habe überlegt das mit Windows.Forms zu machen, aber da wird eine Form von C# erwartet. 
 
Kann man das...</description>
			<content:encoded><![CDATA[<div>Hallo,<br />
<br />
habe ein Programm in Delphi geschrieben - sei es erstmal der einfach halber nur eine Form mit keinen Controls darauf.<br />
<br />
Wie kann ich nun auf dieses Delphi Form einen Button anbringen?<br />
habe überlegt das mit Windows.Forms zu machen, aber da wird eine Form von C# erwartet.<br />
<br />
Kann man das auch so machen, das ich die windows.Forms benitzen kann, aber halt auf das Delphi Formular anwenden kann?<br />
<br />
z.b.<br />
DelphiHandle = FindWindow(...<br />
Button MyButton = new Button();<br />
MyButton.Add(DelphiHandle)<br />
...<br />
<br />
Danke für Hilfe<br />
Jens</div>

 ]]></content:encoded>
			<category domain="http://www.tutorials.de/net-cafe/">.NET Café</category>
			<dc:creator>jkallup</dc:creator>
			<guid isPermaLink="true">http://www.tutorials.de/net-cafe/365389-c-wie-button-auf-fremde-form-ankleben.html</guid>
		</item>
		<item>
			<title>In Xml-Datei Schemainformationen hinzufügen</title>
			<link>http://www.tutorials.de/net-cafe/365381-xml-datei-schemainformationen-hinzufuegen.html</link>
			<pubDate>Mon, 23 Aug 2010 09:47:17 GMT</pubDate>
			<description><![CDATA[Hallo, 
 
ich versuche gerade in eine neue XML-Datei folgende Informationen (speziell die Attribute) mit den dotnet eigenen Mitteln hinzuzufügen: 
 
... 
<Document xmlns="blabla" xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation = "urn:swift:xsd:$pain... .xsd"> 
... 
 
doch...]]></description>
			<content:encoded><![CDATA[<div>Hallo,<br />
<br />
ich versuche gerade in eine neue XML-Datei folgende Informationen (speziell die Attribute) mit den dotnet eigenen Mitteln hinzuzufügen:<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code xml:</div>
                <hr /><code class="bbcode_code"><table class="xml" style="font-family:monospace;"><tbody><tr><td class="bbcode_code_linenumbers"><pre>1
2
3
4
</pre></td><td class="bbcode_code_highlight"><pre>...
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Document</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;blabla&quot;</span> xmlns:xsi =<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span></span>
<span style="color: #009900;">xsi:schemaLocation = <span style="color: #ff0000;">&quot;urn:swift:xsd:$pain... .xsd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
...</pre></td></tr></tbody></table></code><hr />
</div> <br />
doch leider klappt das nicht. Ich bin auch jetzt nicht so gut was namespaces und Schemas betrifft.<br />
<br />
Mein derzeitiger Ansatz ist:<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code csharp:</div>
                <hr /><code class="bbcode_code"><table class="csharp" style="font-family:monospace;"><tbody><tr><td class="bbcode_code_linenumbers"><pre>1
2
3
4
5
6
</pre></td><td class="bbcode_code_highlight"><pre><span style="color: #008000;">...</span>
<span style="color: #0000FF;">XmlAttribute</span> a <span style="color: #008000;">=</span> doc<span style="color: #008000;">.</span><span style="color: #0000FF;">CreateAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;xsi&quot;</span>, <span style="color: #666666;">&quot;http://&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
XmlElement documentNode <span style="color: #008000;">=</span> doc<span style="color: #008000;">.</span><span style="color: #0000FF;">CreateElement</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Document&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
documentNode<span style="color: #008000;">.</span><span style="color: #0000FF;">Attributes</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Append</span><span style="color: #008000;">&#40;</span>a<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
doc<span style="color: #008000;">.</span><span style="color: #0000FF;">AppendChild</span><span style="color: #008000;">&#40;</span>documentNode<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">...</span></pre></td></tr></tbody></table></code><hr />
</div> <br />
und raus kommt:<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code xml:</div>
                <hr /><code class="bbcode_code"><table class="xml" style="font-family:monospace;"><tbody><tr><td class="bbcode_code_linenumbers"><pre>1
</pre></td><td class="bbcode_code_highlight"><pre><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Document</span> <span style="color: #000066;">d1p1:xsi</span>=<span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">xmlns:d1p1</span>=<span style="color: #ff0000;">&quot;http://&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></pre></td></tr></tbody></table></code><hr />
</div> <br />
<br />
help ;)<br />
gruß<br />
Col.Blake</div>

 ]]></content:encoded>
			<category domain="http://www.tutorials.de/net-cafe/">.NET Café</category>
			<dc:creator>colblake</dc:creator>
			<guid isPermaLink="true">http://www.tutorials.de/net-cafe/365381-xml-datei-schemainformationen-hinzufuegen.html</guid>
		</item>
		<item>
			<title>Barcodes erstellen</title>
			<link>http://www.tutorials.de/net-cafe/365370-barcodes-erstellen.html</link>
			<pubDate>Mon, 23 Aug 2010 06:31:37 GMT</pubDate>
			<description>Hallo, 
 
ich suche eine freie Bibliothek zum erstellen von Barcodes. 
Für Datamatrix ginge zwar die von sourceforge, die kann aber eben nur Datamatrix. Bräuchte unbedingt was für Code128. 
www.zint.org.uk kann zwar alles, hat aber keine Programmierschnittstelle für .NET. 
Ich weiß, ich könnte auch...</description>
			<content:encoded><![CDATA[<div>Hallo,<br />
<br />
ich suche eine freie Bibliothek zum erstellen von Barcodes.<br />
Für Datamatrix ginge zwar die von sourceforge, die kann aber eben nur Datamatrix. Bräuchte unbedingt was für Code128.<br />
<a href="http://www.zint.org.uk" target="_blank">www.zint.org.uk</a> kann zwar alles, hat aber keine Programmierschnittstelle für .NET.<br />
Ich weiß, ich könnte auch das Programm als Prozess aufrufen und die erzeugte Datei verwenden - eine dll zum Einbinden und Barcode direkt erzeugen und verwenden wäre mir aber wesentlich lieber.</div>

 ]]></content:encoded>
			<category domain="http://www.tutorials.de/net-cafe/">.NET Café</category>
			<dc:creator>deusfalsus</dc:creator>
			<guid isPermaLink="true">http://www.tutorials.de/net-cafe/365370-barcodes-erstellen.html</guid>
		</item>
		<item>
			<title>WPF und transparente Fenster mit Rahmen im FrameworkElement docken</title>
			<link>http://www.tutorials.de/net-cafe/365367-wpf-und-transparente-fenster-mit-rahmen-im-frameworkelement-docken.html</link>
			<pubDate>Sun, 22 Aug 2010 20:42:50 GMT</pubDate>
			<description>So. 
Und schon das nächste Problem. 
 
Will nun ein paar kleinere Toolfenster in einem Fremworkelement docken UND wenn der Mauszeiger nicht auf denen ist, sollen diese SAMT RAHMEN transparent werden (bzw. halbdurchsichtig). 
 
Nun stoße ich jedoch an meine Grenzen in WPF. 
 
Das Docken bekomme ich...</description>
			<content:encoded><![CDATA[<div>So.<br />
Und schon das nächste Problem.<br />
<br />
Will nun ein paar kleinere Toolfenster in einem Fremworkelement docken UND wenn der Mauszeiger nicht auf denen ist, sollen diese SAMT RAHMEN transparent werden (bzw. halbdurchsichtig).<br />
<br />
Nun stoße ich jedoch an meine Grenzen in WPF.<br />
<br />
Das Docken bekomme ich imoment nur zum gesamten Hauptfenster hin, ein Anfang, aber nicht mein Ziel und auch sehr unschöner Code (instabil¿).<br />
<br />
Code den ich als Funktion aufriufe<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><table class="" style="font-family:monospace;"><tbody><tr><td class="bbcode_code_linenumbers"><pre>1
2
3
</pre></td><td class="bbcode_code_highlight"><pre>Helfer.Fenster_Docken.SetParent(
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new System.Windows.Interop.WindowInteropHelper(this.linienlistefenster).Handle,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new System.Windows.Interop.WindowInteropHelper((Window)((Grid)this.Parent).Parent).Handle);</pre></td></tr></tbody></table></code><hr />
</div> <br />
Code hinter der SetParent-Funktion (Modifizierter und gekürzter Code aus dem Internet, aber funktionsfähig)<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><table class="" style="font-family:monospace;"><tbody><tr><td class="bbcode_code_linenumbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="bbcode_code_highlight"><pre>&nbsp; &nbsp; &nbsp; &nbsp; &#91;DllImport(&quot;user32.dll&quot;, CharSet = CharSet.Auto)&#93;
&nbsp; &nbsp; &nbsp; &nbsp; public static extern IntPtr
&nbsp; &nbsp; &nbsp; &nbsp; FindWindow(&#91;MarshalAs(UnmanagedType.LPTStr)&#93; string lpClassName,
&nbsp; &nbsp; &nbsp; &nbsp; &#91;MarshalAs(UnmanagedType.LPTStr)&#93; string lpWindowName);
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &#91;DllImport(&quot;user32.dll&quot;)&#93;
&nbsp; &nbsp; &nbsp; &nbsp; public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;summary&gt;
&nbsp; &nbsp; &nbsp; &nbsp; /// Einzelnes Form auf den Desktop Festkleben
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;/summary&gt;
&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;param name=&quot;formToDock&quot;&gt;Formular, dass an den Desktop gedockt werden soll&lt;/param&gt;
&nbsp; &nbsp; &nbsp; &nbsp; public void StartDocking(Window formToDock, IntPtr Parent)
&nbsp; &nbsp; &nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IntPtr hwndParent = FindWindow(&quot;progman&quot;, null);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SetParent(new WindowInteropHelper(formToDock).Handle, hwndParent);
&nbsp; &nbsp; &nbsp; &nbsp; }</pre></td></tr></tbody></table></code><hr />
</div> <br />
Das wäre der eine Teil.<br />
<br />
Das mit der Transparenz haut dem ganzen jedoch den Boden aus dem Fass.<br />
Einerseits mag WPF das anscheinend nur wenn ich AllowTransparency auf true stelle.<br />
Im Hauptfenster kein problem, da das eh keinen Rahmen hat.<br />
Im Toolfenster jedoch ein Problem, da das seinen Rahmen behalten soll.<br />
Zudem verschwindet das Toolfenster sofort nach dem Öffnen.<br />
Wenn ich jedoch AllowTransparency im Hauptfenster auf false stelle, bleibt es da, wird aber auch nur grau abgestuft.<br />
<br />
Wenn wer nicht weiß wie ich das meine, Paint.Net ist dazu das beste Beispiel.<br />
Hoffe es weiß mal wieder wer Rat^^<br />
<br />
Gruß Drache2</div>

 ]]></content:encoded>
			<category domain="http://www.tutorials.de/net-cafe/">.NET Café</category>
			<dc:creator>Drache2</dc:creator>
			<guid isPermaLink="true">http://www.tutorials.de/net-cafe/365367-wpf-und-transparente-fenster-mit-rahmen-im-frameworkelement-docken.html</guid>
		</item>
		<item>
			<title>Nach Bildladen findet System.IO.File.Exist() keine Dateien mehr.</title>
			<link>http://www.tutorials.de/net-cafe/365315-nach-bildladen-findet-system-io-file-exist-keine-dateien-mehr.html</link>
			<pubDate>Sat, 21 Aug 2010 12:47:04 GMT</pubDate>
			<description>Tach allerseits. 
 
Bin im Moment an einem, für meine Verhältnisse, relativ großen Projekt, nämlich ein Fräsenansteuerungsprogramm für eine selbstgebaute Platinenfräse. 
 
Nun will ich in einem Selbstgeschriebenen Frameworkelement (der Editor) eine Bilddatei einladen, die vom Nutzer ausgesucht...</description>
			<content:encoded><![CDATA[<div>Tach allerseits.<br />
<br />
Bin im Moment an einem, für meine Verhältnisse, relativ großen Projekt, nämlich ein Fräsenansteuerungsprogramm für eine selbstgebaute Platinenfräse.<br />
<br />
Nun will ich in einem Selbstgeschriebenen Frameworkelement (der Editor) eine Bilddatei einladen, die vom Nutzer ausgesucht werden aknn (GUI und co. steht).<br />
das Bild lädt auch wunderbar.<br />
Also, Status: Bild geladen, wird angezeigt, noch läuft alles wunderbar.<br />
Jedoch wenn ich dann,<br />
mit hilfe von System.IO.File.Exist(Pfad),<br />
gucken will, ob eine Datei Existiert, sagt der mir IMMER, die existiere nicht, obwohl ich zu 100% weiß und es auch x-fach überprüft habe, dass diese genau da existiert.<br />
<br />
Dachte erts es liege am Openfiledialog, aber das konnte ich schnell wiederlegen.<br />
Bleibt also nurnoch die Bildlademethode.<br />
<br />
Nun, hier der relevante Code mit dem ich die Bilddatei (IMMER .bmp) in ein ImageSource lade:<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><table class="" style="font-family:monospace;"><tbody><tr><td class="bbcode_code_linenumbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="bbcode_code_highlight"><pre>//Das ist die Variable in der ich das Bild abspeicher, um es später zeichnen zu können.
//ImageSource platinenhintergrundbild
&nbsp;
//Neuer_Pfad ist der Absolute Dateipfad für das Bild.
&nbsp;
var uriSource = new Uri(Neuer_Pfad, UriKind.Absolute);
this.platinenhintergrundbild = new System.Windows.Media.Imaging.BitmapImage(uriSource);</pre></td></tr></tbody></table></code><hr />
</div> <br />
Das Beispiel habe ich aus dem Internet geholt.<br />
Das Projekt läuft unter .Net 3.5 und ist in C# geschrieben.<br />
Nutze selbst Win7 ulti 32bit, das Projekt sollte aber auch auf XP 32 bit laufen!<br />
Die Abfrage der Existens einer Datei mit System.IO.File.Exist(Pfad) geschiet mit relativen Pfadangaben.<br />
Die Bilddatei wird mit Absoluten Pfadangaben geladen.<br />
<br />
Hoffe es weiß wer Rat.<br />
Oder vielleicht kennt ja jemand eine bessere Möglichkeit ein Bild (bmp) zu laden.<br />
<br />
Gruß Drache2</div>

 ]]></content:encoded>
			<category domain="http://www.tutorials.de/net-cafe/">.NET Café</category>
			<dc:creator>Drache2</dc:creator>
			<guid isPermaLink="true">http://www.tutorials.de/net-cafe/365315-nach-bildladen-findet-system-io-file-exist-keine-dateien-mehr.html</guid>
		</item>
		<item>
			<title>C# schlechte Datenbank laufzeit</title>
			<link>http://www.tutorials.de/net-cafe/365258-c-schlechte-datenbank-laufzeit.html</link>
			<pubDate>Fri, 20 Aug 2010 09:26:08 GMT</pubDate>
			<description>Hallo :) 
ich habe folgende problem: 
 
mein tool welches ich gerade programmiere, hat eine katastrophale laufzeit in der Datenbindung. ich habe ein datagrid und ein dazugehöriges dataset. dazu habe ich noch ein suchfeld gebaut. in dem dataset habe ich ca 3000 einträge (mit 500 oder sogar weniger...</description>
			<content:encoded><![CDATA[<div>Hallo :)<br />
ich habe folgende problem:<br />
<br />
mein tool welches ich gerade programmiere, hat eine katastrophale laufzeit in der Datenbindung. ich habe ein datagrid und ein dazugehöriges dataset. dazu habe ich noch ein suchfeld gebaut. in dem dataset habe ich ca 3000 einträge (mit 500 oder sogar weniger habe ich das gleiche problem) wenn ich jetzt z.b. nach dem namen peter suchen würde, hätte ich mind. 5 sekunde wo das programm hängt. das liegt daran das ich nach jeden buchstaben das dataset neu laden muss. ich habe es dann mal probiert mit dem dataset zuarbeiten. so das ich einmal am anfang alle daten lade und dann darin dann nur noch die abfrage mache. das hat dann aber zur folge das meine daten nicht mehr aktuell sind, da auf die datenbank mehrere leute zugreifen und auch ändern können.<br />
<br />
also muss ich irgendwie versuchen immer die aktuellen daten in einer angemessenden zeit zubekommen.<br />
<br />
ich hoffe mir kann da jemand weiterhelfen<br />
vielen dank im vorraus :)</div>

 ]]></content:encoded>
			<category domain="http://www.tutorials.de/net-cafe/">.NET Café</category>
			<dc:creator>xlon</dc:creator>
			<guid isPermaLink="true">http://www.tutorials.de/net-cafe/365258-c-schlechte-datenbank-laufzeit.html</guid>
		</item>
		<item>
			<title>Excel-Datei erstellen und Modul importieren</title>
			<link>http://www.tutorials.de/net-cafe/365165-excel-datei-erstellen-und-modul-importieren.html</link>
			<pubDate>Wed, 18 Aug 2010 11:06:46 GMT</pubDate>
			<description><![CDATA[Hallo zusammen! 
Ich möchte, wie oben beschrieben, aus VB.Net heraus eine Excel-Datei erstellen 
und anschließend ein Modul Modul1.bas importieren. 
 
Allerdings bekomme ich beim Importieren eine Fehlermeldung, 
mit der ich nichts anfangen kann. 
 
Mein Versuch bisher: 
 
<div...]]></description>
			<content:encoded><![CDATA[<div>Hallo zusammen!<br />
Ich möchte, wie oben beschrieben, aus VB.Net heraus eine Excel-Datei erstellen<br />
und anschließend ein Modul <i>Modul1.bas</i> importieren.<br />
<br />
Allerdings bekomme ich beim Importieren eine Fehlermeldung,<br />
mit der ich nichts anfangen kann.<br />
<br />
Mein Versuch bisher:<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><table class="" style="font-family:monospace;"><tbody><tr><td class="bbcode_code_linenumbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="bbcode_code_highlight"><pre>Public Class Form1
&nbsp;
&nbsp; &nbsp; Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
&nbsp; &nbsp; &nbsp; &nbsp; Dim xlApp As Microsoft.Office.Interop.Excel.Application
&nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; xlApp = New Microsoft.Office.Interop.Excel.Application
&nbsp; &nbsp; &nbsp; &nbsp; xlApp.Visible = False
&nbsp; &nbsp; &nbsp; &nbsp; xlApp.Workbooks.Add()
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; xlApp.ThisWorkbook.VBProject.VBComponents.Import(&quot;\\filesrv2\cad_arch.ara\HUDDEL\CAD\Entwicklungen\VBA_Module\Modul1.bas&quot;)
&nbsp; &nbsp; &nbsp; &nbsp; xlApp.ActiveWorkbook.SaveAs(&quot;c:\test1.xls&quot;)
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; xlApp.Application.Quit()
&nbsp; &nbsp; &nbsp; &nbsp; xlApp = Nothing
&nbsp; &nbsp; End Sub
End Class</pre></td></tr></tbody></table></code><hr />
</div> <br />
Fehlermeldung kommt in Zeile 10 (siehe Anhang).<br />
Ich habe den Verweis auf Visual Basic for Applications gesetzt,<br />
aber vielleicht fehlt mir ein weiterer Verweis?<br />
Kann mir da jemand weiterhelfen?<br />
Danke!<br />
Gruß Outi<br />
<br />
P.S.: Folgender Verweis ist ebenfalls gesetzt:<br />
Microsoft Visual Basic for Applications Extensibility 5.3</div>


	<div style="padding:10px">

	
		<fieldset class="fieldset">
			<legend>Miniaturansicht angehängter Grafiken</legend>
			<div style="padding:10px">
			
<a href="http://www.tutorials.de/attachments/net-cafe/54183d1282129422-test1.jpg" 
rel="Lightbox_1891644" id="attachment54183"
 target="_blank"><img class="thumbnail" style="max-width:200px;" src="http://www.tutorials.de/attachments/net-cafe/54183d1282129422t-test1.jpg" 
alt="Klicke auf die Grafik für eine größere Ansicht

Name:	test1.JPG
Hits:	-
Größe:	246,5 KB
ID:	54183"/></a>
&nbsp;
 
			</div>
		</fieldset>
	

	

	

	

	</div>
 ]]></content:encoded>
			<category domain="http://www.tutorials.de/net-cafe/">.NET Café</category>
			<dc:creator>Outsider77</dc:creator>
			<guid isPermaLink="true">http://www.tutorials.de/net-cafe/365165-excel-datei-erstellen-und-modul-importieren.html</guid>
		</item>
		<item>
			<title>C# Outlook 2007 Add-In mit VS 2008</title>
			<link>http://www.tutorials.de/net-cafe/365079-c-outlook-2007-add-mit-vs-2008-a.html</link>
			<pubDate>Tue, 17 Aug 2010 09:59:08 GMT</pubDate>
			<description><![CDATA[Hallo, 
 
habe ein Outlook-Add-In mit VS 2008 erstellt, alles läuft gut nur in dieser Stelle , wo ich die Felder auslesen will. 
 
<div class="bbcode_container"> 
                <div class="bbcode_description">Code :</div> 
                <div class="bbcode_code"...]]></description>
			<content:encoded><![CDATA[<div>Hallo,<br />
<br />
habe ein Outlook-Add-In mit VS 2008 erstellt, alles läuft gut nur in dieser Stelle , wo ich die Felder auslesen will.<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><table class="" style="font-family:monospace;"><tbody><tr><td class="bbcode_code_linenumbers"><pre>1
2
3
4
5
</pre></td><td class="bbcode_code_highlight"><pre>Outlook.MAPIFolder inBox = (Outlook.MAPIFolder)this.oeExplorer.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
Outlook.Items items = (Outlook.Items)inBox.Items;
Outlook.MailItem moveMail = null;
Outlook.MAPIFolder destFolder = inBox.Folders&#91;&quot;Test&quot;&#93;; //&gt;&gt; hier meldet VS2008 keinen Fehler, der Cursor steigt aus und der Focus geht in Outlook-Fenster! 
MAPIFolder abc = inbox.Folders&#91;0&#93;; // &gt;&gt; das habe ich auch versucht &gt; dasselbe Problem!</pre></td></tr></tbody></table></code><hr />
</div> <br />
Hat jemand von Euch einen Tipp oder Idee?<br />
Vielen Dank</div>

 ]]></content:encoded>
			<category domain="http://www.tutorials.de/net-cafe/">.NET Café</category>
			<dc:creator>MehdiGruss</dc:creator>
			<guid isPermaLink="true">http://www.tutorials.de/net-cafe/365079-c-outlook-2007-add-mit-vs-2008-a.html</guid>
		</item>
	</channel>
</rss>
