devxlogo

Bringing another application to the foreground

Bringing another application to the foreground

Question:
How can I bring an open application to the foreground (that is, move the PowerBuilder app back a layer).

Answer:
To bring another application to the front, you will need to use some API calls. Create a user object in PowerBuilder and define the following API calls:

function long FindWindowA( string lpClass, string lpTitle ) library 'user32'function long SetFocus( long hdWnd ) library 'user32'subroutine BringWindowToTop( long hdWind ) Library "user32"

Then you will need to call the findWindowA API call to get a handle to the window you want to bring to the front. For example:

// Check for the PB handlell_PBHandle = FindWindowA( ls_NULL, 'PBBrowse' )

Then once we have the handle, we can bring the window to the front with the other API calls:

BringWindowToTop( ll_PBHandle )SetFocus( ll_PBHandle )
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist