ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Windows functions / Miscellaneous Windows functions
  • 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.
PROCEDURE StartATrace()
// Open 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)
PROCEDURE EnumerateWindow(nHwnd is int, nFile is int)
// Write into the file
fWriteLine(nFile, nHwnd)
RETURN True
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help