Jump to content

rasim

Active Members
  • Posts

    1,673
  • Joined

  • Last visited

  • Days Won

    1

rasim last won the day on August 22 2012

rasim had the most liked content!

1 Follower

About rasim

  • Birthday 10/08/1978

Profile Information

  • Member Title
    Gray Scripter
  • Location
    Tashkent - Uzbekistan
  • WWW
    http://www.new-page.info

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

rasim's Achievements

Universalist

Universalist (7/7)

31

Reputation

  1. @KaFu Your first example contain error, you not indicate a working directory @mikelee33 Meaning: Command1 && Command2; Run second command if first command executed successfully Command1 || Command2; Run second command if first command executed unsuccessfully
  2. @waltzie Hello! Use the _GUICtrlTreeView_SetSelectedImageIndex function. Example: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiTreeView.au3> Global $hItem = 0, $hTreeView_Parent = 0 $gui = GUICreate("Tree example", 400, 400) $maintree = GUICtrlCreateTreeView(10, 10, 150, 200) $hImage = _GUIImageList_Create(16, 16, 5, 3) _GUIImageList_AddIcon($hImage, "shell32.dll", 165) _GUIImageList_AddIcon($hImage, "shell32.dll", 137) _GUIImageList_AddIcon($hImage, "shell32.dll", 131) _GUICtrlTreeView_SetNormalImageList($maintree, $hImage) $aboutitem = GUICtrlCreateTreeViewItem("Parent", $maintree) For $i = 1 To 2 GUICtrlCreateTreeViewItem("Child " & $i, $aboutitem) Next $hParent2 = GUICtrlCreateTreeViewItem("Parent2", $maintree) For $i = 1 To 3 GUICtrlCreateTreeViewItem("Child " & $i, $hParent2) Next $cDummyMenu = GUICtrlCreateDummy() $aboutitemMenu = GUICtrlCreateContextMenu($cDummyMenu) $hMenu = GUICtrlGetHandle($aboutitemMenu) $aboutitemMenu_add = GUICtrlCreateMenuItem("Add Item", $aboutitemMenu) ;--------------------------------------------- $cDummyMenu2 = GUICtrlCreateDummy() $aboutitemMenu2 = GUICtrlCreateContextMenu($cDummyMenu2) $hMenu2 = GUICtrlGetHandle($aboutitemMenu2) $aboutitemMenu_remove = GUICtrlCreateMenuItem("Remove Item", $aboutitemMenu2) $aboutitemMenu_play = GUICtrlCreateMenuItem("Play Item", $aboutitemMenu2) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $cDummyMenu _TrackPopupMenu($hMenu, 0, MouseGetPos(0), MouseGetPos(1), $gui) Case $msg = $cDummyMenu2 _TrackPopupMenu($hMenu2, 0, MouseGetPos(0), MouseGetPos(1), $gui) Case $msg = $aboutitemMenu_add If GUICtrlRead($aboutitemMenu_add, 1) = "Add Item" Then _GUICtrlTreeView_InsertItem($maintree, "New Item", $hTreeView_Parent, 0, 2, 2) Else ;more menues on dummy EndIf Case $msg = $aboutitemMenu_remove If GUICtrlRead($aboutitemMenu_remove, 1) = "Remove Item" Then _GUICtrlTreeView_Delete($maintree, $hItem) Else ;more menues on dummy2 EndIf Case $msg = $aboutitemMenu_play If GUICtrlRead($aboutitemMenu_play, 1) = "Play Item" Then GUICtrlSetData($aboutitemMenu_play, "Stop Item") _GUICtrlTreeView_BeginUpdate($maintree) _GUICtrlTreeView_SetImageIndex($maintree, $hItem, 1) _GUICtrlTreeView_SetSelectedImageIndex($maintree, $hItem, 1) _GUICtrlTreeView_EndUpdate($maintree) Else GUICtrlSetData($aboutitemMenu_play, "Play Item") _GUICtrlTreeView_BeginUpdate($maintree) _GUICtrlTreeView_SetImageIndex($maintree, $hItem, 2) _GUICtrlTreeView_SetSelectedImageIndex($maintree, $hItem, 2) _GUICtrlTreeView_EndUpdate($maintree) EndIf EndSelect WEnd Func WM_NOTIFY($hWnd, $msg, $wParam, $lParam) Local $hWndTreeView, $tNMHDR, $hWndFrom, $iCode $hWndTreeView = $maintree If Not IsHWnd($hWndTreeView) Then $hWndTreeView = GUICtrlGetHandle($hWndTreeView) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndTreeView Switch $iCode Case $NM_RCLICK Local $tPOINT = DllStructCreate("int X;int Y") DllStructSetData($tPOINT, "X", MouseGetPos(0)) DllStructSetData($tPOINT, "Y", MouseGetPos(1)) _ScreenToClient($hWndTreeView, DllStructGetPtr($tPOINT)) Local $iX = DllStructGetData($tPOINT, 1) Local $iY = DllStructGetData($tPOINT, 2) Local $tTVHITTESTINFO = _GUICtrlTreeView_HitTestEx($hWndTreeView, $iX, $iY) Local $iFlags = DllStructGetData($tTVHITTESTINFO, "Flags") If BitAND($iFlags, $TVHT_ONITEM) Or BitAND($iFlags, $TVHT_ONITEMLABEL) Then $hItem = DllStructGetData($tTVHITTESTINFO, "Item") _GUICtrlTreeView_SelectItem($hWndTreeView, $hItem, $TVGN_CARET) If _GUICtrlTreeView_GetParentHandle($hWndTreeView, $hItem) = 0 Then $hTreeView_Parent = $hItem GUICtrlSendToDummy($cDummyMenu) ;give control to root entity menu Else ;give control to item menu GUICtrlSendToDummy($cDummyMenu2) EndIf EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func _ScreenToClient($hWnd, $pPoint) Local $aRet = DllCall("user32.dll", "int", "ScreenToClient", _ "hwnd", $hWnd, _ "ptr", $pPoint) Return $aRet[0] EndFunc ;==>_ScreenToClient Func _TrackPopupMenu($hMenu, $iFlags, $iX, $iY, $hWnd) Local $aRet = DllCall("User32.dll", "int", "TrackPopupMenu", _ "hwnd", $hMenu, _ "int", $iFlags, _ "int", $iX, _ "int", $iY, _ "int", 0, _ "hwnd", $hWnd, _ "hwnd", 0) Return $aRet[0] EndFunc ;==>_TrackPopupMenu
  3. I think this not it is necessary, because mistakes are corrected only. Damn! I'm very unattentive. Thank you! Fixed
  4. Below code also not work for you? RunWait(@ComSpec & " /k dir /b c: && Echo. && Echo finished")
  5. Try this: RunWait(@ComSpec & ' /k ' & $prog & ' ' & $option & ' ' & GUICtrlRead($file) & ' & & echo Finished!')
  6. Try this: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiTreeView.au3> Global $hItem = 0, $hTreeView_Parent = 0 $gui = GUICreate("Tree example", 400, 400) $maintree = GUICtrlCreateTreeView(10, 10, 150, 200) $aboutitem = GUICtrlCreateTreeViewItem("Parent", $maintree) For $i = 1 To 10 GUICtrlCreateTreeViewItem("Child " & $i, $aboutitem) Next $hParent2 = GUICtrlCreateTreeViewItem("Parent2", $maintree) For $i = 1 To 10 GUICtrlCreateTreeViewItem("Child " & $i, $hParent2) Next $cDummyMenu = GUICtrlCreateDummy() $aboutitemMenu = GUICtrlCreateContextMenu($cDummyMenu) $hMenu = GUICtrlGetHandle($aboutitemMenu) $aboutitemMenu_add = GUICtrlCreateMenuItem("Add Item", $aboutitemMenu) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $cDummyMenu _TrackPopupMenu($hMenu, 0, MouseGetPos(0), MouseGetPos(1), $gui) Case $msg = $aboutitemMenu_add If GUICtrlRead($aboutitemMenu_add, 1) = "Add Item" Then _GUICtrlTreeView_InsertItem($maintree, "New Item", $hTreeView_Parent) Else _GUICtrlTreeView_Delete($maintree, $hItem) EndIf EndSelect WEnd Func WM_NOTIFY($hWnd, $msg, $wParam, $lParam) Local $hWndTreeView, $tNMHDR, $hWndFrom, $iCode $hWndTreeView = $maintree If Not IsHWnd($hWndTreeView) Then $hWndTreeView = GUICtrlGetHandle($hWndTreeView) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndTreeView Switch $iCode Case $NM_RCLICK Local $tPOINT = DllStructCreate("int X;int Y") DllStructSetData($tPOINT, "X", MouseGetPos(0)) DllStructSetData($tPOINT, "Y", MouseGetPos(1)) _ScreenToClient($hWndTreeView, DllStructGetPtr($tPOINT)) Local $iX = DllStructGetData($tPOINT, 1) Local $iY = DllStructGetData($tPOINT, 2) Local $tTVHITTESTINFO = _GUICtrlTreeView_HitTestEx($hWndTreeView, $iX, $iY) Local $iFlags = DllStructGetData($tTVHITTESTINFO, "Flags") If BitAND($iFlags, $TVHT_ONITEM) Or BitAND($iFlags, $TVHT_ONITEMLABEL) Then $hItem = DllStructGetData($tTVHITTESTINFO, "Item") _GUICtrlTreeView_SelectItem($hWndTreeView, $hItem, $TVGN_CARET) If _GUICtrlTreeView_GetParentHandle($hWndTreeView, $hItem) = 0 Then $hTreeView_Parent = $hItem GUICtrlSetData($aboutitemMenu_add, "Add Item") Else GUICtrlSetData($aboutitemMenu_add, "Delete Item") EndIf GUICtrlSendToDummy($cDummyMenu) EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func _ScreenToClient($hWnd, $pPoint) Local $aRet = DllCall("user32.dll", "int", "ScreenToClient", _ "hwnd", $hWnd, _ "ptr", $pPoint) Return $aRet[0] EndFunc ;==>_ScreenToClient Func _TrackPopupMenu($hMenu, $iFlags, $iX, $iY, $hWnd) Local $aRet = DllCall("User32.dll", "int", "TrackPopupMenu", _ "hwnd", $hMenu, _ "int", $iFlags, _ "int", $iX, _ "int", $iY, _ "int", 0, _ "hwnd", $hWnd, _ "hwnd", 0) Return $aRet[0] EndFunc ;==>_TrackPopupMenu
  7. Hmm... try to run the _ScreenCapture_Capture function without a cursor capturing: _ScreenCapture_Capture(@MyDocumentsDir & "\GDIPlus_Image1.jpg", 0, 0, -1, -1, False)
  8. wraithdu Great and useful! 5 stars!
  9. eXoRt I don't think, that this is a critical error, just declare variables. Anyway thanks for this information. I will fix this later Edit: Fixed, updated first post.
  10. @waltzie Quick example: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiTreeView.au3> Global $hItem = 0 $gui = GUICreate("Tree example", 400, 400) $maintree = GUICtrlCreateTreeView(10, 10, 150, 200) $aboutitem = GUICtrlCreateTreeViewItem("Parent", $maintree) For $i = 1 To 10 GUICtrlCreateTreeViewItem("Child " & $i, $aboutitem) Next $cDummyMenu = GUICtrlCreateDummy() $aboutitemMenu = GUICtrlCreateContextMenu($cDummyMenu) $hMenu = GUICtrlGetHandle($aboutitemMenu) $aboutitemMenu_add = GUICtrlCreateMenuItem("Add Item", $aboutitemMenu) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $cDummyMenu _TrackPopupMenu($hMenu, 0, MouseGetPos(0), MouseGetPos(1), $gui) Case $msg = $aboutitemMenu_add If GUICtrlRead($aboutitemMenu_add, 1) = "Add Item" Then GUICtrlCreateTreeViewItem("New Item", $aboutitem) Else _GUICtrlTreeView_Delete($maintree, $hItem) EndIf EndSelect WEnd Func WM_NOTIFY($hWnd, $msg, $wParam, $lParam) Local $hWndTreeView, $tNMHDR, $hWndFrom, $iCode $hWndTreeView = $maintree If Not IsHWnd($hWndTreeView) Then $hWndTreeView = GUICtrlGetHandle($hWndTreeView) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndTreeView Switch $iCode Case $NM_RCLICK Local $tPOINT = DllStructCreate("int X;int Y") DllStructSetData($tPOINT, "X", MouseGetPos(0)) DllStructSetData($tPOINT, "Y", MouseGetPos(1)) _ScreenToClient($hWndTreeView, DllStructGetPtr($tPOINT)) Local $iX = DllStructGetData($tPOINT, 1) Local $iY = DllStructGetData($tPOINT, 2) Local $tTVHITTESTINFO = _GUICtrlTreeView_HitTestEx($hWndTreeView, $iX, $iY) Local $iFlags = DllStructGetData($tTVHITTESTINFO, "Flags") If BitAND($iFlags, $TVHT_ONITEM) Or BitAND($iFlags, $TVHT_ONITEMLABEL) Then $hItem = DllStructGetData($tTVHITTESTINFO, "Item") _GUICtrlTreeView_SelectItem($hWndTreeView, $hItem, $TVGN_CARET) GUICtrlSetData($aboutitemMenu_add, "Delete Item") Else $hItem = 0 GUICtrlSetData($aboutitemMenu_add, "Add Item") EndIf GUICtrlSendToDummy($cDummyMenu) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func _ScreenToClient($hWnd, $pPoint) Local $aRet = DllCall("user32.dll", "int", "ScreenToClient", _ "hwnd", $hWnd, _ "ptr", $pPoint) Return $aRet[0] EndFunc ;==>_ScreenToClient Func _TrackPopupMenu($hMenu, $iFlags, $iX, $iY, $hWnd) Local $aRet = DllCall("User32.dll", "int", "TrackPopupMenu", _ "hwnd", $hMenu, _ "int", $iFlags, _ "int", $iX, _ "int", $iY, _ "int", 0, _ "hwnd", $hWnd, _ "hwnd", 0) Return $aRet[0] EndFunc ;==>_TrackPopupMenu
  11. Marcdk Also see the _GUICtrlButton_SetImageList example in the help.
  12. @wraithdu @rover One more way #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> GUICreate("My GUI", 200, 100) $BGR = _WinAPI_GetSysColor($COLOR_ACTIVECAPTION) ;Active caption is blue GUICtrlCreateLabel("", 50, 35, 100, 20) GUICtrlSetBkColor(-1, _BGR2RGB($BGR)) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func _BGR2RGB($sColor) Return Int("0x" & StringRegExpReplace(Hex($sColor, 6), "(..)(..)(..)", "\3\2\1")) EndFunc ;==>_BGR2RGB
×
×
  • Create New...