PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Example: Calling a function of the Windows API with Callback
CallDLL32 (Example)
Example: Calling a function of the Windows API with Callback
The following example is used to implement a trace file containing all the identifiers (handles) of the windows currently opened on the current computer.
The StartATrace procedure opens the trace file and lists the windows via the ListWindows function of the User32 API.
The EnumerateWindow procedure is called by the EnumWindows function of the User32 API whenever a window is found. This procedure is used to write the identifier of the window found into the trace file.
PROCÉDURE StartATrace()
// Open the file
nFile is int = fOpen("C:\WindowHandle.txt", foCreate)
IF nFile = -1 THEN
Error("Problem with the file")
EndProgram()
END
// Start the enumeration
CallDLL32("User32", "EnumWindows", &EnumerateWindow, nFile)
// Close the file
fClose(nFile)
PROCÉDURE EnumerateWindow(nHwnd is int, nFile is int)
// Write into the file
fWriteLine(nFile, nHwnd)
RESULT True
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment