[Closed] Low level mouse hooк Action
I saw a thread for detecting low level mouse hook events:
But can you help me please to fire this low level mouse hook with C#?
Do you really need a global hook?
There was already a thread about detecting mouse events in max window. Check out my example. Maybe it is enough for your needs.
Yes, I need it. I don’t know, your version works well, but if I run it more times it crashes 3ds Max at me. May be I do smth wrong… Anyway I need not to listen mouse events, but to fire low level mouse hook.
windows.sendmessage certWindow WM_LBUTTONDOWN 0x0001 0
windows.sendmessage certWindow WM_LBUTTONUP 0x0001 0
windows.sendmessage certWindow WM_LBUTTONDBLCLK 0x0001 0
ThIs is not what I need, I need only low level, but I really don’t know how to do it in c#.
I will appreciate any help.
Serejah, Sorry I didnt explain which version kills max at me:
This, in fact is the only version that reads all mouse events in any window. This is what I need, the only thing is I want to fire left mouse button, I tried to do but still couldnt find a solution.
I want to select the node under the mouse inside Slate Material Editor, to get its coordinates.
DropingArea inside SME is not System.Windows.Forms
PostMessage works ok for me. But you also need to pass mouse click position and set SME in focus before you click;
fn makeparam w l = (
bit.or (bit.and w 0xFFFF) (bit.shift l 16)
)
mouseParam = makeparam mouse.pos.x mouse.pos.y -- guess it should be relative to sme window
windows.postMessage smeViewTabHwnd 0x201 0 mouseParam
windows.postMessage smeViewTabHwnd 0x202 0 mouseParam
fn GetSMEWindowHandle =
(
max_hwnd = windows.getMAXHWND()
for m in windows.getChildrenHWND 0 where m[4] == "NodeJoeMainWindow" and m[5] == "Slate Material Editor" and m[6] == max_hwnd do exit with m[1]
)
sme_hwnd = GetSMEWindowHandle()
for data in windows.getChildrenHWND sme_hwnd where data[4] == "DragDropWindow" do
(
format "%\n" data
)
#(133390P, 461030P, 461030P, “DragDropWindow”, “StatusBar”, 0P, 461030P, 461030P)
#(199100P, 461030P, 461030P, “DragDropWindow”, “”, 0P, 461030P, 461030P)
#(199034P, 199100P, 199100P, “DragDropWindow”, “View1”, 0P, 461030P, 461030P) – correct view handle
#(1247760P, 199100P, 199100P, “DragDropWindow”, “View2”, 0P, 461030P, 461030P) – correct view handle
#(199030P, 461030P, 461030P, “DragDropWindow”, “”, 0P, 461030P, 461030P)
#(199272P, 199030P, 199030P, “DragDropWindow”, “Material/Map Browser”, 461030P, 461030P, 461030P)
#(199032P, 461030P, 461030P, “DragDropWindow”, “”, 0P, 461030P, 461030P)
#(199270P, 199032P, 199032P, “DragDropWindow”, “Material Parameter Editor”, 461030P, 461030P, 461030P)
#(199576P, 199032P, 199032P, “DragDropWindow”, “Navigator”, 461030P, 461030P, 461030P)
#(199038P, 461030P, 461030P, “DragDropWindow”, “”, 0P, 461030P, 461030P)
#(199036P, 461030P, 461030P, “DragDropWindow”, “”, 0P, 461030P, 461030P)