Click to See Complete Forum and Search --> : vbminimized but stops processing
EAK
March 26th, 2001, 03:05 PM
I have a vb6 program which looks for a file (generated by another application) every so often. The file contains a command which tells my program to minimize itself. My program does this. Unfortunately, my program does not appear to continue processing information once it loses focus and becomes minimized.
The other application creates a file for my application to process. My application does not process the file until I click on it (in the taskbar), at which time it begins processing the file.
The other application is sending a command in the file telling my application to take focus and go to the vbnormal state.
Can anyone tell me what is going on once the state of my app is minimized and perhaps how to work around this problem???
THANK YOU!!
EAK
EAK
March 26th, 2001, 04:00 PM
tx
Cimperiali
March 28th, 2001, 04:21 AM
This is only a guess, as I do not tried the following.
You say you read in your program a line from a file to minimize your vb program. You should (if you have not tried yet) add a TIMER in your program and activate it while minimizing. Every now and then (say about 1 second) you should look for the file generated in timer event. when you find the file, you should stop the timer, and do what you need.
Hope this help
Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.
EAK
March 28th, 2001, 07:46 AM
Cimperiali,
Thank you about the timer! Indeed, I have code that does just that and it is effective.
It turned out to be a different problem. My application did not have focus and it had put up a msgbox behind the application that did have focus. If you know how to force a msgbox to be always on top, i would appreciate that piece of info!
Two of us are trying to "integrate" two applications. We are trying to fine tune the "focus" issues (with some challenges) :)
E
Cimperiali
March 29th, 2001, 02:55 AM
I had written code to take always on top a form, but I cannot find it right now. While searching, I suggest you to post a new question here for this matter. I am sure more than one can answer and post an example code.
Best regards, Cesare Imperiali
Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.
Clearcode
March 29th, 2001, 03:28 AM
In Win32 (i.e. NT4 and Windows 95 or higher) a messagebox only goes on top of it's application windows.
The standard way of allerting the user that a messagebox is up is to call FlashWindow:
Declare Function FlashWindow Lib "user32" Alias "FlashWindow" (byval hwnd as Long, byval bInvert as Long) as Long
repeatedly on a timer and then only bring the messagebox up when the form that spawns it gets the focus.
Hope this helps,
Duncan
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
Cimperiali
March 29th, 2001, 06:06 AM
here is the code to put a form on top. But I am afraid Clearcode is right: it should not work with messagebox...
there is some code for a standard Bas module and code you can put where you like in a form. Hope this may help you.
'module bas code:
Public Declare Function SetWindowPos Lib "USER32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Public Function SetUnsetFormOnTop(Me_hWnd As Long, HWND_TOPMOST As Long, Me_Left As Long, Me_Top As Long, Me_Width As Long, Me_Height As Long, me_FLAGS As Long) As Long
'Const HWND_TOPMOST = -1
'Const HWND_NOTOPMOST = -2
'Const HWND_TOP = 0
'Const HWND_TOPMOST = -1
'flag
'Const SWP_SHOWWINDOW = &H40
Const FLAGS = 1
'Sets form on always on top.
me_FLAGS = FLAGS
SetUnsetFormOnTop = SetWindowPos(Me_hWnd, HWND_TOPMOST, Me_Left, Me_Top, Me_Width, Me_Height, me_FLAGS)
' Change the "0's" above to position the window.
End Function
'----------------
'form code:
private sub putMeOnTop
Dim Me_Width As Long, Me_Height As Long
Me.ScaleMode = 3
Me_Width = Me.Width
Me_Height = Me.Height
Me.ScaleMode = 1
'choose -2 to untop a form, -1 to put it on top
success = SetUnsetFormOnTop(Me.hwnd, -2, Me.Left / Screen.TwipsPerPixelX, Me.Top / Screen.TwipsPerPixelY, Me_Width, Me_Height, 1)
End Sub
Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.