PRLAN9210002: Visual Basic INCLUDE File PMDEST.TXT (90174)
The information in this article applies to:
- Microsoft LAN Manager 2.0
- Microsoft LAN Manager 2.1
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 "Bad DLL Calling
Convention" 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 "unsigned short," 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 "Bad DLL Calling
Convention" 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 "PMSPL.DLL" (ByVal pszS...
Declare Function DosPrintDestControl Lib "PMSPL.DLL" (ByVal pszS...
Declare Function DosPrintDestGetInfo Lib "PMSPL.DLL" (ByVal pszS...
Declare Function DosPrintDestAdd Lib "PMSPL.DLL" (ByVal pszS...
Declare Function DosPrintDestSetInfo Lib "PMSPL.DLL" (ByVal pszS...
Declare Function DosPrintDestDel Lib "PMSPL.DLL" (ByVal pszS...
These lines should be changed to:
Declare Function DosPrintDestEnum% Lib "PMSPL.DLL" (ByVal pszS...
Declare Function DosPrintDestControl% Lib "PMSPL.DLL" (ByVal pszS...
Declare Function DosPrintDestGetInfo% Lib "PMSPL.DLL" (ByVal pszS...
Declare Function DosPrintDestAdd Lib% "PMSPL.DLL" (ByVal pszS...
Declare Function DosPrintDestSetInfo% Lib "PMSPL.DLL" (ByVal pszS...
Declare Function DosPrintDestDel% Lib "PMSPL.DLL" (ByVal pszS...
Note the percent sign (%) that now ends each API name. This defines
the functions as returning integers, and therefore will avoid the
"Bad DLL Calling Convention" 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.
Modification Type: | Major | Last Reviewed: | 9/30/2003 |
---|
Keywords: | KB90174 |
---|
|