Results 1 to 3 of 3

Thread: Situation Du Jour....

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2000
    Posts
    67
    Hey all!
    Question: I would like to see if there is some kind of code that can be put into a form that will make that form "unhidable". For example, if you've ever seen or used a free internet serivice like netzero, you'll see that their banner forms are always seen. Nothing can get in front of them. Thanks in advance for all ideas!
    John

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    you can put your form always on top (stays on top of the other forms) but if someone presses the ctrl/tab the form retires to the task bar so it isn't on top anymore.
    Code:
    'put this in a bas module
    '
    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
    
    Global Const SWP_NOMOVE = 2
    Global Const SWP_NOSIZE = 1
    Global Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
    Global Const HWND_TOPMOST = -1
    Global Const HWND_NOTOPMOST = -2
    
    '=============================================
    '
    'put this in events click or load or whatever
    'or hardcopy
    'To set Form1 as a TopMost form, do the following:
    
    res& = SetWindowPos (Form1.hWnd, HWND_TOPMOST, _
    0, 0, 0, 0, FLAGS) 
    'if res&=0, there is an error
    
    'To turn off topmost (make the form act normal again):
    
    res& = SetWindowPos (Form1.hWnd, HWND_NOTOPMOST, _
    0, 0, 0, 0, FLAGS)
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3
    Guest
    I prefer to use constants when the number is unrecognizable. If it's fairly short, you do not have to declare them as it can shorten you code by a long shot.

    Code:
    Private 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
    
    Private Sub Command1_Click()
        SetWindowPos Form1.hwnd, -1, 0, 0, 0, 0, 3
    End Sub

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