Focus...

BLeslie88

B Leslie
Local time
Today, 16:32
Joined
May 9, 2002
Messages
228
Ok, problem at hand. My boss wants my application to come to the front after the reception enters info pertaining to an order.

Interaction.AppActivate "frmMainOrders"

This sets focus and causes the application to flash on the bottom of the screen. But does not move this application to the front on the screen...

Any ideas on how to alert users that they have something to look at?

Any ideas at this time is welcomed...

Thanks,
 
Thought I may have it... but alas no...

I tried a msgbox after set focus to the frmOrders... but it still remained in the background just flashing me..

My biggest concern with it just flashing, is that a user not be at their pc when it does... and my boss wants it at the fore front...
 
Brian:

Why don't you set the Form.Modal = True ?

SHADOW
 
well

I tried modal = true .

does less then app funtion I been tinkering with.

What I want to happen here... Is my application will be running in the background... while they are working in excel / AP program / outlook ...

I want my application to come to the front on the window on their PC.

Thanks...

Brian :confused:
 
For some reason I didn't realize that Access was running minimized.

Sorry.

SHADOW
 
np

Thanks for replying, I may not have explained myself well, and you allowed for me to point out exactly what I need if possible.

I have found a way to call a vb .exe as a message to tell them they have a new order, from the access db when they get new orders... lol

But I was hoping for a simpler solution...

Without sending an e-mail... Because access is open in the back, lord knows there got to be a way to bring that baby to the front...
 
I haven't done this so I'm guessing. I would look for a Windows API that you can call from Access that will make Access the active application.
 
Thanks Pat

I found this in another thread this morning.

I.e. If you are also running, say, WinZip at the moment, Access can't see that without calling a module from the Win32 API library. The good news is, Access can call functions from the API .DLL files. So if you do make such a call, you could find the window handle (usually designated as hWnd) of the window having current focus.

I presume this is what you are referncing in your reply to some extent.

While your point is well taken, I do not know where to look for such code or examples to help me find a solution. The help files in access and searches on this forum have not led me in the right direction. So I would need to find a good place to search on this.

but alas since time is always of the essence with our bosses, I will likely end up calling a vb exe pop up to tell em an order is there.
 
Thanks Pat.

This is what I found in the associated help file that may be able to help me...

"The GetActiveWindow function retrieves the window handle to the active window associated with the thread that calls the function.

HWND GetActiveWindow(VOID)


Parameters

This function has no parameters.

Return Values

If the function succeeds, the return value is the handle to the active window associated with the thread that calls the function. If the calling thread does not have an active window, the return value is NULL."

but...

HWND GetActiveWindow(VOID)

return sub or function not defined...
 
Boy this is tiring....

Declare Function SetActiveWindow Lib "user32" () As Long
Declare Function BringWindowToTop Lib "user32.dll" (ByVal hwnd As Long) As Long
Declare Function SetForegroundWindow Lib "user32.dll" (ByVal hwnd As Long) As Long


all are functions I use to try and bring my application to the front...

Dim intWindowHandle As Long
Interaction.AppActivate "frmOrders"
intWindowHandle = Screen.ActiveForm.hwnd
BringWindowToTop intWindowHandle
SetForegroundWindow intWindowHandle

I even try as seen above min and max thinking stupid windows will register I want the thing at the front!!! lol

Anyhow this does make my application flash... and get this 10% of the time, it will come to the front... 10% is quite good enough for my boss though... So I will dig more... Try to be more forcefull with MY window!!! That I want in front! :cool:
 
Ok odd....

It always works the first time... but not after.... after changing windows for a second time, it only flashes....

Weird or what.? Damn microsoft! j/k'n

:eek:
 
Ok so.

Well, here is the problem I gather...

After I pull access to the front, I think I mess up the arrangement of windows, I did read a theory on it...

What it seems I need to do... Is assign the value at the time while its in the back. Then after I pull it to the front, re-assign it the same value.

Then my code should work every time, without minimizing and maximizing it....

Althought with this runnign in the back, on the timer calling, it does pop up to the front every once in a while....

Very odd and frustrating. I think I have learned enough about windows though to seriously mess with an active desktop with applications running...
 
BLeslie88 said:
I think I have learned enough about windows though to seriously mess with an active desktop with applications running...

And at the end of the day, thats what counts. Those, and well, backdoors. ;)
 

Users who are viewing this thread

Back
Top Bottom