Para conocer el Hwnd de una ventana powerbuilder en la ayuda te da las siguientes opciones:
This statement returns the handle to the window w_child:
Handle(w_child)
These statements use an external function in Windows called FlashWindow to change the title bar of a window to inactive and then return it to active. The external function declaration is:
function boolean flashwindow(uint hnd, boolean inst) &
library "user.exe"
The code that flashes the window's title bar is:
integer nLoop // Loop counter
long hWnd // Handle to control
// Get the handle to a PowerBuilder window.
hWnd = Handle(Parent)
// Make the title bar flash 300 times.
FOR nLoop = 1 to 300
FlashWindow (hWnd, TRUE)
NEXT
// Return the window to its original state.
FlashWindow (hWnd, FALSE)
For applications on Windows, the Handle function does not return a useful value when the previous flag is TRUE. You can use the FindWindowA Windows function to determine whether a Windows application is already running.
Declare FindWindowA as a global external function:
FUNCTION uint FindWindowA (long classname, &
string windowname) LIBRARY "user32.dll"
Then add code like the following to your application's open event:
uint val
val = FindWindowA(0, "MyApp Main Window")
IF val > 0 THEN
MessageBox("Application already running", &
"MyApp is already running. You cannot &
start it again")
HALT CLOSE
ELSE
open(w_main)
END IF