Jump to content

Search the Community

Showing results for tags 'GuiGetMsg'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 6 results

  1. TL;DR: Anyway to bypass built in sleep on TrayGetMsg() and GUIGetMsg() ? I'm currently working on a project that does some heavy array/ GDI+ processing, which depending what I have it do can take between 4s - 1min. During this time, I'd like to have the Tray icon (mainly, possibly also the GUI) for the program be responsive, so that if someone wanted to change actions or exit the script during this, they can without closing the process. Currently I have my TrayGetMsg and GUIGetMsg captures in my main program loop, working great, and once I go into the array/ GDI+ functions I tried switching it to an AdlibRegister call, unregistering it once completed. The problem with this is that it's adding ~10-20% more time into those functions, which I'd like to avoid. As I understand it, and from the helpfile: "This function automatically idles the CPU when required so that it can be safely used in tight loops without hogging all the CPU." From what I've read/ seen/ tested, this adds a 10ms sleep into the calls. I would rather avoid that sleep all together. The array/ GDI+ function that I'm doing peg the CPU at 100% (for its core) anyways, so that's not a concern of mine. My only concern for this is speed (and having things be responsive to other actions). Here's an example: Local $iBlockSize = 20, $iWidth = 1920, $iHeight = 1080, $aBigArray[$iWidth * $iHeight], $iPercentDone, $sLastMsg Local $aSmallerArray[Int(Ceiling($iWidth / $iBlockSize)) * Int(Ceiling($iHeight / $iBlockSize))] Local $sAdlib[] = ["Registered: ", "UnRegistered: ", "Registered to _FakeTray: "], $timer, $iIndexLength = UBound($aBigArray) Local $ixBlocks = Int(Ceiling($iWidth / $iBlockSize)), $iBlockIndex, $iBlockX, $iBlockY For $j = 0 To 2 If $j = 0 Then AdlibRegister("_CheckTray", 100) ElseIf $j = 1 Then AdlibUnRegister("_CheckTray") ElseIf $j = 2 Then AdlibRegister("_FakeTray", 100) EndIf $timer = TimerInit() For $i = 0 To $iIndexLength - 1 ; Loop through $aBigArray $aBigArray[$i] = Random(1, 10, 1) $iPercentDone = Floor(($i / $iIndexLength * 100)) ; Hopefully quick maths to get progress If $sLastMsg <> "We are " & $iPercentDone & "% done" Then ; Check if we're on a new percent $sLastMsg = "We are " & $iPercentDone & "% done" ; If so, update the msg ToolTip($sLastMsg, 0, 0) ; And display the current progress EndIf $y = Floor($i / $iWidth) ; Convert index to Y coordinate $x = Floor($i - ($y * $iWidth)) ; Convert index to X coordinate $iBlockX = Floor($x / $iBlockSize) ; Convert X coord to xBlock coord $iBlockY = Floor($y / $iBlockSize) ; Convert Y coord to yBlock coord $iBlockIndex = Int($iBlockX + ($iBlockY * $ixBlocks)) ; Convert into a blockIndex ;~ If Mod($i, 10000) = 0 Then ;~ ConsoleWrite($iBlockIndex & " - " & $i & @CRLF) ;~ EndIf $aSmallerArray[$iBlockIndex] += Int($aBigArray[$i]) ; Add into $aSmallerArray Next ConsoleWrite("Time to run with Adlib" & $sAdlib[$j] & TimerDiff($timer) & @CRLF) Next Func _CheckTray() Switch TrayGetMsg() Case "Meow" Return Case "Woof" Return EndSwitch EndFunc ;==>_CheckTray Func _FakeTray() Local $sMeow = "Oink" Switch $sMeow Case "Meow" Return Case "Woof" Return EndSwitch EndFunc ;==>_FakeTray Exit On my system, this takes ~1 minute to run, output: Time to run with AdlibRegistered: 19649.335 Time to run with AdlibUnRegistered: 16264.4124 Time to run with AdlibRegistered to _FakeTray: 16860.1283 >Exit code: 0 Time: 53.92 As you can see, it's ~20.8% faster without the Adlib check, and ~16.5% faster using a (hopefully) reproduction of TrayGetMsg() without the built in sleep. These timings vary, but it's consistently much faster without the TrayGetMsg() sleep (unless it's just that slow). I've used the OnEventModes, and those also slow down performance, more so than just using the GetMsgs, so those are out (but effective, and pretty easy to use).
  2. Hi all, I am using GuiGetMsg(). Assume that i have a combo box in my gui. And when i use this code - While 1     $nMsg = GUIGetMsg()     Switch $nMsg         Case $GUI_EVENT_CLOSE             Exit         Case $CMB_NamesList ; Handle of my Combo box             CellSelect()          EndSwitch WEnd This code will call my "CellSelect()" function only when the selection change event occurred. But assume that i need to call this function right after the user clicks on the combo box. So do i need to use GuiRegisterMsg function for that ? Or can i simply do the task with GUIGetMsg() ? If the second option is possible, then i wonder how to do it.
  3. Hello Folks, I'm not an AutoIt noob but I am new to the GuiRegisterMsg command. What I am trying to do is to pop up a "long string edit" window when user double-clicks. Ideally I wanted it to be a duouble-click in the Input box itself but I couldn't get this to work so I was going to settle for a double-click *near* the input box. Here's a severely curtailed version of my almost 1300-line script. From the msgbox "tell-tale" it appears that the GuiRegisterMsg definition interferes with the GuiGetMsg function and it 'remembers' the last GuiGetMsg return value -- is there some way to 'flush' the holding area? Note that there are bits in there from experiments -- if I comment out the While-Wend and replace it with the sleep line you can better see what I am trying to acheive. The list box is just to give a different kind of control than an input field to have the focus, it's contents are not relevant to the snippet, only to the full app. All help gratefully acknowledged! Here's the code snippet: #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <GuiConstantsEx.au3> #include <EditConstants.au3> #include <ListBoxConstants.au3> Dim $InputFileId Dim $OutputFileId Dim $winMain Dim $GUIMsg GUIRegisterMsg($WM_LBUTTONDBLCLK, "EditText") $winMain = GUICreate ("Test for Editing Long Strings", 800, 560, -1, -1) GUICtrlCreateLabel("File to Process", 22,30) GUICtrlCreateLabel("Output File", 40,60) $InputFileId = GUICtrlCreateInput ( "", 100, 25, 400, 20) $OutputFileId = GUICtrlCreateInput ( "", 100, 55, 400, 20) $btnInputFile = GUICtrlCreateButton ( "Browse for File", 520, 22, 110, 25) $btnOPFolder = GUICtrlCreateButton ( "Browse for Location", 520, 53, 110, 25) ; Create the list of actions $ActionList = GUICtrlCreateList( "", 25, 260, 70, 200) GUICtrlSetData($ActionList, "Delete|Exclude|Include|Insert|Kill Blanks|Move|Remove|Replace|Switch", "Delete") GUISetState(@SW_SHOW, $winMain) While 1 $GUIMsg = GUIGetMsg() Switch $GUIMsg Case $GUI_EVENT_CLOSE ExitLoop Case $btnInputFile MsgBox(0, "Info", "Input Button pressed") Case $btnOPFolder MsgBox(0, "Info", "Output Button pressed") EndSwitch WEnd Func EditText($Window, $Caller, $p1, $p2) Dim $winEdit Dim $CtrlName Dim $edtString Dim $btnAccept Dim $btnReject Dim $Response Dim $RetString Dim $CtrlId Dim $ActCode Dim $HasFocus $CtrlName = ControlGetFocus("Test for Editing Long Strings") msgbox(0,"DOUBLE-CLICK!","Control: " & $CtrlId & @CRLF & "Action: " & $ActCode & @CRLF & "CtrlName: " & $CtrlName) If StringInStr($CtrlName,"Edit") > 0 Then $winEdit = GUICreate("Long String Editor", 790, 100, -1, -1, $WS_BORDER) $edtString = GUICtrlCreateEdit("This is a potentially long string", 5, 5, 780, 20, $ES_AUTOHSCROLL) $btnAccept = GUICtrlCreateButton( "Accept String", 240, 33, 100, 30) $btnReject = GUICtrlCreateButton( "Reject String", 440, 33, 100, 30) GUISetState(@SW_SHOW, $winEdit) GUICtrlSetState($edtString, $GUI_FOCUS) ; sleep(5000) ;#cs While 1 $Response = GUIGetMsg() if $Response = $btnAccept Then ExitLoop EndIf Select Case $Response = $btnReject ExitLoop Case $Response = $btnAccept ; GUICtrlSetData($CtrlName, $RetString) ExitLoop Case Else $RetString = GUICtrlRead($edtString) EndSelect WEnd ;#ce Else Return $GUI_RUNDEFMSG EndIf GUICtrlSetData($CtrlName, $RetString) GUIDelete($winEdit) Return $GUI_RUNDEFMSG EndFunc
  4. I'm trying to catch non printing characters (like Delete, F5, Shifte F5, etc) when a user is typing into an Input Control. The sample code below doesn't work (the Input MsgBox only appears when the enter key is pressed and the Key Pressed MsgBox never appears). It appears to me this is because the Input Control doesn't send a GUI message every time a key stroke is received. So my question is how can I capture individual key presses, including non printing ones, to an Input Control? Or should I be using a different control? Thank you - Dick williams #include #include $window = GUICreate("Test", 200, 100) $inputBox = GUICtrlCreateInput ( "Input Box", 50, 50 , 100, 20) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $inputBox MsgBox(0, "Input Box", "Case Executed") If _IsPressed(75) Then MsgBox(0, "Key Pressed", "F5") EndIf Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd
  5. I've been working on a fancy ListView for user input. When a cell is clicked, a temporary Combo or Input control is created. The user does their part, then the temporary control's data is transferred to the ListView and the temporary control is deleted. I'm quite pleased with how it's turned out, except for one puzzling "feature". If I use "Switch GUIGetMsg()" in the main loop, then the first time a user clicks on the form causes a temp control to be both created and processed. That only occurs on the first click and not on any subsequent clicks. If I use "$msg = GUIGetMsg(1)" with a Switch command, it works properly on every click. See code below. I have no idea why this is. Does anyone else? I'll use GUIGetMsg(1) if I must, but I prefer my code to be as simple as possible. #include #include #include #include #include Global Const $_INCL = 1, $_REGEX = 2, $_FILTER = 3 Global $h_TempCtrl, $TempCtrlStatus[3] = [False, -1, -1], $_ListViewY = 1 Switch @OSVersion Case "WIN_2000", "WIN_XP", "WIN_XPe", "WIN_2003" $_ListViewY = 0 EndSwitch $h_GUI = GUICreate("Form1", 594, 329) $h_ListView = GUICtrlCreateListView("#|Include or Not|Filter Type|Contents ", 24, 24, 545, 279, $LVS_SINGLESEL) $hG_LVitem1 = GUICtrlCreateListViewItem("1.|Include|StringRegExp|", $h_ListView) $hG_LVitem2 = GUICtrlCreateListViewItem("2.|Include|StringRegExp|", $h_ListView) $hG_LVitem3 = GUICtrlCreateListViewItem("3.|Include|StringRegExp|", $h_ListView) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() ;~ $msg = GUIGetMsg(1) ;~ Switch $msg[0] Case $GUI_EVENT_CLOSE Exit Case $h_TempCtrl If $h_TempCtrl <> 0 Then _GUICtrlTemp_Apply("$h_TempCtrl") EndIf EndSwitch WEnd Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam ; Catch ListView messages Local $hWndFrom, $iCode, $tNMHDR $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") If $hWndFrom == GUICtrlGetHandle($h_ListView) And $iCode == $NM_CLICK Then _GUICtrlTemp_Create() Return $GUI_RUNDEFMSG EndFunc Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg ; Catch user input Local $hWndFrom, $iIDFrom, $iCode $hWndFrom = $ilParam $iIDFrom = BitAND($iwParam, 0xFFFF) $iCode = BitShift($iwParam, 16) If $TempCtrlStatus[0] Then If $hWndFrom == GUICtrlGetHandle($h_TempCtrl) Then Switch $iCode Case $CBN_SELENDOK _GUICtrlTemp_Apply("$CBN_SELENDOK") Case $CBN_SELENDCANCEL _GUICtrlTemp_Delete("$CBN_SELENDCANCEL") Case $EN_KILLFOCUS _GUICtrlTemp_Apply("$EN_KILLFOCUS") EndSwitch EndIf EndIf Return $GUI_RUNDEFMSG EndFunc Func _GUICtrlTemp_Create() ; Create a temporary control for user input Local $tempPos, $HitTest $HitTest = _GUICtrlListView_SubItemHitTest(GUICtrlGetHandle($h_ListView)) If $HitTest[0] <> -1 Then $TempCtrlStatus[0] = True $TempCtrlStatus[1] = $HitTest[0] $TempCtrlStatus[2] = $HitTest[1] Switch $HitTest[1] ; Global Const $_INCL = 1, $_REGEX = 2, $_FILTER = 3, $_FREQ = 4 Case $_INCL $tempPos = _GUICtrlListView_GetSubItemRect($h_ListView, $HitTest[0], $_INCL) $h_TempCtrl = GUICtrlCreateCombo("", $tempPos[0] + 24, $tempPos[1] + 24 + $_ListViewY, $tempPos[2] - $tempPos[0], $tempPos[3] - $tempPos[1], $CBS_DROPDOWNLIST) GUICtrlSetData($h_TempCtrl, "Include|Don't Include") GUICtrlSetState($h_TempCtrl, BitOR($GUI_FOCUS, $GUI_ONTOP)) _GUICtrlComboBox_ShowDropDown($h_TempCtrl, True) Case $_REGEX $tempPos = _GUICtrlListView_GetSubItemRect($h_ListView, $HitTest[0], $_REGEX) $h_TempCtrl = GUICtrlCreateCombo("", $tempPos[0] + 24, $tempPos[1] + 24 + $_ListViewY, $tempPos[2] - $tempPos[0], $tempPos[3] - $tempPos[1], $CBS_DROPDOWNLIST) GUICtrlSetData($h_TempCtrl, "String|StringRegExp") GUICtrlSetState($h_TempCtrl, BitOR($GUI_FOCUS, $GUI_ONTOP)) _GUICtrlComboBox_ShowDropDown($h_TempCtrl, True) Case $_FILTER $tempPos = _GUICtrlListView_GetSubItemRect($h_ListView, $HitTest[0], $_FILTER) Local $hRegion = _WinAPI_CreateRectRgn($tempPos[0] + 24, $tempPos[1] + 24 + $_ListViewY, $tempPos[2], $tempPos[3]) $h_TempCtrl = GUICtrlCreateInput(_GUICtrlListView_GetItemText($h_ListView, $HitTest[0], 3), $tempPos[0] + 24, $tempPos[1] + 24 + $_ListViewY, $tempPos[2] - $tempPos[0], $tempPos[3] - $tempPos[1]) GUICtrlSetState($h_TempCtrl, BitOR($GUI_FOCUS, $GUI_ONTOP, $GUI_SHOW)) _GUICtrlEdit_SetSel($h_TempCtrl, 0, -1) _WinAPI_RedrawWindow($h_GUI, 0, $hRegion, $RDW_UPDATENOW) ; It won't draw the control until mouse-out *** (WHY??) EndSwitch EndIf EndFunc Func _GUICtrlTemp_Apply( $caller ) ; Apply the temporary control's text to the ListView If $TempCtrlStatus[0] Then $TempCtrlStatus[0] = False _GUICtrlListView_SetItemText($h_ListView, $TempCtrlStatus[1], GUICtrlRead($h_TempCtrl), $TempCtrlStatus[2]) $TempCtrlStatus[1] = -1 $TempCtrlStatus[2] = -1 _GUICtrlTemp_Delete($caller & " -> Apply") EndIf EndFunc Func _GUICtrlTemp_Delete( $caller ) ConsoleWrite("Delete called by: " & $caller & @LF & "$h_TempCtrl: " & $h_TempCtrl & @LF & @SEC & ':' & @MSEC & @LF & @LF) ; Get rid of the temporary control GUICtrlDelete($h_TempCtrl) EndFunc
  6. Hello everyone! Hope you are having great days. I unfortunately am in need of assistance. I am in the process of creating a program that will allow me to search 2 systems that my company uses that store customer info. At this time if a customer places an order it could be in our online only system, our in-store system, or both at the same time. So instead of searching one manually, then the other, I decided to code a script that would look in both at the same time until it find the order. It has a few issues though. Issue #1 (Solved, Thank you BrewManNH!): I have two GUIs that I created, but apparently created wrong as the first one never closes until the script ends completely or if they press the red X, but is supposed to close when the user presses okay, but not end the script. This GUI is called in my code by a function called RefGui(). Issue #2 (Solved): This same GUI is supposed to return a reference id entered by the user in an input field and what type of reference number it is by selecting a radio button. However, when used like it was intended it only returns the data from the input field. If nothing is put in the input field then it will return both the data in the input field and which radio selection is made. I have other issues but will probably deal with them once I have those figured out. If someone could take a look at my code and give me some ideas I would appreciate it. #include "CSV.au3" #include "Array.au3" #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include <ButtonConstants.au3> Opt("WinWaitDelay",100) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) Opt("SendCapslockMode",1) $objErr = ObjEvent("AutoIt.Error","MyErrFunc") ;Open Connection to OsCommerce database $oConn = ObjCreate("ADODB.Connection") $oConn.Open(;Connection string to my first database) ;Open Connection to Mas90 database $conn = ObjCreate("ADODB.Connection") $DSN = ;Connection string for my second database $conn.Open($DSN) ;Define var for reference type as global w/ initial value/Moved per BrewManNH's suggestion Global $refType="Internet" ;Loop until user closes first GUI w/ close button While 1 ;~ ;Define var for reference type as global w/ initial value ;~ Global $refType="Internet" ;Ask for order number or invoice number: (This opens first gui) $refNum=RefGui() ;Start text var to display message. $OrderMsg=$refNum & @CRLF & $refType ;If user selected internet search OsCommerce. Otherwise this won't be necessarily. If $refType="Internet" Then ;Query status and comments $rs = $oConn.Execute("SELECT orders.orders_status,orders_status_history.comments FROM orders,orders_status_history WHERE orders.orders_id='"& $refNum &"' AND orders_status_history.orders_status_id=orders.orders_status AND orders_status_history.orders_id=orders.orders_id") ;Make sure a result was returned then get results If IsObj($rs) And $rs.EOF=False Then $osStatus = $rs.GetRows() $rs = $oConn.Execute("SELECT orders_status_name FROM orders_status WHERE orders_status_id ='"& $osStatus[UBound($osStatus)-1][0] &"'") $temp=$rs.GetRows() $osStatus[UBound($osStatus)-1][0]=$temp[0][0] $OrderMsg+="OsCommerce:" & @CRLF $OrderMsg+=@TAB & "Status:" & $osStatus[UBound($osStatus)-1][0] & @CRLF $OrderMsg+=@TAB & "Comments:" & $osStatus[UBound($osStatus)-1][1] & @CRLF Else $osStatus = 0 EndIf EndIf ;If internet or sales were chosen then check if it has been put in Mas90 yet. If $refType="Internet" Or $refType="Sales" Then $rs = $conn.Execute("SELECT OrderType FROM SO_SalesOrderHeader WHERE (SalesOrderNo='"& $refNum &"')") If IsObj($rs) And $rs.EOF=False Then $SOStatus = $rs.GetRows() $OrderMsg+="Sales Order:" & @CRLF $OrderMsg+=@TAB & "Status:" & $SOStatus[0][0] & @CRLF $rs = $conn.Execute("SELECT ItemCode,ItemCodeDesc,QuantityOrdered,QuantityBackordered FROM SO_SalesOrderDetail WHERE (SalesOrderNo='"& $refNum &"' AND ItemType='1')") If IsObj($rs) And $rs.EOF=False Then $SOItems = $rs.GetRows() $OrderMsg+=@TAB & "Items:" & @CRLF $i=0 While $i<UBound($SOItems)-1 $OrderMsg+=@TAB & @TAB & "(" & $SOItems[$i][0] & ") " & $SOItems[$i][1] & @CRLF $rs = $conn.Execute("SELECT TotalQuantityOnHand FROM CI_Item WHERE (ItemCode='"& $SOItems[$i][0] &"')") If IsObj($rs) And $rs.EOF=False Then $item = $rs.GetRows() $OrderMsg+=@TAB & @TAB & "Ordered/Available: " & $SOItems[$i][2] & "/" & $item[0][0] & @TAB & "Backordered: " & $SOItems[$i][3] & @CRLF EndIf $i+=1 WEnd Else $SOItems = 0 EndIf Else $SOStatus = 0 EndIf $rs = $conn.Execute("SELECT InvoiceNo, SalesOrderNo FROM SO_InvoiceHeader WHERE (SalesOrderNo='"& $refNum &"')") If IsObj($rs) And $rs.EOF=False Then $InvStatus = $rs.GetRows() $rs = $conn.Execute("SELECT InvoiceNo,ItemCode,ItemCodeDesc,QuantityOrdered,QuantityBackordered FROM SO_InvoiceDetail WHERE (InvoiceNo='"& $InvStatus[0][0] &"' AND ItemType=1)") If IsObj($rs) And $rs.EOF=False Then $InvItems = $rs.GetRows() Else $InvItems = 0 EndIf Else $InvStatus = 0 EndIf $rs = $conn.Execute("SELECT InvoiceNo, SalesOrderNo FROM AR_InvoiceHistoryHeader WHERE (SalesOrderNo='"& $refNum &"')") If IsObj($rs) And $rs.EOF=False Then $InvHst = $rs.GetRows() $rs = $conn.Execute("SELECT InvoiceNo,ItemCode,ItemCodeDesc,QuantityOrdered,QuantityBackordered FROM AR_InvoiceHistoryDetail WHERE (InvoiceNo='"& $InvHst[0][0] &"' AND ItemType=1)") If IsObj($rs) And $rs.EOF=False Then $InvItems = $rs.GetRows() Else $InvItems = 0 EndIf Else $InvHst = 0 EndIf ElseIf $refType="Invoice" Then $rs = $conn.Execute("SELECT InvoiceNo, SalesOrderNo FROM AR_InvoiceHistoryHeader WHERE (InvoiceNo='"& $refNum &"')") If IsObj($rs) And $rs.EOF=False Then $InvHst = $rs.GetRows() $rs = $conn.Execute("SELECT InvoiceNo,ItemCode,ItemCodeDesc,QuantityOrdered,QuantityBackordered FROM AR_InvoiceHistoryDetail WHERE (InvoiceNo='"& $refNum &"' AND ItemType=1)") If IsObj($rs) And $rs.EOF=False Then $InvItems = $rs.GetRows() Else $InvItems = 0 EndIf Else $InvHst = 0 EndIf EndIf Gui($OrderMsg) WEnd ;This is the second GUI that displays the results Func Gui($txt) Local $myedit, $msg $hGUI=GUICreate("Details:", 500, 300, Default, Default,$WS_OVERLAPPEDWINDOW) ; will create a dialog box that when displayed is centered $GUISize=WinGetClientSize($hGUI) $myedit = GUICtrlCreateEdit($txt,-1, -1, $GUISize[0], $GUISize[1],$ES_READONLY) GUICtrlSetResizing ( $myedit, $GUI_DOCKBORDERS ) GUISetState() DllCall("user32.dll","int","HideCaret","int",0) Send("{END}") ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete($hGUI) EndFunc ;This is the first GUI. It asks for the information required to look up the order Func RefGui() $RefGui = GUICreate("Reference#", 261, 156, -1, -1) GUISetFont(10, 400, 0, "Verdana") GUICtrlCreateLabel("Enter Reference:", 15, 12, 116, 20) $RefNum = GUICtrlCreateInput("REFERENCE #", 136, 8, 110, 24, BitOR($GUI_SS_DEFAULT_INPUT,$ES_UPPERCASE)) $OK = GUICtrlCreateButton("OK", 176, 120, 75, 25, BitOR($BS_DEFPUSHBUTTON,$BS_NOTIFY)) GUICtrlCreateGroup("Select Ref Type:", 16, 40, 145, 105, BitOR($GUI_SS_DEFAULT_GROUP,$WS_CLIPSIBLINGS)) $Internet = GUICtrlCreateRadio("Internet Order", 24, 64, 113, 17) GUICtrlSetState(-1, $GUI_CHECKED) $Sales = GUICtrlCreateRadio("Sales Order", 24, 88, 113, 17) $Invoice = GUICtrlCreateRadio("Invoice", 24, 112, 113, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() If $nMsg = $GUI_EVENT_CLOSE Then Exit If $nMsg = $OK Then ExitLoop EndIf WEnd If GUICtrlRead($Internet) = 1 Then $refType="Internet" ElseIf GUICtrlRead($Sales) = 1 Then $refType="Sales" ElseIf GUICtrlRead($Invoice) = 1 Then $refType="Invoice" EndIf $temp=GUICtrlRead($RefNum) GUIDelete($RefGui) Return $temp EndFunc Func MyErrFunc() $hexnum=hex($objErr.number,8) Msgbox(0,"","We intercepted a COM Error!!" & @CRLF & @CRLF & _ "err.description is: " & $objErr.description & @CRLF & _ "err.windescription is: " & $objErr.windescription & @CRLF & _ "err.lastdllerror is: " & $objErr.lastdllerror & @CRLF & _ "err.scriptline is: " & $objErr.scriptline & @CRLF & _ "err.number is: " & $hexnum & @CRLF & _ "err.source is: " & $objErr.source & @CRLF & _ "err.helpfile is: " & $objErr.helpfile & @CRLF & _ "err.helpcontext is: " & $objErr.helpcontext _ ) exit EndFunc Here is just the code for the first GUI so you don't have to look through all that: Func RefGui() $RefGui = GUICreate("Reference#", 261, 156, -1, -1) GUISetFont(10, 400, 0, "Verdana") GUICtrlCreateLabel("Enter Reference:", 15, 12, 116, 20) $RefNum = GUICtrlCreateInput("REFERENCE #", 136, 8, 110, 24, BitOR($GUI_SS_DEFAULT_INPUT,$ES_UPPERCASE)) $OK = GUICtrlCreateButton("OK", 176, 120, 75, 25, BitOR($BS_DEFPUSHBUTTON,$BS_NOTIFY)) GUICtrlCreateGroup("Select Ref Type:", 16, 40, 145, 105, BitOR($GUI_SS_DEFAULT_GROUP,$WS_CLIPSIBLINGS)) $Internet = GUICtrlCreateRadio("Internet Order", 24, 64, 113, 17) GUICtrlSetState(-1, $GUI_CHECKED) $Sales = GUICtrlCreateRadio("Sales Order", 24, 88, 113, 17) $Invoice = GUICtrlCreateRadio("Invoice", 24, 112, 113, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() If $nMsg = $GUI_EVENT_CLOSE Then Exit If $nMsg = $OK Then ExitLoop EndIf WEnd If GUICtrlRead($Internet) = 1 Then $refType="Internet" ElseIf GUICtrlRead($Sales) = 1 Then $refType="Sales" ElseIf GUICtrlRead($Invoice) = 1 Then $refType="Invoice" EndIf $temp=GUICtrlRead($RefNum) GUIDelete($RefGui) Return $temp EndFunc
×
×
  • Create New...