Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/11/2011 in all areas

  1. Its posible that your code did not work as you expected because of Dim $part_string = ("nOkFiR, Omga1000, Omga2000, Omga3000, Omga4000") The spaces are part of the substring here. Try Dim $part_string = ("nOkFiR,Omga1000,Omga2000,Omga3000,Omga4000")
    1 point
  2. I would highly recommend reading the help file a little more because how you're structuring the syntax is wrong & have you run the code above? Do you use SciTE? Au3Check? Because these will help you to debug the code. ControlClick("WindowLawl", "", "[CLASS:Internet Explorer_Server; INSTANCE:1]")
    1 point
  3. rover

    Context Menu and TreeView

    This is the default behaviour of a treeview, no bug Right click notifications from the treeview must be hit tested for the item under the mouse so the item can be selected. #include <GuiConstantsEx.au3> #include <GuiTreeView.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Global $MenuParent, $gui, $contextmenu, $i, $n, $textitem, $Tree, $Child Global $Tree, $tNMHDR, $hWndFrom, $iIDFrom, $iCode, $fOnItem = False Main() While 1 Sleep(100) WEnd Func Main() $gui = GUICreate("Treeview Demo", 300, 500, -1, -1) $Tree = GUICtrlCreateTreeView(-1, -1, 300, 500) For $n = 1 to 9 $Parent = GUICtrlCreateTreeViewItem("Parent " & $n,$Tree) For $i = 1 to 3 $Child = GUICtrlCreateTreeViewItem("Child " & $n & "-" & $i,$Parent) contextMenu($Child) Next Next GUISetOnEvent($GUI_EVENT_CLOSE, 'Close') GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState(@SW_SHOW) EndFunc Func contextMenu($MenuParent) $contextmenu = GUICtrlCreateContextMenu($MenuParent) $textitem = GUICtrlCreateMenuItem("Delete", $contextmenu) GUICtrlSetOnEvent ( $textitem, "Delete" ) EndFunc Func Delete() ;If $fOnItem Then ;optionally block menu return from right click over non-item area ;$fOnItem = False _GUICtrlTreeView_Delete($Tree, _GUICtrlTreeView_GetSelection ($Tree)) ;EndIf EndFunc Func Close() Exit EndFunc Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom") $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $iIDFrom Case $Tree Switch $iCode Case $NM_RCLICK Local $tPoint = _WinAPI_GetMousePos(True, $hWndFrom), $tHitTest $tHitTest = _GUICtrlTreeView_HitTestEx($hWndFrom, DllStructGetData($tPoint, 1), DllStructGetData($tPoint, 2)) ;If BitAND(DllStructGetData($tHitTest, "Flags"), $TVHT_ONITEM) Then ;optionally block menu return from right click over non-item area ;$fOnItem = True Local $hItem = DllStructGetData($tHitTest, 'Item') If IsPtr($hItem) Then _GUICtrlTreeView_SelectItem($hWndFrom, $hItem) EndIf ;EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY
    1 point
  4. Zedna

    Help in GDI+

    Here is older similar example from forum. Just look at principles ... #include <GUIConstants.au3> $GUI = GUICreate("test",300,300,-1,-1,$WS_POPUP) GUISetBkColor(0xFFFFFF) ; CreatePolyRgn takes an array of points... ; the following goes from ; 0,0 to ; 600,500 to ; 500,800 to ; 100,500 to ; 0,0 $a = CreatePolyRgn("0,0,600,500,500,800,100,500,0,0") SetWindowRgn($GUI,$a) $Eggzit = GUICtrlCreateButton("Bye",80,170,60,25) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $Eggzit Or $msg = $GUI_EVENT_CLOSE Then Exit WEnd Func SetWindowRgn($h_win, $rgn) DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $rgn, "int", 1) EndFunc Func CreatePolyRgn($pt) Local $ALTERNATE = 1 Local $buffer = "" $pt = StringSplit($pt,",") For $i = 1 to $pt[0] $buffer = $buffer & "int;" Next $buffer = StringTrimRight($buffer,1) $lppt = DllStructCreate($buffer) For $i = 1 to $pt[0] DllStructSetData($lppt,$i,$pt[$i]) Next $ret = DllCall("gdi32.dll","long","CreatePolygonRgn", _ "ptr",DllStructGetPtr($lppt),"int",Int($pt[0] / 2), _ "int",$ALTERNATE) $lppt = 0 Return $ret[0] EndFunc
    1 point
×
×
  • Create New...