Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Handle – PB Docs 2021 – PowerBuilder Library

Handle – PB Docs 2021

Handle

PowerScript function

Description

Obtains the Windows handle of a PowerBuilder object. You can get the
handle of the application, a window, or a control, but not a drawing
object.

Syntax

Argument

Description

objectname

The name of the PowerBuilder object for which you want the
handle. Objectname can be any PowerBuilder object, including an
application or control, but cannot be a drawing object.

previous (optional)

(Obsolete argument) A boolean indicating whether you want
the handle of the previous instance of an application. You can
use this argument with the Application object only.

In current versions of Windows, Handle always returns 0
when this argument is set to true.

Return value

Longptr. Long if the application is compiled as 32-bit, and longlong
if compiled as 64-bit.

Returns the handle of objectname. If objectname is an application
and previous is true, Handle always returns 0.

If objectname cannot be referenced at runtime, Handle returns 0 (for
example, if objectname is a window and is not open).

Usage

Use Handle when you need an object handle as an argument to Windows
Software Development Kit (SDK) functions or the PowerBuilder Send
function.

Use IsValid instead of the Handle function to determine whether a
window is open.

When you ask for the handle of the application, Handle returns 0
when you are using the PowerBuilder Run command. As far as Windows is
concerned, your application does not have a handle when it is run from
PowerBuilder. When you build and run an executable version of your
application, the Handle function returns a valid handle for the
application.

If you ask for the handle of a previous instance of an application
by setting the previous flag to true, Handle always returns 0 in current
versions of Windows. Use the Windows FindWindow function to determine
whether an instance of the application’s main window is already
open.

Examples

This statement returns the handle to the window w_child:

These statements use an external function called FlashWindow to
change the title bar of a window to inactive and then return it to active.
The external function declaration is:

The code that flashes the window’s title bar is:

For applications, the Handle function does not return a useful value
when the previous flag is true. You can use the FindWindow Windows
function to determine whether a Windows application is already running.
FindWindow returns the handle of a window with a given title.

Declare FindWindow and SetForegroundWindow as global external
functions:

Then add code like the following to your application’s Open
event:

See also

Send


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x