ページ 11

ボタンの右クリック処理方法は?

Posted: 2011年7月09日(土) 14:29
by ゲスト
CommandButtonで右クリック処理は可能なのでしょうか?
できるとしたら、どんな方法になるのでしょうか?
(Ver 4.24.00を使用)

Posted: 2011年7月10日(日) 17:57
by HSABP
サブクラスでかいけつ

Dim Button as HWND
Dim DefaultWndProc As DWord

'SubClass
Function SubClass(hWnd As HWND, dwMsg As DWord, wParam As WPARAM, lParam As LPARAM) As DWord
If dwMsg = WM_RBUTTONUP Then
MessageBox(hMainWnd, "右クリック", "test", MB_OK)
End If
SubClass=CallWindowProc(DefaultWndProc, hWnd,dwMsg,wParam,lParam)
End Function


Sub MainWnd_Create(ByRef CreateStruct As CREATESTRUCT)
Button = GetDlgItem(hMainWnd, CommandButton1)
DefaultWndProc=GetWindowLong(Button,GWL_WNDPROC)
SetWindowLong(Button,GWL_WNDPROC,AddressOf(SubClass))
End Sub

大変参考になりました

Posted: 2011年7月11日(月) 20:46
by たかせ
HSABP様大変参考になりました。
ありがとうございます。

Posted: 2011年7月23日(土) 13:29
by ゲスト
HSABPさん、右クリック処理 うまくできました。
ありがとうございます。