Welcome! Log In Create A New Profile

Advanced

Focus Gain Main Window

Posted by Michael Drechsel 
Michael Drechsel
Focus Gain Main Window
July 13, 2008 05:47PM
Hi,

how can I get the Focus Gain Event from my main window. I put some code in the focus gain section of this window, but I think, it doesn´t work.

I want to know if the user go from outlook to my application.

Any ideas ?

Greetings Michael
KenKnight
Re: Focus Gain Main Window
July 13, 2008 07:21PM
Hi Michael,

It sounds like you are in the right spot. Have you put a Trace() in there to make sure the event is firing when you switch windows?

Thanks,
ken
Michael Drechsel
Re: Focus Gain Main Window
July 13, 2008 07:38PM
Hi Ken,

yes of course.

But IMHO the event fired only when I switch between windev windows, not between outlook and windev.

greetings md

MerijnW
Re: Focus Gain Main Window
July 13, 2008 10:08PM
Micheal, play with the code provided below.
TimerSys(GetCurWinName,100)

PROCEDURE GetCurWinName()
iHWndCurr is int
iNameStr is int
iNameLen is int = 255
sWinName is string
iHWndCurr = API("USER32","GetForegroundWindow")
sWinName=Complete(sWinName,iNameLen)
FunctionResult is int = API("USER32","GetWindowTextA", iHWndCurr, sWinName, iNameLen)
IF FunctionResult > 0 THEN
	Trace(sWinName)
END

HTH,
Merijn
Michael Drechsel
Re: Focus Gain Main Window
July 14, 2008 04:03PM
Hi Merijn,

thx a lot. It Works.


greetings md
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: