|
-
Aug 24th, 2000, 12:01 PM
#1
Code:
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Const GWL_WNDPROC = (-4)
Public Const WM_NCLBUTTONDOWN = &HA1
Public Const WM_NCLBUTTONUP = &HA2
Public Const HTMAXBUTTON = 9
Public OldWndProc As Long
Public TheText As String
Public Function WindProc(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
If wMsg = WM_NCLBUTTONDOWN Then
If wParam = HTMAXBUTTON Then
TheText = "hello"
End If
End If
WindProc = CallWindowProc(OldWndProc, hwnd, wMsg, wParam, lParam)
End Function
Public Sub Hook(hwnd As Long)
OldWndProc = SetWindowLong(hwnd, GWL_WNDPROC, AddressOf WindProc)
End Sub
Public Sub UnHook(hwnd As Long)
SetWindowLong hwnd, GWL_WNDPROC, OldWndProc
OldWndProc = 0
End Sub
<mindless rambling>
damnit! I hate it when that happens I typed out the whole message, then hit the escape key(it deletes everything in a textbox) 
</>
I just recently found out about the wonderful world of subclassing, I modeled this example from Megatrons code to minimize the window to the systray instead of to the taskbar. (my code works BTW, so that isnt what the question is about)
what else can I have for wParam?
I have HTMAXBUTTON, but I know that cant be all you can have...
I would really appreciate some help 
Thanks,
Dennis.
-
Aug 24th, 2000, 12:22 PM
#2
Fanatic Member
Where can I start?
Code:
Public Const HTBORDER = 18
Public Const HTBOTTOM = 15
Public Const HTBOTTOMLEFT = 16
Public Const HTBOTTOMRIGHT = 17
Public Const HTCAPTION = 2
Public Const HTCLIENT = 1
Public Const HTCLOSE = 20
Public Const HTERROR = (-2)
Public Const HTGROWBOX = 4
Public Const HTHELP = 21
Public Const HTHSCROLL = 6
Public Const HTLEFT = 10
Public Const HTMAXBUTTON = 9
Public Const HTMENU = 5
Public Const HTMINBUTTON = 8
Public Const HTNOWHERE = 0
Public Const HTOBJECT = 19
Public Const HTREDUCE = HTMINBUTTON
Public Const HTRIGHT = 11
Public Const HTSIZE = HTGROWBOX
Public Const HTSIZEFIRST = HTLEFT
Public Const HTSYSMENU = 3
Public Const HTTOP = 12
Public Const HTTOPLEFT = 13
Public Const HTTOPRIGHT = 14
Public Const HTTRANSPARENT = (-1)
Public Const HTVSCROLL = 7
Public Const HTZOOM = HTMAXBUTTON
-
Aug 24th, 2000, 12:36 PM
#3
thanks!
so is it anything with HT in fornt of it?
or are there more, without HT?
-
Aug 24th, 2000, 12:43 PM
#4
Fanatic Member
I think they all start with HT, becaue these values are supposed to be used with the WM_NCHitTest message. HT for Hit Test, geddit .
I think they're all.
-
Aug 24th, 2000, 02:32 PM
#5
Usually messages are grouped together with a prefix hence I don't think there are any Non-HT constants.
Likewise, SC = System Command, WM = Window Message, LB = ListBox, CB = ComboBox etc.
-
Aug 24th, 2000, 04:29 PM
#6
thanks to all of you!!
subclassing sure does add more functionality than Vb offers, but I thought it did more than this.
so the wMsg can be anything with WM prefix??
-
Aug 24th, 2000, 04:58 PM
#7
Yes, it can be any message.
Notice the declaration of SendMessage.
Code:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
We have those exact same parameters in our callback function.
Code:
Function WindowProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
In relation to SendMessage, you can almost call this an "InterceptMessage" function.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|