ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Windows functions / Windows Event functions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Returns the system "Handle" (HWND) of a WINDEV control or window. This allows you to call some API functions with this parameters (with API or CallDLL32, SendMessage or PostMessage).
This "Handle" is rarely used with WLanguage functions.
iPhone/iPad Returns the UIView associated with the window. This identifier can be used when programming in Objective C.
remark: the UIView is not initialized in the declaration code of global variables of the window but in the end of initialization code of the window. For more details, see Using Objective C code.
Example
// Copy the content of an edit control to the clipboard
SendMessage(Handle(EDT_EDIT1), WM_COPY, 0, 0)
WINDEVReports and QueriesUser code (UMC)
// Immediately refresh the drawing of CONTROL1
hwnd is int = Handle(CONTROL1)
CallDLL32("USER32", "UpdateWindow", hwnd)
Syntax

Retrieving the handle of a control or window Hide the details

<Result> = Handle([<Object name>])
<Result>: Pointer
Requested handle.
<Object name>: Optional character string
Control or window name. If this parameter is not specified, Handle uses the current window. If this parameter corresponds to a table column, the handle of its edit control will be returned (NULL if the column is not in edit).

Retrieving the handle of a specific element in a control Hide the details

<Result> = Handle([<Object name>, ] <Object type>)
<Result>: Integer
Requested handle.
<Object name>: Optional character string
Control name.
<Object type>: Integer constant
Element of the Combo Box whose handle is requested.
HandleAutocompleteListReturns the handle of the drop-down list associated with a control that has the autocomplete feature.
HandleComboBoxEditReturns the handle of the edit control associated with a Combo Box (the control must be a Combo Box control).
HandleComboBoxListReturns the handle of the drop-down list associated with a Combo Box (the control must be a Combo Box control).
HandleHScrollbarReturns the handle of the horizontal scrollbar of the control.
HandleVScrollbarReturns the handle of the vertical scrollbar of the control.
iPhone/iPad

Retrieving the handle of an iPhone/iPad window Hide the details

<Result> = Handle([<Object name>, ] <Object type>)
<Result>: Integer
UIView associated with the window.
<Object name>: Optional character string
Name of the window. If this name corresponds to a control name, <Result> will correspond to NULL.
<Object type>: Integer constant
Element whose handle is sought.
HandleNativeControlReturns the native iOS control associated with the specified control. If this constant is used, <Result> will correspond to a non-null value for the following controls only: Map control (MKMapView) and HTML control (WKWebView).
HandleUIViewControllerReturns the UIViewController associated with the specified window. If this constant is used, <Result> will correspond to a non-null value for the windows only (but not for the controls).
Related Examples:
The alarms Unit examples (WINDEV): The alarms
[ + ] Implementing an alarm to display an alert message in the title bar of the active window (regardless of the application).
The following topics are presented:
1/ The system functions (retrieving the handle of a window)
2/ Triggering a process according to a given frequency (timers)
Business / UI classification: UI Code
Component: wd290obj.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Exemplo
PROCEDURE Api_OnTop(mywin, on_off)

FunctionReturn is boolean = False
hWnd is system int = Handle({mywin}) //ID UNICO DO FORM
hWndInsertAfter is system int = {mywin}
X is int = {mywin}..X
Y is int = {mywin}..Y
cx is int = {mywin}..Width
cy is int = {mywin}..Height
uFlags is int = 0


IF hWnd > 0 THEN

IF on_off = True THEN
hWndInsertAfter = -1
uFlags = 2
ELSE
hWndInsertAfter = -2
uFlags = 0
END

FunctionReturn=API("USER32","SetWindowPos",hWnd,hWndInsertAfter,X,Y,cx,cy,uFlags)

IF error() > 0
Error(ErrorInfo())
END

ELSE

Info("Handle nao informado, por favor passe o nome da janela no paramentro inicial!")

END

RESULT FunctionReturn
Boller
21 Apr. 2023
Example uso
https://repository.windev.com/resource.awp?file_id=281474976711832;api-top-windows-janela-primeiro-plano-sempre
Boller
21 Apr. 2023

Last update: 06/23/2023

Send a report | Local help