CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2001
    Location
    charlotte,nc
    Posts
    84

    vbminimized but stops processing

    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

    Elizabeth

  2. #2
    Join Date
    Mar 2001
    Location
    charlotte,nc
    Posts
    84

    Re: Found problem, thank you anyway

    tx

    Elizabeth

  3. #3
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: vbminimized but stops processing

    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.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  4. #4
    Join Date
    Mar 2001
    Location
    charlotte,nc
    Posts
    84

    Re: vbminimized but stops processing

    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

    Elizabeth

  5. #5
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: vbminimized but stops processing

    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.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  6. #6
    Join Date
    Dec 1999
    Location
    Dublin, Ireland
    Posts
    1,173

    Re: vbminimized but stops processing

    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
    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

  7. #7
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: vbminimized but stops processing

    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.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured