Results 1 to 4 of 4

Thread: Form 'Flash' after msgbox

  1. #1

    Thread Starter
    Member VbAndersonic's Avatar
    Join Date
    Aug 2001
    Location
    Derby, UK
    Posts
    58

    Form 'Flash' after msgbox

    Help!

    Has anyone ever found that sometimes after a messagebox is called, the Form that called the box flashes as it is refreshed? This is causing some problems in my POS system, as if there is another open program, then its window will be set to topmost instead of my app's. Does anyone know how to get around this? At the moment I use Me.SetFocus after the MsgBox command to make my app topmost, but this still makes the form flash and another window take its place as topmost.

    Any suggestions? Thanks

    VbAndersonIC

  2. #2
    Lively Member d4v3's Avatar
    Join Date
    Nov 2001
    Location
    Leicester, UK
    Posts
    82
    not too sure what your getting at but theres some code that keeps your window on top, always!

    Let me go dig it out!

    In form_load:

    SetWindowPos Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE

    In declarations:

    Declare Sub 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)

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Have you considered displaying your message in a status bar rather than a message box?

  4. #4

    Thread Starter
    Member VbAndersonic's Avatar
    Join Date
    Aug 2001
    Location
    Derby, UK
    Posts
    58
    Thanks for the replies. I have already considered using the SetWindowPos API to keep my form on top, but this code will also prevent the user from seeing the msgbox, so I would have to set it to HWND_NOTOPMOST, call the msgbox, then reset it back to HWND_TOPMOST each time. I will try this, see if its any good

    Yeah, I could use a status bar or custom form, I was thinking about that too. That may be the answer if the above doesnt work.

    Thanks very much guys! Much appreciated

    VbAndersonIC

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