Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/11/2014 in all areas

  1. Try it this way, it returns a delimited string of all the text of the selected row. #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <GUIListView.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 332, 267, 192, 124) $List1 = GUICtrlCreateListView("11111|22222", 32, 24, 249, 175) $LH = GUICtrlGetHandle($List1) _GUICtrlListView_AddItem($LH, "Item1") _GUICtrlListView_AddSubItem($LH, 0, "Item1-2", 1) _GUICtrlListView_AddItem($LH, "Item2") $Button1 = GUICtrlCreateButton("Button1", 120, 208, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $x = _GUICtrlListView_GetItemTextString($LH, _GUICtrlListView_GetSelectedIndices($LH)) MsgBox(0, "", $x) ; i want $x to return the Text of the selected item EndSwitch WEnd
    2 points
  2. Hello everyone! As always, I'm proud to present you vPaint. It's an image editor. It uses GDI+ as its drawing library. I want to thank to all members of this forum. Without you, this app wouldn't be ever written. Thank you for everything. Download: vPaint 4 image editor
    1 point
  3. Here's a little snippet that I wrote up that demonstrates a way to eliminate the message loop and onevent modes of detecting control and GUI events. I was inspired to attempt this by this feature request and the answer that Valik gave when he rejected it. I wasn't sure how to write the wrapper that he said could be done to do this, so I dug into windows messages to see what I could come up with. This snippet uses 3 different windows messages for various controls and for the GUI events. I have also included code that shows that you can use this in conjunction with GUIGetMsg, it should work just as well alongside OnEvent mode as well. You will probably have to play around with it to get it to work with every different type of control that AutoIt can make. I originally had a combo box in the GUI, but they work strangely because an event is fired every time the GUI gets focus and the combo is the last control actioned. I hope this is informative to some and if there's a way of doing this easier, I'd love to know. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MenuConstants.au3> GUIRegisterMsg($WM_COMMAND, "_WM_EXTRACTOR") GUIRegisterMsg($WM_SYSCOMMAND, "_WM_EXTRACTOR") GUIRegisterMsg($WM_HSCROLL, "_WM_EXTRACTOR") $GUI = GUICreate("Test GUI", 200, 200, -1, -1, BitOR($WS_THICKFRAME, $gui_ss_default_gui)) $Button = GUICtrlCreateButton("Test", 20, 20) $Button2 = GUICtrlCreateButton(" Another Test ", 20, 100) $Slider = GUICtrlCreateSlider(20, 60, 150) $hSlider = GUICtrlGetHandle($Slider) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $Button MsgBox(0, "", "You pressed the button marked TEST") Case $Button2 MsgBox(0, "", "You pressed the button marked 'Another Test'") EndSwitch WEnd Func _WM_EXTRACTOR($hWnd, $iMsg, $wParam, $lParam) Local $nNotifyCode = BitShift($wParam, 16) Local $nID = BitAND($wParam, 0x0000FFFF) Local $hCtrl = $lParam #forceref $hWnd, $iMsg, $wParam, $lParam Switch $iMsg Case $WM_HSCROLL Switch $lParam Case $hSlider ConsoleWrite("+Slider moved to: " & GUICtrlRead($Slider) & @LF) EndSwitch Case $WM_VSCROLL Case $WM_COMMAND Switch $nID Case $Button ConsoleWrite(">Button Test pressed" & @LF) Case $Button2 ConsoleWrite(">Button Another Test pressed" & @LF) Case Else MsgBox(0, "MY_WM_COMMAND", "GUIHWnd" & @TAB & ":" & $hWnd & @LF & _ "MsgID" & @TAB & ":" & $msg & @LF & _ "wParam" & @TAB & ":" & $wParam & @LF & _ "lParam" & @TAB & ":" & $lParam & @LF & @LF & _ "WM_COMMAND - Infos:" & @LF & _ "-----------------------------" & @LF & _ "Code" & @TAB & ":" & $nNotifyCode & @LF & _ "CtrlID" & @TAB & ":" & $nID & @LF & _ "CtrlHWnd" & @TAB & ":" & $hCtrl) EndSwitch Case $WM_SYSCOMMAND Switch $wParam Case $SC_CLOSE ConsoleWrite("!Exit pressed" & @LF) Exit Case $SC_RESTORE ConsoleWrite("!Restore window" & @LF) Case $SC_MINIMIZE ConsoleWrite("!Minimize Window" & @LF) Case $SC_MOUSEMENU + 3 ConsoleWrite("!System menu pressed" & @LF) Case $SC_MOVE ConsoleWrite("!System menu Move Option pressed" & @LF) Return 0 Case $SC_SIZE ConsoleWrite("!System menu Size Option pressed" & @LF) Return 0 Case $SC_MOUSEMENU + 2 ; This and the following case statements are only valid when the GUI is resizable ConsoleWrite("!Right side of GUI clicked" & @LF) Return 0 Case $SC_MOUSEMENU + 1 ConsoleWrite("!Left side of GUI clicked" & @LF) Return 0 Case $SC_MOUSEMENU + 8 ConsoleWrite("!Lower Right corner of GUI clicked" & @LF) Return 0 Case $SC_MOUSEMENU + 7 ConsoleWrite("!Lower Left corner of GUI clicked" & @LF) Return 0 Case $SC_MOUSEMENU + 6 ConsoleWrite("!Bottom side of GUI clicked" & @LF) Return 0 Case Else MsgBox(0, "MY_WM_COMMAND", "GUIHWnd" & @TAB & ":" & $hWnd & @LF & _ "MsgID" & @TAB & ":" & $msg & @LF & _ "wParam" & @TAB & ":" & $wParam & @LF & _ "lParam" & @TAB & ":" & $lParam & @LF & @LF & _ "WM_COMMAND - Infos:" & @LF & _ "-----------------------------" & @LF & _ "Code" & @TAB & ":" & $nNotifyCode & @LF & _ "CtrlID" & @TAB & ":" & $nID & @LF & _ "CtrlHWnd" & @TAB & ":" & $hCtrl) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_EXTRACTOR
    1 point
  4. 1 point
  5. Hi mLipok. You can do something like this: Local $hwinspool = DllOpen("winspool.drv") Local $bRet = DllCall($hwinspool, "bool", "GetDefaultPrinterW", "ptr", 0, "dword*", 0) Local $pcchBuffer = $bRet[2] Local $tBuffer = DllStructCreate("wchar[" & $pcchBuffer & "]") Local $pBuffer = DllStructGetPtr($tBuffer, 1) $bRet = DllCall($hwinspool, "bool", "GetDefaultPrinterW", "ptr", $pBuffer, "dword*", $pcchBuffer) Local $sPrinter = DllStructGetData($tBuffer, 1) MsgBox(0, $pcchBuffer, "Default Printer Name: " & $sPrinter) $bRet = DllCall($hwinspool, "bool", "OpenPrinterW", "wstr", $sPrinter, "handle*", 0, "ptr", 0) Local $hPrinter = $bRet[2] MsgBox(0, "Printer Handle:", $hPrinter) $bRet = DllCall($hwinspool, "bool", "ClosePrinter", "handle", $hPrinter) DllClose($hwinspool) Saludos
    1 point
  6. ;http://msdn.microsoft.com/en-us/library/windows/desktop/ms646360%28v=vs.85%29.aspx #Include <GUIConstantsEx.au3> Global Const $SC_CLOSE = 0xF060 $gui = GUICreate("") GUISetState() GUIRegisterMsg(0x0112, "OnSysCommand") ; 0x0112 = WM_SYSCOMMAND While 1 Sleep(10) WEnd Func OnSysCommand($hWnd, $Msg, $wParam, $lParam) $test = BitAND($wParam, 0xFFF0) If $test = 0xF060 Then Exit EndFunc Very raw but I'm sure you'll be able to carry on
    1 point
  7. water

    OutlookEX UDF

    I hope to find some spare time over the weekend to solve this problem. Please stay tuned.
    1 point
  8. The way you are doing it would be the way I'd do it. Just don't use 2 While loops or you might get stuck in one of them with no way out of it if you do it wrong.
    1 point
  9. use Opt("GUIOnEventMode", 1) and AdlibRegister Opt("GUIOnEventMode", 1) HotKeySet("{ESC}", "_Exit") AdlibRegister("myfunc", 120000) Func myfunc() ConsoleWrite("myfunc ist running"&@CR) EndFunc Func _Exit() Exit EndFunc ;==>_Exit While 1 Sleep(50) WEnd
    1 point
  10. jchd

    Query result to gui list view

    _ArrayDisplay doesn't have such flexibility; This function is designed mainly as a debugging aid so it doesn't offer all the bells and whistles that a home-made listview may use. For instance there is no provision to remove the Row column (albeit I feel there should be such a switch parameter). Either build your own GUI which you can design exactly as you want, or copy the _ArrayDisplay function from the UDF file, rename it to _MyArrayDisplay and modify it according to your needs. Perhaps that will prove the easiest path but that depends on the interaction(s) you expect to offer in your application. If the goal is only to display some queries like that, making your modified function may be enough. EDIT: thinking again about the issue, you may also find >this post of interest, even if Greencan's code does much more than you probably need (getting more bang for no buck never hurt BTW).
    1 point
  11. Here's how you get the Administrators groupname, no matter what language: $oWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\cimv2") $colItems = $oWMIService.ExecQuery("Select * From Win32_Group Where LocalAccount = TRUE And SID = 'S-1-5-32-544'") For $oItem in $colItems ConsoleWrite($oItem.Name ) Next
    1 point
×
×
  • Create New...