gaslouk
Full Member
Hi from beautiful Greece.
Posts: 130
|
Post by gaslouk on Feb 4, 2023 3:06:00 GMT -5
Hi. How can I use CALLDLL please? What do I need to know about the DLL in order to use it properly?
Thanks.
|
|
|
Post by Walt Decker on Feb 4, 2023 8:34:25 GMT -5
You first have to load the dll. If it is one of the WINAPI dlls it is probably loaded. The three WINAPI DLLs I know of that are automatically loaded are:
User32.DLL, Kernel32.dll and Gdi32.DLL Those three you can call by using:
CALLDLL #user32, "function name", param1, param2, param3 CALLDLL #kernel32, "function name", param1, param2, param3 CALLDLL #gdi32, "function name", param1, param2, param3
Second party dlls must be explicitly loaded with:
OPEN "DLL NAME" FOR DLL AS #SOMETAG
Then you use CALLDLL in the same form as for the WINAPI dlls using the appropriate functions and parameters.
You have to read the documentation for the dlls. This documentation will give the function names available, the parameter types required for each function, and the return value (if any).
|
|
|
CALLDLL
Feb 4, 2023 15:54:54 GMT -5
Post by Rod on Feb 4, 2023 15:54:54 GMT -5
|
|
|
CALLDLL
Feb 4, 2023 17:27:51 GMT -5
Post by Walt Decker on Feb 4, 2023 17:27:51 GMT -5
Another resource can be found in the General Discussion thread topic "Things You Do Not Want to Know About the Win31 API".
Some commonly used WinAPI functions:
DLL: User32.dll "SendMessageA", WinHndl AS ULONG, Msg AS ULONG, Param1 AS LONG, Param2 AS LONG, RetVal AS LONG Msg is specific to the window/control Param1 and Param2 are also specific to the window/control
"GetWindowTextLengthA", WinHndl AS ULONG, NumChars AS LONG WinHndl is the handle of the form window or control NumChars is the number of characters contained in the window name
"GetWindowTextA", WinHndl AS ULONG, WinTxt$ AS STRUCT, NumChars AS LONG, RetChars AS LONG WinHndl is the handle of the form or control WinTxt$ receives the text NumChars is the number of characters to return in WinTxt$ RetChars is the number of characters returned or the lenght of the text if WinTxt$ is not large enough
"SetWindowTextA", WinHndl AS ULONG, WinTxt$ AS PTR, RetVal AS LONG WinHndl is the handle of the form or control WinTxt$ is the text to set RetVal is a return value, non-zero on success
Gdi32.Dll: "GetPixel", DevDc AS ULONG, Px AS LONG, Py AS LONG, Colour AS ULONG DevDc is the device context Px, Py are the coordinates of the point to query Colour is the 32-bit color of the pixel
"MoveToEx", DevDc, Px AS LONG, Py AS LONG, 0 AS LONG, RetVal AS LONG DevDc is the device context Px, Py are the coordinates of the point RetVal is the return value, non-zero on success
"LineTo", DevDc AS ULONG, Px AS LONG, Py AS LONG, RetVal AS LONG Px, Py are the coordinates of the point RetVal is the return value, non-zero on success
The 32-bit WinAPI is hugh and has grown with the advent of 64-bit architecture. I doubt if anyone really knows the WinAPI. That is why you have to read the documentation; however, functions in the WinAPI are not easy to find.
|
|
gaslouk
Full Member
Hi from beautiful Greece.
Posts: 130
|
Post by gaslouk on Feb 5, 2023 0:12:06 GMT -5
Thanks Team for the help.
|
|