Results 1 to 4 of 4

Thread: Clicking on Title Bar

  1. #1

    Thread Starter
    Lively Member James Bond 007's Avatar
    Join Date
    May 2000
    Location
    London
    Posts
    116
    I like to have a msgbox appear when the title bar get click.
    License to Program

    007

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    You have to subclass the form.
    Put this in a module:
    Code:
    Public oldp As Long
    Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    Public Const WM_NCLBUTTONDOWN = &HA1
    Public Const GWL_WNDPROC = (-4)
    Public Function WindowProc(ByVal hwnd As Long, ByVal uMsg As Long,ByVal wParam As Long, ByVal lParam As Long) As Long
    If uMsg = WM_NCLBUTTONDOWN Then
    MsgBox("text")
    End If
    WindowProc = CallWindowProc(oldp, hwnd, uMsg, wParam, lParam)
    End Function
    When A form loads:
    Code:
    oldp = SetWindowLong(Form1.hwnd, GWL_WNDPROC, AddressOf WindowProc)

    [Edited by Vlatko on 10-10-2000 at 07:37 PM]
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  3. #3
    Guest
    Joacim Andersson has a good example in this thread .

  4. #4

    Thread Starter
    Lively Member James Bond 007's Avatar
    Join Date
    May 2000
    Location
    London
    Posts
    116

    Thumbs up

    It works!!!! Vlatko

    Thanks Matthrew for the infor but Joacim's example just closed my vb application. I tried it 3 times.
    License to Program

    007

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