Thursday, December 4, 2008

Convert Win API calls to PB10

Function declaration needs to be modifed to specify ANSI:
FUNCTION long ShellExecuteA (ulong hWnd, &
string Operation, string lpFile, string lpParameters, &
string lpDirectory, long nShowCmd) LIBRARY "shell32.dll" &
ALIAS FOR "ShellExecuteA;Ansi"
From the PowerBuilder 10 Help:If your application makes calls to external functions, and there is a Unicode version of the external function, convert the calls to the Unicode versions of the functions. For example, a call to SQLGetInfo should be changed to SQLGetInfoW.
If the function passes a string, char, or structure as an argument or returns a string, char, or structure, you can use the same syntax in PowerBuilder 10 as in previous releases if the string uses Unicode encoding. For example:
FUNCTION int MyMessageBoxW(int handle, string content, string title, int
showtype) LIBRARY "user32.dll" ALIAS FOR "MessageBoxW"
As for structure with PB10, char is now 16 bit :
// before PB10
global type mystruct from structure
long l1
char pad1
char pad2
long l2
char pad3
char pad4
end type
// PB10
global type mystruct from structure
long l1
char pad1
long l2
char pad2
end type

No comments:

Custom Search