Older Newer
Tue, 28 Dec 2021 03:25:23 . . . . SyneRyder [Initial function definition]


Changes by last author:

Added:
= getCtlHandle =

== Syntax ==

:int* getCtlHandle(int n)

== Arguments ==

n

:The number of the control you want the handle of

== Returns ==

:A handle to the requested control

== Description ==

:Gets the window handle (pointer) of the specific control. The handle can then be used with other Win32 API commands that require a window/control handle.

== Example ==

<code>

// This code loads the user32.dll

// DLL included with Windows and

// uses it to hide and show the

// scrollbar control.

ctl[1]: STANDARD, Text="Example"

int* lib_user32;

int* functionPointer;

int* controlHandle;

int returnval;

// Load the DLL library

lib_user32 = loadLib("user32");

if (lib_user32) {

// Get the function in the DLL

functionPointer = getLibFn(lib_user32, "ShowWindow");

if (functionPointer) {

// Get the handle of the dialog

controlHandle = getCtlHandle(1);

// Call the function to hide the scrollbar

msgBox(MB_OK, "Hiding...", "About to hide scrollbar");

returnval = callLib(functionPointer, controlHandle, SW_HIDE);

// Call the function to show the dialog window

msgBox(MB_OK, "Showing...", "About to show scrollbar again");

returnval = callLib(functionPointer, controlHandle, SW_SHOW);

}

else msgBox(MB_OK, "Error", "Function wasn't loaded");

// Free the library DLL

freeLib(lib_user32);

}

else msgBox(MB_OK, "Error", "DLL was not loaded");

</code>

== See Also ==

:getDialogHandle

== Comments ==

:Everyone can add his comments about his experiences with this function here. Tips for using it are welcome, too.