I have my main screen with a treeview control, and I've sub classed the control so I can get a context menu on a right click.
$define SUBCLASS2_ID 54322 ' any number
sub KeyContextMenu(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam,UINT_PTR uIdSubclass,DWORD_PTR dwRefData)
Select uMsg
case WM_RBUTTONDOWN
POINT cursor
GetCursorPos(cursor)
ScreenToClient(win.hwnd, cursor)
CONTEXTMENU win,cursor.x, cursor.y
MENUITEM "Add key",0,106
MENUITEM "Copy key",0,107
MENUITEM "Rename key",0,108
MENUITEM "Delete key",0,109
ENDMENU
Case WM_DESTROY
RemoveWindowSubclass(hWnd,&KeyContextMenu,SUBCLASS2_ID)
EndSelect
Return DefSubclassProc(hWnd,uMsg,wParam,lParam)
EndSub
Now when I select an option such as "Add", my program opens the AddKey screen - but as soon as I click on the Add screen I loose focus (of the Add screen and it becomes unresponsive).
The only way I can get my program to respond is to click on the main screen again.
The same happens if I choose any of the above options, and I know it's not the Add, Copy, Rename or delete functions as there are also buttons a user can press and these are working correctly.
Any ideas please?
If nobody gives you a solution, email me your code so I can compile it and I'll look at it. I can't work out in my shop until the 27th at the earliest.
Larry that's a nice offer considering what you've just gone through - I will bare that in mind - thanks.
In the mean time I've changed the line:
case WM_RBUTTONDOWN
to
case WM_RBUTTONUP
This stops my secondary screens from freezing BUT - you have to effectively do a double click on the right mouse button - so not there yet.
The problem was a missing RETURN command!
always something simple.