Microsoft KB Archive/68807

INF: Guide to Programming Get Printer Information Code Wrong ID Number: Q68807

3.00 WINDOWS docerr

Summary:

The sample code in section 12.2 of the “Microsoft Windows Software Development Kit Guide to Programming” is incorrect. On page 12-3, the code by bullet 1 that reads

GetProfileString(&quot;windows&quot;,                    &quot;device&quot;,                     pPrintInfo,                     (LPSTR) NULL, 80); must be changed to read:

GetProfileString(&quot;windows&quot;,                    &quot;device&quot;,                     &quot;&quot;,                     pPrintInfo, 80); More Information:

The fourth parameter to GetProfileString specifies a buffer to receive the result of the GetProfileString operation. In the sample above, this value should be pPrintInfo, not NULL.

The third parameter to GetProfileString is the value to return if the specified key does not exist in the initialization file. This value must not be the NULL pointer. However, a pointer to an empty string (&quot;&quot;) is perfectly acceptable and will return an empty string if the specified key does not exist.

Additional reference words: 3.00