How would this be converted from Foxpro to XSharp?
DECLARE Long GetLastError IN WIN32API
DECLARE Long SetDefaultPrinter In WINSPOOL.DRV String pPrinterName
DECLARE INTEGER GetDefaultPrinter IN winspool.drv STRING @ pszBuffer, INTEGER @ pcchBuffer
calling windows dll
calling windows dll
Kevin,
You can also change the last 2 calls and change the CharSet to CharSet.Unicode and change the "A" at the end of the function name to "W" to call the Unicode versions of these functions.
Robert
Code: Select all
// traditional syntax
_DLL FUNCTION GetLastError as INT PASCAL:Win32API.GetLastError()
// dotnet syntax
[DllImport("Win32API.dll")];
FUNCTION GetLastError() AS INT PASCAL
[DllImport("winspool.drv", CharSet := CharSet.Ansi, EntryPoint :="SetDefaultPrinterA" )];
FUNCTION SetDefaultPrinter( pPrinterName as STRING) AS LOGIC PASCAL
[DllImport("winspool.drv", CharSet := CharSet.Ansi, EntryPoint :="GetDefaultPrinterA" )];
FUNCTION GetDefaultPrinter( pszBuffer as StringBuilder, pcchBuffer REF INT) AS LOGIC PASCAL
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
- kevclark64
- Posts: 127
- Joined: Thu Aug 15, 2019 7:30 pm
- Location: USA
calling windows dll
Robert, thanks for that information.