Microsoft KB Archive/90174

= PRLAN9210002: Visual Basic INCLUDE File PMDEST.TXT =

Article ID: 90174

Article Last Modified on 9/30/2003

-

APPLIES TO


 * Microsoft LAN Manager 2.0 Standard Edition
 * Microsoft LAN Manager 2.1 Standard Edition

-



This article was previously published under Q90174



SUMMARY
PROBLEM ID: PRLAN9210002



SYMPTOMS
When writing a Visual Basic application using the LAN Manager for Visual Basic Toolkit, you may get the error &quot;Bad DLL Calling Convention&quot; if you try to call any of the following LAN Manager APIs:

DosPrintDestControl

DosPrintDestGetInfo

DosPrintDestAdd

DosPrintDestSetInfo

DosPrintDestDel

This is not a problem with your application. There is a known problem in the INCLUDE file, PMDEST.TXT, for the Print Destination APIs.



CAUSE
Each of the APIs listed above return an unsigned short that contains an error code or zero on success. Because Basic does not understand the concept of data types like &quot;unsigned short,&quot; the LAN Manager Toolkit for Visual Basic processes these return codes as integers.

In the case of the above APIs, the INCLUDE file PMDEST.TXT, which contains their declarations, does not properly define these functions as returning integers. Therefore when you try to run your Visual Basic application, you will get a &quot;Bad DLL Calling Convention&quot; error when you attempt to call any of these APIs.



RESOLUTION
You can work around this problem by modifying the function declarations in PMDEST.TXT, and reimporting this INCLUDE file into your application. In the Function Prototypes section, the following lines read:      Declare Function DosPrintDestEnum% Lib &quot;PMSPL.DLL&quot; (ByVal pszS...      Declare Function DosPrintDestControl Lib &quot;PMSPL.DLL&quot; (ByVal pszS...      Declare Function DosPrintDestGetInfo Lib &quot;PMSPL.DLL&quot; (ByVal pszS...      Declare Function DosPrintDestAdd Lib &quot;PMSPL.DLL&quot; (ByVal pszS...      Declare Function DosPrintDestSetInfo Lib &quot;PMSPL.DLL&quot; (ByVal pszS...      Declare Function DosPrintDestDel Lib &quot;PMSPL.DLL&quot; (ByVal pszS... These lines should be changed to:      Declare Function DosPrintDestEnum% Lib &quot;PMSPL.DLL&quot; (ByVal pszS...      Declare Function DosPrintDestControl% Lib &quot;PMSPL.DLL&quot; (ByVal pszS...      Declare Function DosPrintDestGetInfo% Lib &quot;PMSPL.DLL&quot; (ByVal pszS...      Declare Function DosPrintDestAdd Lib% &quot;PMSPL.DLL&quot; (ByVal pszS...      Declare Function DosPrintDestSetInfo% Lib &quot;PMSPL.DLL&quot; (ByVal pszS...      Declare Function DosPrintDestDel% Lib &quot;PMSPL.DLL&quot; (ByVal pszS... Note the percent sign (%) that now ends each API name. This defines the functions as returning integers, and therefore will avoid the &quot;Bad DLL Calling Convention&quot; error.



STATUS
Microsoft has confirmed this to be a problem in LAN Manager versions 2.0 and 2.1. We are researching this problem and will post new information here as it becomes available.

Additional query words: PMSPL.DLL windows 2.0 2.00 2.1 2.10

Keywords: KB90174

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.