为什么不仔细查看帮助呢?
Global Const $tagNMHDR = "struct; hwnd hWndFrom;uint_ptr IDFrom;INT Code; endstruct"
Global Const $tagNMTOOLBAR = $tagNMHDR & ";int iItem;" & _
"struct; int iBitmap;int idCommand;byte fsState;byte fsStyle;dword_ptr dwData;int_ptr iString; endstruct" & _
";int cchText;ptr pszText;" & $tagRECT
下面二种都可以
Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) Local $hWndFrom, $iCode, $tNMTOOLBAR, $iItem, $IDFrom $tNMTOOLBAR = DllStructCreate($tagNMTOOLBAR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMTOOLBAR, "hWndFrom")) $IDFrom = (DllStructGetData($tNMTOOLBAR, "IDFrom") $iCode = DllStructGetData($tNMTOOLBAR, "Code") $iItem = DllStructGetData($tNMTOOLBAR, "iItem") Switch $hWndFrom Case $mainToolBar Switch $iCode Case $NM_LDOWN Switch $iItem Case $ToolBar_new $MSG_NOTIFY = "newuser" Case $ToolBar_del $MSG_NOTIFY = "deluser" EndSwitch EndSwitch EndSwitch Switch $IDFrom ;選擇產生事件的控制項 Case $ListView Switch $iCode ; 選擇產生的事件 Case $NM_CLICK ; 左擊 Case $NM_DBLCLK ; 雙擊 Case $NM_RCLICK ; 右擊 EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY
Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) Local $hWndFrom, $iCode, $tNMTOOLBAR, $iItem, $IDFrom Local $hListView = GUICtrlGetHandle($ListView) $tNMTOOLBAR = DllStructCreate($tagNMTOOLBAR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMTOOLBAR, "hWndFrom")) $IDFrom = (DllStructGetData($tNMTOOLBAR, "IDFrom") $iCode = DllStructGetData($tNMTOOLBAR, "Code") $iItem = DllStructGetData($tNMTOOLBAR, "iItem") Switch $hWndFrom Case $mainToolBar Switch $iCode Case $NM_LDOWN Switch $iItem Case $ToolBar_new $MSG_NOTIFY = "newuser" Case $ToolBar_del $MSG_NOTIFY = "deluser" EndSwitch EndSwitch Case $hListView Switch $iCode ; 選擇產生的事件 Case $NM_CLICK ; 左擊 Case $NM_DBLCLK ; 雙擊 Case $NM_RCLICK ; 右擊 EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY
|