gcue Posted November 18, 2009 Posted November 18, 2009 (edited) after i combined them, the script works but it loads slower... any ideas? WM_NOTIFY (1) expandcollapse popupFunc WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam Local $tNMHDR, $hwndFrom, $code, $i_idNew, $idFrom, $i_idOld Local $tNMTBHOTITEM, $hMenu, $aRet, $iMenuID = -1 $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hwndFrom = DllStructGetData($tNMHDR, "hWndFrom") $idFrom = DllStructGetData($tNMHDR, "IDFrom") $code = DllStructGetData($tNMHDR, "Code") Switch $hwndFrom Case $hToolbar Switch $code Case $TBN_DROPDOWN $hMenu = _GUICtrlMenu_CreatePopup() $aRet = _GetToolbarButtonScreenPos($dGUI, $hToolbar, $iItem, 2) Switch $iItem Case $idCommon _GUICtrlMenu_AddMenuItem($hMenu, "Take Remote ScreenShot", $idRemoteScreenShot) _GUICtrlMenu_AddMenuItem($hMenu, "User History", $idUserHistory) Case $idHardware _GUICtrlMenu_AddMenuItem($hMenu, "Lookup Location", $idLookupLocation) _GUICtrlMenu_AddMenuItem($hMenu, "Drive Lock Exception Policy", $idDriveLockException) EndSwitch ; send button dropdown menu item commandID to dummy control for use in GuiGetMsg() or GUICtrlSetOnEvent() $iMenuID = _GUICtrlMenu_TrackPopupMenu($hMenu, $hToolbar, $aRet[0], $aRet[1], 1, 1, 2) If $iMenuID <> 0 Then GUICtrlSendToDummy($TbarMenu, $iMenuID) Return $TBDDRET_DEFAULT Case $NM_CLICK ; $NM_LDOWN Switch $iItem Case $idNetSupport, $idManage Switch _GUICtrlToolbar_IsButtonEnabled($hToolbar, $iItem) ; add check for button state if disabled Case True ; send toolbar commandID to dummy control for use in GuiGetMsg() or GUICtrlSetOnEvent() GUICtrlSendToDummy($Tbar, $iItem) EndSwitch EndSwitch Case $TBN_HOTITEMCHANGE $tNMTBHOTITEM = DllStructCreate($tagNMTBHOTITEM, $lParam) $i_idOld = DllStructGetData($tNMTBHOTITEM, "idOld") $i_idNew = DllStructGetData($tNMTBHOTITEM, "idNew") $iItem = $i_idNew Case $NM_CUSTOMDRAW ;set toolbar text colour Local $tNMTBCUSTOMDRAW = DllStructCreate($tagNMTBCUSTOMDRAW, $lParam) Local $iDrawStage = DllStructGetData($tNMTBCUSTOMDRAW, "DrawStage") If $iDrawStage = $CDDS_PREPAINT Then Return $CDRF_NOTIFYITEMDRAW If $iDrawStage <> $CDDS_ITEMPREPAINT Then Return $CDRF_DODEFAULT DllStructSetData($tNMTBCUSTOMDRAW, "clrText", $iToolbarTextColour) If @OSVersion = "WIN_VISTA" Then Return $TBCDRF_USECDCOLORS ;set text colour (Vista) Return $CDRF_DODEFAULT ; The control will draw itself EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY WM_NOTIFY (2) Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo ;~ Local $tBuffer $hWndListView = $nListView If Not IsHWnd($nListView) Then $hWndListView = GUICtrlGetHandle($nListView) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) Local $iIndex = DllStructGetData($tInfo, "Index") Local $sItemText = _GUICtrlListView_GetItemText($nListView, $iIndex) ;MsgBox(0x40, $iIndex, $sItemText) If $sItemText <> "" Then PCNotes_OpenItem() EndIf EndSwitch EndSwitch EndFunc ;==>WM_NOTIFY WM_NOTIFY (1+2) expandcollapse popupFunc WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam Local $tNMHDR, $hwndFrom, $code, $i_idNew, $idFrom, $i_idOld Local $tNMTBHOTITEM, $hMenu, $aRet, $iMenuID = -1 Local $hWndListView, $tInfo ;~ Local $tBuffer $hWndListView = $nListView If Not IsHWnd($nListView) Then $hWndListView = GUICtrlGetHandle($nListView) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hwndFrom = DllStructGetData($tNMHDR, "hWndFrom") $idFrom = DllStructGetData($tNMHDR, "IDFrom") $code = DllStructGetData($tNMHDR, "Code") Switch $hwndFrom Case $hToolbar Switch $code Case $TBN_DROPDOWN $hMenu = _GUICtrlMenu_CreatePopup() $aRet = _GetToolbarButtonScreenPos($dGUI, $hToolbar, $iItem, 2) Switch $iItem Case $idCommon _GUICtrlMenu_AddMenuItem($hMenu, "Take Remote ScreenShot", $idRemoteScreenShot) _GUICtrlMenu_AddMenuItem($hMenu, "User History", $idUserHistory) Case $idHardware _GUICtrlMenu_AddMenuItem($hMenu, "Lookup Location", $idLookupLocation) _GUICtrlMenu_AddMenuItem($hMenu, "Drive Lock Exception Policy", $idDriveLockException) EndSwitch ; send button dropdown menu item commandID to dummy control for use in GuiGetMsg() or GUICtrlSetOnEvent() $iMenuID = _GUICtrlMenu_TrackPopupMenu($hMenu, $hToolbar, $aRet[0], $aRet[1], 1, 1, 2) If $iMenuID <> 0 Then GUICtrlSendToDummy($TbarMenu, $iMenuID) Return $TBDDRET_DEFAULT Case $NM_CLICK ; $NM_LDOWN Switch $iItem Case $idNetSupport, $idManage Switch _GUICtrlToolbar_IsButtonEnabled($hToolbar, $iItem) ; add check for button state if disabled Case True ; send toolbar commandID to dummy control for use in GuiGetMsg() or GUICtrlSetOnEvent() GUICtrlSendToDummy($Tbar, $iItem) EndSwitch EndSwitch Case $TBN_HOTITEMCHANGE $tNMTBHOTITEM = DllStructCreate($tagNMTBHOTITEM, $lParam) $i_idOld = DllStructGetData($tNMTBHOTITEM, "idOld") $i_idNew = DllStructGetData($tNMTBHOTITEM, "idNew") $iItem = $i_idNew Case $NM_CUSTOMDRAW ;set toolbar text colour Local $tNMTBCUSTOMDRAW = DllStructCreate($tagNMTBCUSTOMDRAW, $lParam) Local $iDrawStage = DllStructGetData($tNMTBCUSTOMDRAW, "DrawStage") If $iDrawStage = $CDDS_PREPAINT Then Return $CDRF_NOTIFYITEMDRAW If $iDrawStage <> $CDDS_ITEMPREPAINT Then Return $CDRF_DODEFAULT DllStructSetData($tNMTBCUSTOMDRAW, "clrText", $iToolbarTextColour) If @OSVersion = "WIN_VISTA" Then Return $TBCDRF_USECDCOLORS ;set text colour (Vista) Return $CDRF_DODEFAULT ; The control will draw itself EndSwitch Case $hWndListView Switch $code Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam) Local $iIndex = DllStructGetData($tInfo, "Index") Local $sItemText = _GUICtrlListView_GetItemText($nListView, $iIndex) ;MsgBox(0x40, $iIndex, $sItemText) If $sItemText <> "" Then PCNotes_OpenItem() EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Edited November 18, 2009 by gcue
gcue Posted November 18, 2009 Author Posted November 18, 2009 nevermind it was something completely unrelated!!! doooh! many thanks =)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now