how to disable mouse click in many location area (help plzz)

Just starting out? Need help? Post your questions and find answers here.
Nueng
User
User
Posts: 35
Joined: Fri May 27, 2005 11:16 am

how to disable mouse click in many location area (help plzz)

Post by Nueng »

I want to make program for control game
because user can click in option menu, high score, exit and many many ect

If I protect mouse click may be this project will be success

can you introduce me about mouse hook

thank you... (^^)
\\ (^O^) //

Thank god for send you to Help me..
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Post by rsts »

releaseMouse won't do it for you?

did you try a search?

cheers,
Nueng
User
User
Posts: 35
Joined: Fri May 27, 2005 11:16 am

Post by Nueng »

in the game mouse still use..
but can't click in some button sush as option, exit game

...

I found mouse hook source code

Code: Select all

Global hhook
Procedure MouseProc(nCode, wParam, lParam)
  *ms.MOUSEHOOKSTRUCT = lParam
  SetGadgetText(0, "x: "+Str(*ms\pt\x))
  SetGadgetText(1, "y: "+Str(*ms\pt\y))
  If wParam = #WM_LBUTTONUP ; 205h
    If *ms\pt\x >= 190 And *ms\pt\x <= 373 And *ms\pt\y >= 432 And *ms\pt\y <= 470
      result = 1 
      ;MessageRequester("Message", "Right button up hooked", 0)
    EndIf
  Else
    result = 0
  EndIf
  ProcedureReturn result
EndProcedure

hInstance = GetModuleHandle_(0)
If OpenWindow(0, 0, 0, 300, 200, #PB_Window_SystemMenu, "Mouse hook example")
  WindowID = WindowID()
  If CreateGadgetList(WindowID)
    TextGadget(0, 4, 4, 48, 24, "x: ")
    TextGadget(1, 4, 32, 48, 24, "y: ")
  EndIf
  lpdwProcessId = GetWindowThreadProcessId_(WindowID, 0)
  hhook = SetWindowsHookEx_(#WH_MOUSE, @MouseProc(), hInstance, lpdwProcessId)
  Repeat
    EventID = WaitWindowEvent()
  Until EventID = #PB_EventCloseWindow
EndIf
UnhookWindowsHookEx_(hhook)
End
but it's not global... can you introduce me how to write mouse hook with global or all program
\\ (^O^) //

Thank god for send you to Help me..
Post Reply