Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi

How Can i subclass windows Message using API in Vba then Load Cursor Hand in Ok Button

i do not know why Access hang and i have to exit from app only via task manager

What I have tried:

Public hHook As Long Ptr

In Timer Event Access Wrote a procedure

In form in ok button wrote Msgbox "Hello"

When push the button in timer Get Handle Of Message Window

hHook=SetWindowLongPtr .....

WindowHook.......

if Msg=Active then
OkHandle=FindWindowEx(hwnd,0,,"OK")
LoadCursor ??????

WindowHook=False
Call WindowProc ......
Posted
Comments
CHill60 31-Dec-21 9:08am    
I can't make head nor tail of what you have written here. Try to explain your problem clearly - including the actual code you have used. Other comments
- This won't compile it should be
Public hHook As LongPtr
.
- Timers do not have a button and you would need to tell us which Timer you are using
- What does "Load Cursor Hand in Ok Button" mean?
[no name] 31-Dec-21 15:50pm    
Hiin standard module declared public hHook As LongPtr

Form Click Event : (Access Object )
Msgbox "Hi"

Form Timer Event ( Access Object )
hwnd=FindWindow("#32770,vbNullstring)
hhook=SetWindowLongPtrA(hwnd,AddressOf HookProc,oldWndProc)

But Hang System and i have to use Task Manager to End Process

Public Function HookProc (Byval hwnd As LongPtr,Byval msg As Long,ByVal wParam As LongPtr,ByVal lParam As LongPtr) As LongPtr
Select Case WM_LBUTTONDWON
SetWindowText wparam,"Clicked!!!"
HookProc=CallWindowProc(oldWndProc,hwnd,msg,wparam,lparam)
Case WM_SETCURSOR
....???
CallWindowProc ....
Case Else
HookProc=CallWindowProc(oldWndProc,hwnd,msg,wparam,lparam)
End if
End Select

i think we use EnumChildWindows to enumurate Childs then when get the handle to ok button change Cursor??? possible?!!!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900