Page 1 of 1

FindWindow_ & Fullscreen apps

Posted: Tue May 25, 2004 3:04 pm
by The Real KrazyK
Hi everyone,
This may be a bit of a noob question but i've searched here already and could not find anything that can help me....so here goes.

I need to find the handle of a window that is running fullscreen mode (not maximized).

My scenario:

I set up a hotkey using RegisterHotkey which does a FindWindow on a particular app title then closes the window.
I then launch my 3rd party app (using RunProgram - mode 2) that runs in fullscreen mode.
When I press my key combo it shuts the external program immediately, unregisters the hotkey and returns back to the main program.

So far so good, but it doesn't work on Win98 when in fullscreen mode - it only works when it is in windowed mode. It works perfectly on 2000/XP in either mode though.
Is this a limitation of Win98 or is there another method I should know about ?

I can find the process easily enough and kill it but don't want to use it as the app detects that it wasn't shut down properly when run again and displays a big messagebox - not good :!:

This is the only problem I have left with my program - can anyone help ?

Kind Regards

KrazyK

Posted: Tue May 25, 2004 4:06 pm
by fweil
I am not sure but does the fullscreen mode app have a name, I mean is not the name just empty where you expect to find the same name as you get in windowed mode ?

Maybe it is the issue you have there. In this case, you should try to get the handle in another way.

Rgrds

Posted: Wed May 26, 2004 10:52 am
by The Real KrazyK
Hi,
It seems that the following code doesn't work in fullscreen mode under win9x (not with this particular app anyway) I'm using a procedure I found elsewhere on this forum.
The program i'm launching is an Atari ST emulator in fullscreen mode.

Code: Select all

Procedure MyWindowCallback(WindowID,message,wParam,lParam) 
  Result=#PB_ProcessPureBasicEvents 
  If Message=#WM_HOTKEY 
    hWnd = FindWindow_(0, "Steem Engine")        
    If hWnd <> 0                                               
      SendMessage_(hWnd, #WM_CLOSE, 0, 0)      
      UnregisterHotKey_(WindowID(),1) 
     EndIf 
  EndIf 
ProcedureReturn Result
EndProcedure

I then open my window and the next part of the code is:

Code: Select all

RegisterHotKey_(WindowID(),1,#MOD_SHIFT | MOD_CONTROL,#VK_Z)
SetWindowCallback(@MyWindowCallback())                                        
RunProgram("steem.exe","","",2)
Then my program continues as normal until I close the window.

The only mode this doesn't work is Win9x in fullscreen. The callback seems to fail as i've tried to create a file as a test when the keys are pressed and no file has been created.
I'm going to put it down to the OS unless somebody knows differently. :?
Anyone ?