Jump to content

Search the Community

Showing results for tags 'scope of include'.

  • 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

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 1 result

  1. I whittled down much code and have isolated my problem to where a #include is located in the code, but apparently do not understand the scope of #include. In the example code below I open up a window, then when you press Alt+W I open a second window with a List All button. Clicking the List All button invokes a _DebugArrayDisplay(). At line 4 and 50 are the #include <Debug.au3> for the _DebugArrayDisplay(). If I comment out the line 4 #include <Debug.au3> the program crashes. I thought the line 50 #include <Debug.au3> would work however it does not, so I'm concluding I don't understand what' going on. Any assistance greatly appreciated. #AutoIt3Wrapper_run_debug_mode=Y ;use this to debug in console window <--- LOOK #include <Debug.au3> ;for _DebugArrayDisplay() ;<-- commenting this out makes it fail vs #include at line 50 ??? #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiEdit.au3> #include <WindowsConstants.au3> AutoItSetOption("MustDeclareVars", 1) ;create an example window with an edit control Local $hGUI = GUICreate("Test", 500, 400) ;the main window Local $cIDEdit1 = GUICtrlCreateEdit("Edit control #1", 10, 10, 200, 250, Bitor($ES_WANTRETURN, $WS_VSCROLL, $ES_AUTOVSCROLL, $WS_HSCROLL)) GUISetState(@SW_SHOW, $hGUI) ;show it MsgBox(262144, "USAGE", "Example window." &@CRLF&@CRLF& "Press Alt+W (once or twice) after clicking OK to enter window/control mode.") Local $nMsg While 1 ;this is your code main loop $nMsg = GUIGetMsg() If $nMsg <> 0 Then ;we have a message so Switch $nMsg ;Check for GUI events Case $GUI_EVENT_CLOSE ;the GUI is closed red [X] is clicked Exit Case Else ;do nothing EndSwitch ;End running through GUI events. Else ;no message Sleep(100) ;do something in your program EndIf ;---------------------------------------------------------------------------------------------------------------------------+ ;ADD this function into your $nMsg loop after the $nMsg EndIf ;as shown here or in your While 1 loop so it gets executed | _WindowControlOperations() ;let's go into move/adjust window/control operations if Alt+W pressed | ;comment out this function call when all done, or delete it | ;---------------------------------------------------------------------------------------------------------------------------+ WEnd ;------------------------------------------ this code below intended to be in a UDF eventually ---------------------------------------- Local $hDLL = DllOpen("user32.dll") ;also Global to all functions called - DO NOT close as calling program may be using user32.dll ;actually we CAN close it as user's call to same user32.dll will have a different handle #AutoIt3Wrapper_run_debug_mode=Y ;use this to debug in console window <--- LOOK #include-Once #include <Debug.au3> ;for _DebugArrayDisplay() ;<-- this one does not seem to work, only one in user's program above seems to work #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiEdit.au3> #include <Misc.au3> ;for _IsPressed() #include <WindowsConstants.au3> AutoItSetOption("MustDeclareVars", 1) Func _WindowControlOperations() ;called by user program and only continues below if Alt+W pressed else returns to calling program above If NOT ( ((_IsPressed("12") = 1) AND (_IsPressed("57") = 1)) ) Then ;check for Alt+W ;12 ALT key, 57 W key ; default DLL=user32.dll Return(0) ;as Alt+W not pressed Else ;Alt+W pressed to call rest _WindowControlOperationsContinue() EndIf EndFunc ;Func _WindowControlOperations() Func _WindowControlOperationsContinue() ;Alt+W was pressed Global $aWindowControlLog[1][3] = [ ["Window/Control", "Title", "Left, Top, Width, Height"] ] ;element [0] [Row][Column] ;v2a - create an Instructions window Global $iLeft = 0, $iTop = 0, $iWidth = 0, $iHeight = 0 ;init values Global $sStatus = "$iLeft, $iTop, $iWidth, $iHeight" &@CRLF& $iLeft &", "& $iTop &", "& $iWidth &", "& $iHeight ;create main Instructions window Global $hWndInstructions = GUICreate("Instructions", 300, 457) ;the main instructions window Local $sInstructions = "Click List All to list all adjustments made." &@CRLF& _ " " &@CRLF& _ "Click upper right X to exit program." ;create an edit control - into which we'll put the instruction text Local $cIDInstructions = GUICtrlCreateEdit("", 10, 10, 280, 300, Bitor($ES_WANTRETURN, $WS_VSCROLL, $ES_AUTOVSCROLL)) ;no , $WS_HSCROLL)) Global $sStatus = "$iLeft, $iTop, $iWidth, $iHeight" &@CRLF& $iLeft &", "& $iTop &", "& $iWidth &", "& $iHeight Global $hStatus = _GUICtrlEdit_Create($hWndInstructions, $sStatus, 10, 318, 280, 50) Global $idButton_List = GUICtrlCreateButton("List All" &@CRLF& "Sizes/Positions", 152, 412, 139, 35, 0x2000) ;create control button ,0x2000=multi-line GUISetState(@SW_SHOW, $hWndInstructions) ;show window and edit controls ControlSetText("", "", $cIDInstructions, $sInstructions) ;show instructions ControlSetText("", "", $hStatus, $sStatus) ;show status _While1() ;enter our message loop Return(0) ;to main calling program EndFunc ;Func _WindowControlOperationsContinue() Func _While1() Local $nMsg While 1 ;look for button presses $nMsg = GUIGetMsg() If $nMsg <> 0 Then ;we have a message so Switch $nMsg ;Check for GUI events Case $GUI_EVENT_CLOSE ;the GUI is closed red [X] is clicked GUIDelete($hWndInstructions) ;destroy the Instructions window and all controls therein Return(0) ;to Func _WindowControlOperationsContinue() Case $idButton_List _DebugArrayDisplay($aWindowControlLog, "$aWindowControlLog") ;<-- problem here with #include <Debug.au3> scope Case Else ;do nothing EndSwitch ;End running through GUI events. Else ;no message - do nothing ;no message EndIf WEnd ;While 1 EndFunc ;Func _While1()
×
×
  • Create New...