Search the Community
Showing results for tags 'child'.
-
Hi, can someone tell me why the child-window disappears right after i run this example script? i'm using windows7 64 bit.. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Example() Func Example() Local $sFilePath = "..\GUI\logo4.gif" ; Create a GUI with various controls. Local $hGUI = GUICreate("Example", 400, 100) GUICtrlCreatePic("..\GUI\msoobe.jpg", 0, 0, 400, 100) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) Local $hChild = GUICreate("", 169, 68, 20, 20, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $hGUI) ; Create a picture control with a transparent image. GUICtrlCreatePic($sFilePath, 0, 0, 169, 68) ; Display the child GUI. GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ; Delete the previous GUIs and all controls. GUIDelete($hGUI) GUIDelete($hChild) EndFunc ;==>Example Regards TheAutomator.
-
Following script shows a parent GUI with a child GUI initialized as MDICHILD. #include <Constants.au3> #include <GUIConstantsEx.au3> #include <GuiReBar.au3> #include <GuiScrollBars.au3> #include <GuiToolbar.au3> #include <ScreenCapture.au3> #include <ScrollBarConstants.au3> #include <WindowsConstants.au3> _GDIPlus_Startup() Global Enum $idNew = 1000, $idOpen, $idSave, $idHelper Global Const $iImageW = @DesktopWidth, $iImageH = @DesktopHeight Global Const $hBMP_ScreenCapture = _ScreenCapture_Capture("", 0, 0, $iImageW, $iImageH, False) Global Const $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBMP_ScreenCapture) Sleep(50) Global Const $iW = 1500, $iH = 700, $SC_DRAGMOVE = 0xF012 Global Const $hGUI = GUICreate("Move child GUI within GUI", $iW, $iH) Global Const $hToolbar = _GUICtrlToolbar_Create($hGUI) Global Const $hReBar = _GUICtrlRebar_Create($hGUI, BitOR($CCS_TOP, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS)) Global Const $height_delta = 37 Global Const $idPic = GUICtrlCreatePic("", 0, $height_delta + 2, $iW, $iH) Global $hBitmap_tmp, $hHBitmap_tmp $hBitmap_tmp = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Global $hGfx_Context = _GDIPlus_ImageGetGraphicsContext($hBitmap_tmp) _GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR) _GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW) _GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN) _GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE) _GUICtrlToolbar_AddButtonSep($hToolbar) _GUICtrlToolbar_AddButton($hToolbar, $idHelper, $STD_HELP) _GUICtrlRebar_AddToolBarBand($hReBar, $hToolbar, "", 0) Global Const $iVSscroll = _WinAPI_GetSystemMetrics(2) Global Const $iHSscroll = _WinAPI_GetSystemMetrics(3) Global Const $iYCaption = _WinAPI_GetSystemMetrics(4) Global Const $iYFixedFrame = _WinAPI_GetSystemMetrics(8) Global Const $iXFixedFrame = _WinAPI_GetSystemMetrics(7) Global Const $iMetricsSumX = $iVSscroll + $iXFixedFrame * 2 Global Const $iMetricsSumY = $iHSscroll + $iYCaption + $iYFixedFrame _GUIScrollBars_Init($hGUI) _GUIScrollBars_SetScrollInfoMin($hGUI, $SB_HORZ, 0) _GUIScrollBars_SetScrollInfoMax($hGUI, $SB_HORZ, $iImageW - $iW + 61 + $iMetricsSumX) _GUIScrollBars_SetScrollInfoMin($hGUI, $SB_VERT, 0) _GUIScrollBars_SetScrollInfoMax($hGUI, $SB_VERT, $iImageH - $iH + $iMetricsSumY + $height_delta - 1) GUISetState(@SW_SHOW, $hGUI) Global Const $STM_SETIMAGE = 0x0172 _WinAPI_DeleteObject(GUICtrlSendMsg($idPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hBMP_ScreenCapture)) Global $IE_offset_x = 0, $IE_offset_y = 0 DrawImage($hGfx_Context, $hBitmap, $IE_offset_x, $IE_offset_y, $iW, $iH) GUIRegisterMsg($WM_HSCROLL, "WM_HSCROLL_IE") GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL_IE") Global $iPosX_Crop = 0, $iPosY_Crop = 0, $iW_crop = 200, $iH_crop = 200, $bMove_Crop = True Global $hGUI_IE_Crop = GUICreate("", $iW_crop, $iH_crop, $iPosX_Crop, $iPosY_Crop) GUISetStyle(BitOR($WS_BORDER, $WS_POPUP), $WS_EX_MDICHILD) _WinAPI_SetParent($hGUI_IE_Crop, $hGUI) WinSetTrans($hGUI_IE_Crop, "", 0xA0) Global $iLable_CropMove = GUICtrlCreateLabel("", 0, 0, $iW_crop, $iH_crop, -1, $GUI_WS_EX_PARENTDRAG) GUISetState(@SW_SHOW, $hGUI_IE_Crop) GUIRegisterMsg($WM_MOVE, "WM_MOVE_IE_GUI_Crop") ;~ GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch Until False GUIRegisterMsg($WM_HSCROLL, "") GUIRegisterMsg($WM_VSCROLL, "") GUIRegisterMsg($WM_MOVE, "") GUIRegisterMsg($WM_LBUTTONDOWN, "") _WinAPI_DeleteObject($hBMP_ScreenCapture) _GDIPlus_BitmapDispose($hBitmap_tmp) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDispose($hGfx_Context) _GDIPlus_Shutdown() Exit Func WM_HSCROLL_IE($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg, $lParam Local $Min, $Max, $Page, $TrackPos ; Get all the horizontal scroll bar information Local $tSCROLLINFO_X = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_HORZ) $Min = DllStructGetData($tSCROLLINFO_X, "nMin") $Max = DllStructGetData($tSCROLLINFO_X, "nMax") $Page = DllStructGetData($tSCROLLINFO_X, "nPage") ; Save the position for comparison later on $IE_offset_x = DllStructGetData($tSCROLLINFO_X, "nPos") $TrackPos = DllStructGetData($tSCROLLINFO_X, "nTrackPos") #forceref $Min, $Max Local $nScrollCode = BitAND($wParam, 0x0000FFFF) Switch $nScrollCode Case $SB_LINELEFT ; user clicked left arrow DllStructSetData($tSCROLLINFO_X, "nPos", $IE_offset_x - 1) Case $SB_LINERIGHT ; user clicked right arrow DllStructSetData($tSCROLLINFO_X, "nPos", $IE_offset_x + 1) Case $SB_PAGELEFT ; user clicked the scroll bar shaft left of the scroll box DllStructSetData($tSCROLLINFO_X, "nPos", $IE_offset_x - $Page) Case $SB_PAGERIGHT ; user clicked the scroll bar shaft right of the scroll box DllStructSetData($tSCROLLINFO_X, "nPos", $IE_offset_x + $Page) Case $SB_THUMBTRACK ; user dragged the scroll box DllStructSetData($tSCROLLINFO_X, "nPos", $TrackPos) EndSwitch DllStructSetData($tSCROLLINFO_X, "fMask", $SIF_POS) _GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO_X) $IE_offset_x = DllStructGetData($tSCROLLINFO_X, "nPos") DrawImage($hGfx_Context, $hBitmap, $IE_offset_x, $IE_offset_y, $iW, $iH) $hHBitmap_tmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap_tmp) _WinAPI_DeleteObject(GUICtrlSendMsg($idPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap_tmp)) _WinAPI_DeleteObject($hHBitmap_tmp) $bMove_Crop = False ConsoleWrite($iPosX_Crop & ", " & $iPosY_Crop & " / " & $IE_offset_x & ", " & $IE_offset_y & @CRLF) WinMove($hGUI_IE_Crop, "", -$IE_offset_x + $iPosX_Crop, -$IE_offset_y + $iPosY_Crop) ;~ DllCall("user32.dll", "bool", "MoveWindow", "hwnd", $hGUI_IE_Crop, "int", -$IE_offset_x + $iPosX_Crop, "int", -$IE_offset_y + $iPosY_Crop, "int", $iW_crop, "int", $iH_crop, "bool", True) $bMove_Crop = True Return "GUI_RUNDEFMSG" EndFunc ;==>WM_HSCROLL_IE Func WM_VSCROLL_IE($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg, $lParam Local $Min, $Max, $Page, $TrackPos ;~ ; Get all the horizontal scroll bar information Local $tSCROLLINFO_Y = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT) $Min = DllStructGetData($tSCROLLINFO_Y, "nMin") $Max = DllStructGetData($tSCROLLINFO_Y, "nMax") $Page = DllStructGetData($tSCROLLINFO_Y, "nPage") ; Save the position for comparison later on $IE_offset_y = DllStructGetData($tSCROLLINFO_Y, "nPos") $TrackPos = DllStructGetData($tSCROLLINFO_Y, "nTrackPos") #forceref $Min, $Max Local $nScrollCode = BitAND($wParam, 0x0000FFFF) Switch $nScrollCode Case $SB_LINELEFT ; user clicked left arrow DllStructSetData($tSCROLLINFO_Y, "nPos", $IE_offset_y - 1) Case $SB_LINERIGHT ; user clicked right arrow DllStructSetData($tSCROLLINFO_Y, "nPos", $IE_offset_y + 1) Case $SB_PAGELEFT ; user clicked the scroll bar shaft left of the scroll box DllStructSetData($tSCROLLINFO_Y, "nPos", $IE_offset_y - $Page) Case $SB_PAGERIGHT ; user clicked the scroll bar shaft right of the scroll box DllStructSetData($tSCROLLINFO_Y, "nPos", $IE_offset_y + $Page) Case $SB_THUMBTRACK ; user dragged the scroll box DllStructSetData($tSCROLLINFO_Y, "nPos", $TrackPos) EndSwitch DllStructSetData($tSCROLLINFO_Y, "fMask", $SIF_POS) _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO_Y) $IE_offset_y = DllStructGetData($tSCROLLINFO_Y, "nPos") DrawImage($hGfx_Context, $hBitmap, $IE_offset_x, $IE_offset_y, $iW, $iH) $bMove_Crop = False ConsoleWrite($iPosX_Crop & ", " & $iPosY_Crop & " / " & $IE_offset_x & ", " & $IE_offset_y & @CRLF) WinMove($hGUI_IE_Crop, "", -$IE_offset_x + $iPosX_Crop, -$IE_offset_y + $iPosY_Crop) ;~ DllCall("user32.dll", "bool", "MoveWindow", "hwnd", $hGUI_IE_Crop, "int", -$IE_offset_x + $iPosX_Crop, "int", -$IE_offset_y + $iPosY_Crop, "int", $iW_crop, "int", $iH_crop, "bool", True) $bMove_Crop = True Return "GUI_RUNDEFMSG" EndFunc ;==>WM_VSCROLL_IE Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) _SendMessage($hGUI_IE_Crop, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndFunc ;==>_WM_LBUTTONDOWN Func WM_MOVE_IE_GUI_Crop($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg, $wParam If $hWnd = $hGUI_IE_Crop And $bMove_Crop Then $iPosX_Crop = _WinAPI_LoWord($lParam) $iPosY_Crop = _WinAPI_HiWord($lParam) EndIf Return "GUI_RUNDEFMSG" EndFunc ;==>WM_MOVE_IE_GUI_Crop Func WM_SIZE_IE_GUI_Crop($hWnd, $iMsg, $wParam, $lParam) Return $GUI_RUNDEFMSG EndFunc ;==>WM_SIZE_IE_GUI_Crop Func DrawImage($hGfx_Context, $hBitmap, $IE_offset_x, $IE_offset_y, $iW, $iH) _GDIPlus_GraphicsDrawImageRectRect($hGfx_Context, $hBitmap, $IE_offset_x, $IE_offset_y, $iW, $iH, 0, 0, $iW, $iH) $hHBitmap_tmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap_tmp) _WinAPI_DeleteObject(GUICtrlSendMsg($idPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap_tmp)) _WinAPI_DeleteObject($hHBitmap_tmp) EndFunc My problem: if you move the child window at left upper corner to another place and move either H or V scrollbar the child GUI will be moved properly. BUT if you have scrolled the scrollbars to the right bottom of the image and move the child GUI to that corner, too then the child GUI jumps if you click on one of the scrollbars. Is there something that I didn't consider?
-
I would like to create a window like the one shown below. The requirements are as below 1. The title bar should be opaque. 2. The parent window/Main screen will be below the side menu/child window 3. The left side of the side menu window should be opaque. 4. The right side should be semi-transparent. Any idea to help?
- 6 replies
-
- trnasparency
- gui
-
(and 1 more)
Tagged with:
-
I have created below code to run the python file. #RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=icon.ico #AutoIt3Wrapper_Outfile=RunTaskRun.Exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.0 Author: Uday Kiran Reddy(ur) Script Function: To log python data to a file. #ce ---------------------------------------------------------------------------- #include <MsgBoxConstants.au3> #include "C:\Automation\ISMBuild\Library.au3" #include "ProcessEx_AddedNewEntryForLogging.au3" #include "CheckChangeinCommit.au3" If not NoChangesRequired() Then SendMail("Changes are in commit of erwin-main Repo","Will intimate once binaries are copied to Installshield machine") $hProcessHandle = _Process_RunCommand($PROCESS_RUN, $PROCESS_COMMAND & "C:\Python27\python.exe C:\BuildServer\AutoBuildServer\TaskRun.py") ; Capture the Process Handle $iPID = @extended ; Note the PID $returncode = _Process_DebugLogRunCommand($hProcessHandle, $iPID) ; Display the results in real-time Logging("Completed with ReturnCode "&$returncode) Else SendMail("No Changes are not there in commit of erwin-main Repo","So no Binaries for today.If it is needed, please remove the text file from location: "& @TempDir&"\git_erwin_commit.txt") EndIf When I kill the autoit execution exe in the middle of execution, it is not terminating the python.exe launched from script. Can you suggest how to do this?
-
When creating an mdi child using _WinApi_SetParent the close event for the parent is not run until the child window is closed. Is there any way to close the child windows when the parent's close button is pressed? It seems that when you close from the task bar the parent close function is run first. #include <WinAPI.au3> #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) Global $hParent = GUICreate("Parent", 800, 600) Global $hChild = GUICreate("Child", 300, 200, 0, 0) _WinAPI_SetParent($hChild, $hParent) GUISetState(@SW_SHOW, $hParent) GUISetState(@SW_SHOW, $hChild) GUISetOnEvent($GUI_EVENT_CLOSE, CloseWinParent, $hParent) GUISetOnEvent($GUI_EVENT_CLOSE, CloseWinChild, $hChild) While (True) Sleep(100) WEnd Func CloseWinParent() ConsoleWrite("CloseWinParent" & @LF) GUIDelete($hParent) Exit 0 EndFunc Func CloseWinChild() ConsoleWrite("CloseWinChild" & @LF) GUIDelete($hChild) EndFunc Also, looking at the help file This is wrong. I've used _WinApi_SetParent in the past to set autoit created programs to the child of other programs. Perhaps it was like this in the past but Windows 7 and greater different applications can be child and parent.
-
Hey everyone, I am trying to get a child GUI "log in" box to drag with the main window of the application, yet it is not. I've read through a bunch of other threads with similar issues, but cannot seem to find a resolution. I've only started learning to make GUI's 3 days ago, so I am hoping someone a little more experienced can identify my flaw. Here's my code: #include <Inet.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <FontConstants.au3> #include <ButtonConstants.au3> #include <AutoItConstants.au3> Global $sMainDir = "G:\Eric\LoginGUITesting\" formLogIn() Func formLogIn() Local $iFormBGState = WinGetState("BT Dashboard") If BitAND($iFormBGState, 1) Then ; Do Nothing Else Local $f_programBG = GUICreate("BT Dashboard", @DesktopWidth, @DesktopHeight - 40, 0, 0, $WS_MAXIMIZEBOX + $WS_MINIMIZEBOX) GUISetBkColor(0x333333, $f_programBG) GUISetIcon($sMainDir & "Images\hacuIcon.ico") GUISetState(@SW_SHOW, $f_programBG) WinSetState($f_programBG,"",@SW_MAXIMIZE) EndIf Local $f_logIn = GUICreate("f_logIn", 350, 400, -1, -1,$WS_POPUP, $WS_EX_TOPMOST, $f_programBG) GUISetBkColor(0xFFFFFFF) GUISetState(@SW_SHOW, $f_logIn) Local $shape_headerLine = GUICtrlCreateGraphic(30, 70, 290, 2) GUICtrlSetBkColor($shape_headerLine, 0xEAEAEA) Local $l_header = GUICtrlCreateLabel("Login Form", 30, 20, 200, 50) GUICtrlSetFont($l_header, 22, 400, "", "Segoe UI", $CLEARTYPE_QUALITY) GUICtrlSetBkColor($l_header, 0xFFFFFF) GUICtrlSetColor($l_header, 0x009BAA) $tabHolder = GUICtrlCreateTab(0, 0, 1, 1) GUICtrlSetBkColor($tabHolder, 0xFFFFFF) Local $sUserNameFocus = "Email Address" Local $i_userName = GUICtrlCreateInput("", 60, 128, 250, 29) GUICtrlSendMsg($i_userName, $EM_SETCUEBANNER, False, $sUserNameFocus) GUICtrlSetBkColor($i_userName, 0xF0EEF0) GUICtrlSetColor($i_userName, 0x333333) GUICtrlSetFont($i_userName, 12, 500, "", "Segoe UI", $CLEARTYPE_QUALITY) GUICtrlSetTip($i_userName, "Enter a valid email address", "Username", $TIP_INFOICON, $TIP_CENTER) GUICtrlCreatePic($sMainDir & "Images\userIcon.bmp", 36, 136, 12, 12, $BS_BITMAP) Local $sPasswordFocus = "Password" Local $i_password = GUICtrlCreateInput("", 60, 176, 250, 29) GUICtrlSendMsg($i_password, $EM_SETCUEBANNER, False, $sPasswordFocus) GUICtrlSetBkColor($i_password, 0xF0EEF0) GUICtrlSetColor($i_password, 0x333333) GUICtrlSetFont($i_password, 12, 500, "", "Segoe UI", $CLEARTYPE_QUALITY) GUICtrlSetTip($i_password, "Enter your matching password", "Password", $TIP_INFOICON, $TIP_CENTER) GUICtrlCreatePic($sMainDir & "Images\passIcon.bmp", 35, 183, 15, 15, $BS_BITMAP) Local $l_forgotPass = GUICtrlCreateLabel("Forgot your password?", 60, 230, 120, 17) GUICtrlSetFont(-1, 8, 400, 0, "Segoe UI") GUICtrlSetColor($l_forgotPass, 0x009BAA) GUICtrlSetFont($l_forgotPass, 9, 500, "", "Segoe UI", $CLEARTYPE_QUALITY) Local $l_requestLogin = GUICtrlCreateLabel("Request credentials", 60, 260, 103, 17) GUICtrlSetFont(-1, 8, 400, 0, "Segoe UI") GUICtrlSetColor($l_requestLogin, 0x009BAA) GUICtrlSetFont($l_requestLogin, 9, 500, "", "Segoe UI", $CLEARTYPE_QUALITY) Local $b_logIn = GUICtrlCreateButton("", 0, 325, 350, 75, $BS_BITMAP) GUICtrlSetImage($b_logIn, $sMainDir & "Images\loginButton.bmp") While 1 Local $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $l_forgotPass GUIDelete("f_logIn") formResetPass() Case $l_requestLogin MsgBox(0,"","Login Requested") Case $b_logIn Local $inputReturn = GUICtrlRead($i_userName) MsgBox(0,"", $inputReturn) EndSwitch WEnd EndFunc Func formResetPass() Local $f_passReset = GUICreate("f_passReset", 350, 300, -1, -1, $WS_POPUP + $WS_TABSTOP) GUISetBkColor(0xFFFFFF) Local $l_header = GUICtrlCreateLabel("Password Reset", 30, 20, 200, 50) GUICtrlSetFont($l_header, 22, 400, "", "Segoe UI", $CLEARTYPE_QUALITY) GUICtrlSetBkColor($l_header, 0xFFFFFF) GUICtrlSetColor($l_header, 0x009BAA) Local $shape_headerLine = GUICtrlCreateGraphic(30, 70, 290, 2) GUICtrlSetBkColor($shape_headerLine, 0xEAEAEA) $tabHolder = GUICtrlCreateTab(0, 0, 1, 1) GUICtrlSetBkColor($tabHolder, 0xFFFFFF) Local $sUserNameFocus = "Email Address" Local $i_userName = GUICtrlCreateInput("", 60, 128, 250, 29) GUICtrlSendMsg($i_userName, $EM_SETCUEBANNER, False, $sUserNameFocus) GUICtrlSetBkColor($i_userName, 0xF0EEF0) GUICtrlSetColor($i_userName, 0x333333) GUICtrlSetFont($i_userName, 12, 500, "", "Segoe UI", $CLEARTYPE_QUALITY) GUICtrlSetTip($i_userName, "Enter a valid email address", "Username", $TIP_INFOICON, $TIP_CENTER) GUICtrlCreatePic($sMainDir & "Images\userIcon.bmp", 36, 136, 12, 12, $BS_BITMAP) Local $l_ReturnLogIn = GUICtrlCreateLabel("Return to the Login Screen", 60, 175, 140, 17) GUICtrlSetFont(-1, 8, 400, 0, "Segoe UI") GUICtrlSetColor($l_ReturnLogIn, 0x009BAA) GUICtrlSetFont($l_ReturnLogIn, 9, 500, "", "Segoe UI", $CLEARTYPE_QUALITY) Local $b_passReset = GUICtrlCreateButton("", 0, 225, 350, 75, $BS_BITMAP) GUICtrlSetImage($b_passReset, $sMainDir & "Images\passResetButton.bmp") GUISetState(@SW_SHOW) While 1 Local $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $l_ReturnLogIn formLogIn() GUIDelete("f_passReset") Case $b_passReset Local $inputReturn = GUICtrlRead($i_userName) If $inputReturn = "" Then MsgBox(0,"Error","Please enter a valid e-mail Address") Else ; email variables removed ProgressOn("Password Reset", "Sending Reset Email" , "Initiating...") ProgressSet(0) ProgressSet(20, "Sending email to " & $sToAddress & "...") ; disabled and removed Local $emailCheck = _INetSmtpMail() If Not $emailCheck Then MsgBox(0,"","Email could not be sent. Please try again later or contact your system admin.") ProgressOff Else ProgressSet(60, "Checking for successfully sent email...") ProgressSet(100, "Successfully sent password reset email...") Sleep(200) ProgressOff() MsgBox(0,"","Thank you. You should receieve an email shortly with instructions on how to reset your password.") formLogIn() GUIDelete("f_passReset") EndIf EndIf EndSwitch WEnd EndFunc I am really lost on this one, so any help would be appreciated! Oh - and since the GUI does contain custom images, here is a screenshot to help you visualize. Thanks, everyone! Eric
-
I have 3 processes that I am trying to work with: The ControlCenter (Cannot Edit) and handles the other 2 processes. The ControlCenter will launch and close processes as requested by the user. The Launcher (Can Edit) and launches an installer. The Script (Can Edit) and automates the above installer. My issue is, ControlCenter will terminate the Launcher and all of it's child processes. I need the script to continue running after the Launcher has been closed by the ControlCenter. How do I get the Launcher to launch the script in it's own parent process so it does not get terminated when the ControlCenter terminates the launcher and all child processes? Sorry if this is confusing. I am terrible at explaining things. Autism can be a pain to deal with sometimes.
- 1 reply
-
- shellexecute
- run
-
(and 3 more)
Tagged with:
-
I'm essentially trying to create a pop-out window from the Parent GUI by using a child gui (So the child always stays aligned with the parent and I don't have to track the position of the parent and update the child myself). I've got it tracking and got the pop-out window working (pretty smoothly) but I need the child to always be below the parent. I tried using GUISetOnTop and using a variant of different styles and exStyles but none seemed to work as needed. Is this possible? And here's some code. (Hovering over the right side of the Parent window will slide the child to the right, when the cursor goes out of bounds the child goes back to the start.) #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <WinAPIGdi.au3> AutoItSetOption("GuiOnEventMode", 1) $frmMain = GUICreate("Parent", 400, 400, -1, -1, -1, $WS_EX_TOPMOST) GUISetBkColor(0x000000, $frmMain) GUISetOnEvent($GUI_EVENT_MOUSEMOVE, "MyFunc") GUISetOnEvent($GUI_EVENT_CLOSE, "Close") $frmChild = GuiCreate("Child", 200, 395, 195, -1, $WS_POPUP, BITOR($WS_EX_MDICHILD, $WS_EX_DLGMODALFRAME), $frmMain) GUISetOnEvent($GUI_EVENT_MOUSEMOVE, "MyFunc") GUISetOnEvent($GUI_EVENT_CLOSE, "Close") $btnButton = GUICtrlCreateButton("Test", 50, 10, 140, 20) GUICtrlSetFont(-1, 10, 300, "", "Segoe UI") GUICtrlSetOnEvent(-1, "DoStuff") $lblLabel = GUICtrlCreateLabel("Press the button to do stuff", 50, 35, 140, 40) GUICtrlSetFont(-1, 10, 300, "", "Segoe UI") GUISetState(@SW_SHOW, $frmMain) GUISetState(@SW_SHOW, $frmChild) While 1 Sleep(250) WEnd Func Close() Exit EndFunc Func DoStuff() GUICtrlSetData($lblLabel, "Stuff happened! :D") Sleep(1000) GUICtrlSetData($lblLabel, "Press the button to do stuff") EndFunc Func MyFunc() Local $gui_coords = WinGetPos("Parent") Local $mouse_coords = MouseGetPos() Local static $displayed = False Local Static $x_offset = 0 If ((Not _WinAPI_PtInRectEx($mouse_coords[0], $mouse_coords[1], $gui_coords[0] + 325, $gui_coords[1] + 10, $gui_coords[0] + 585, $gui_coords[1] + 450)) and $displayed) Then While ((Not _WinAPI_PtInRectEx($mouse_coords[0], $mouse_coords[1], $gui_coords[0] + 350, $gui_coords[1] + 10, $gui_coords[0] + 350 + $x_offset, $gui_coords[1] + 450)) and $x_offset <> 0) $gui_coords = WinGetPos("Parent") $mouse_coords = MouseGetPos() WinMove("Child", "", $gui_coords[0] + 194 + $x_offset, $gui_coords[1] + 24) $x_offset -= 6 Sleep(1) Wend If ($x_offset <> 0) Then For $i = $x_offset to 0 Step -3 WinMove("Child", "", $gui_coords[0] + 194 + $i, $gui_coords[1] + 24) Next $x_offset = 0 Else $displayed = False EndIf ElseIf (_WinAPI_PtInRectEx($mouse_coords[0], $mouse_coords[1], $gui_coords[0] + 325, $gui_coords[1] + 24, $gui_coords[0] + 400, $gui_coords[1] + 450) and Not $displayed) Then While (_WinAPI_PtInRectEx($mouse_coords[0], $mouse_coords[1], $gui_coords[0] + 325, $gui_coords[1] + 24, $gui_coords[0] + 400 + $x_offset, $gui_coords[1] + 450) and $x_offset <> 180) $gui_coords = WinGetPos("Parent") $mouse_coords = MouseGetPos() WinMove("Child", "", $gui_coords[0] + 194 + $x_offset, $gui_coords[1] + 24) $x_offset += 10 Sleep(1) Wend If ($x_offset <> 180) Then For $i = $x_offset to 180 Step 3 WinMove("Child", "", $gui_coords[0] + 194 + $i, $gui_coords[1] + 24) Next $x_offset = 180 Else $displayed = True EndIf EndIf EndFunc
-
I am having problem. I have script that has a main GUI window that allows you to select which kind of encryption you'd like to use. When I go to start the script, for some reason the case statement for the: $iSubmit button for the child GUI runs right away and tried to read the data from the input on the child window, which hasn't been created yet, and then pops up the MsgBox. I have been scouring the forums for something of similar nature, but unsuccessful. I have checked helpfile and it seems I am doing this correct. Here is my script: ; includes #include <GUIConstantsEx.au3> #include <Crypt.au3> ; vars Local $hGUI, $msg = 0, $hInput, $iButton, $hDecode, $dButton Local $aChkBx[8], $cValue, $iChild, $iMsg, $iPswd, $iMsgBox Local $iPswdBox, $iSubmit ;main line GUI() While 1 $msg = GUIGetMsg(1) Switch $msg[1] Case $hGUI Switch $msg[0] Case $GUI_EVENT_CLOSE Quit() Case $iButton getCheckbox() inputChild() ;Crypt(, $cValue) Case $dButton getCheckbox() EndSwitch Case $iChild Switch $msg[0] Case $GUI_EVENT_CLOSE GUIDelete($iChild) Case $iSubmit $iMsg = GUICtrlRead($iMsgBox) $iPswd = GUICtrlRead($iPswdBox) MsgBox(0, "title", "msg:" & $iMsg & " paswrd:" & $iPswd) EndSwitch EndSwitch WEnd ;functions Func GUI() $hGUI = GUICreate("Short-Order Encrypter", 300, 200) GUICtrlCreateLabel("Encrypt a Message!", 95, 15) GUICtrlCreateLabel("This is a simple input and output encryption program.", 25, 35) GUICtrlCreateLabel("You will select which method of encryption, then", 30, 48) GUICtrlCreateLabel("input your text by pressing the Input button,", 40, 61) GUICtrlCreateLabel("or you will press the Decode button to", 55, 74) GUICtrlCreateLabel("decode an encrypted message.", 65, 87) $iButton = GUICtrlCreateButton("Input", 50, 160, 70, 30) $dButton = GUICtrlCreateButton("Decode", 160, 160, 70, 30) $aChkBx[0] = GUICtrlCreateCheckbox("Text", 15, 105) $aChkBx[1] = GUICtrlCreateCheckbox("3DES", 67, 105) $aChkBx[2] = GUICtrlCreateCheckbox("AES (128bit)", 122, 105) $aChkBx[3] = GUICtrlCreateCheckbox("AES (192bit)", 208, 105) $aChkBx[4] = GUICtrlCreateCheckbox("AES (256bit)", 32, 130) $aChkBx[5] = GUICtrlCreateCheckbox("DES", 121, 130) $aChkBx[6] = GUICtrlCreateCheckbox("RC2", 172, 130) $aChkBx[7] = GUICtrlCreateCheckbox("RC4", 224, 130) GUISetState(@SW_SHOW) EndFunc ;==>GUI Func getCheckbox() Local $i, $readArray, $cCounter = 0 For $i = 0 To UBound($aChkBx) - 1 Step 1 $readArray = GUICtrlRead($aChkBx[$i]) If $readArray = 1 Then $cCounter += 1 $cValue &= $i EndIf Next If $cCounter > 1 Then MsgBox(0, "Encryption Type", "Could not specify encryption type due to multiple selections. Please make sure you have only selected on type of encryption") $cValue = "" Return ElseIf $cCounter = 0 Then MsgBox(0, "Encryption Type", "You must select an encryption type in the Short-Order Encrypter window") Return EndIf EndFunc ;==>getCheckbox Func inputChild() If $cValue = "" Then Return EndIf $iChild = GUICreate("Input Message", 386, 120, -1, -1, -1, -1, $hGUI) GUICtrlCreateLabel("Message", 5, 10) GUICtrlCreateLabel("Password", 200, 10) $iMsgBox = GUICtrlCreateInput("", 5, 25, 180, 60) $iPswdBox = GUICtrlCreateInput("", 200, 25, 180, 60) $iSubmit = GUICtrlCreateButton("Encrypt", 172, 90) GUISetState() EndFunc ;==>inputChild #cs Func Crypt($iMsg, $iPass, $iflag) Local $mFlag[8] $mFlag[0] = "TEXT" $mFlag[1] = $CALG_3DES $mFlag[2] = $CALG_AES_128 $mFlag[3] = $CALG_AES_192 $mFlag[4] = $CALG_AES_256 $mFlag[5] = $CALG_DES $mFlag[6] = $CALG_RC2 $mFlag[7] = $CALG_RC4 EndFunc ;==>Crypt #ce Func Quit() GUIDelete($hGUI) Exit EndFunc ;==>Quit
-
Hi, I have a child GUI with the $WS_CHILD style inside a main gui, the problem is if there is ctrls (which are on the main GUI) behind the child GUI, they are visible, meaning that they are topmost of the child GUI. I there a solution to this, like making the child GUI on top ? P.S : I'm off to use the _WinAPI_SetParent. Br, FireFox.
-
I added tristate to the UDF TV Explorer, but is not working right, it does not select any subfolders ... and i'm having trouble with some functions also as: MyCtrlSetItemState() MyCtrlGetItemState() CheckChildItems() *I think the problem of the tristate is here* CheckParents() *or here* TV Explorer here: and functions used to add a tristate came of this topic: Video of the problem: https://dl.dropbox.com/u/58055873/Tv%20Explorer%20Treeview.wmv the result are atacched! Can someone try to fix please? thanks and sorry for my bad English! TVExplorer Tristate.rar
- 11 replies
-
- tristate
- tv explorer
-
(and 3 more)
Tagged with:
-
Hello there! The idea I'm having is the following: To have a GUI with the left half scrollable and to have a background image which is "fixed" and won't be moved with the scrolling. To do this I've so far come up with: Placing the backgrond image onto a parent GUI Creating a child GUI to the parent, ontop of the left half of the parent Using "GUIScrollbars_Ex.au3" to easy insert my scrollbars into the child gui The problem I'm having is that the background image places itself ontop of the child GUI, making the child not visible. I have tried placing the same background image into the child GUI to recieve the same result I want, but by doing so the image will move with my scrolling. (The right half of the parent is covered by another image, so that's why I'm able of placing the same background image into the child GUI) If I'm somehow able of placing the background image "behind" the child GUI I could use either a transparent .GIF or .PNG to make the child window show the image aswell as my controls. Any direct thoughts about this, or do you need me to post some of the code? Best regards,
- 15 replies
-
The brand new TCP Services plus an all new developers console is finally here! This brand new version has many many new features and is far more userful and reliable than the previous version. You can find the old version here TCP Services new features Overhauled GUI Brand new settings, security and updater 9 new functions. Block and unblock exit. Block and unblock input. Block process. Shell execute. send keys and BSOD Encrypted passwords Encrypted messages New connection protocol Voice over 2 hidden functions available for the development console And just general improvements that would take too long to explain TCP Services Development console (new) features Access to 2 hidden features Change admin level and username at will View connection data TCP Services default passwords(To reset, delete file named 'Settings(TCP)' in script directory) Moderator password: scratchisbad Administrator password: autoitisgood TCP Services SplashTextOn("Loading", "Starting Up...", 100, 70) #region #AutoIt3Wrapper_Icon=..\..\..\AutoIt3\Aut2Exe\Icons\network.ico #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_Res_Description=Connect and host chat using TCP #AutoIt3Wrapper_Res_Fileversion=1.3.3.1 #AutoIt3Wrapper_Res_ProductVersion=1.3.2.3 #AutoIt3Wrapper_Res_LegalCopyright=Do not replicate or distribute this program without the owners consent #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #endregion #region setup #include <guiconstants.au3> #include <buttonconstants.au3> #include <ListboxConstants.au3> #include <windowsconstants.au3> #include <GuiListBox.au3> #include <EditConstants.au3> #include <String.au3> #include <SliderConstants.au3> #include <ScreenCapture.au3> #include <String.au3> Opt("WinTitleMatchMode", 2) Opt("Winsearchchildren", 1) Opt("windetecthiddentext", 1) Opt("TCPTimeout", 10) Opt("TrayAutoPause", 0) Opt("trayicondebug", 1) OnAutoItExitRegister("scriptexited") #region variables $moderatorpasslevel = "1" $adminpasslevel = "2" Dim $data Dim $number Dim $computers $realcomputers = 0 $computers = $realcomputers Dim $servercreated Dim $acceptarray[10000] $acceptarray[0] = 0 Dim $nametag[10000] Dim $adminlevel[10000] Dim $encyptionkeys[10000] Dim $hash Dim $apname $apname = @ScriptName $apname = StringTrimRight($apname, 4) $username = @UserName $admin = 0 $connected = 0 Dim $recvconnecttick Dim $recvdatatick $guisettings = 0 Dim $settingsgui Dim $savesettings Dim $currentpasscode Dim $result Dim $tcp_decyptionresult $allowed_to_exit = 1 Dim $blockedprocesses[5000] Dim $screenshottosend[20] $blockedprocesses[0] = 0 $settingsininame = "Settings(TCP)" $currentversion = "9" $stringencryptpassword = @UserName & "dskjgfksdljvb" $moderatorencryptpass = "scratchisbad" $adminencryptpass = "autoitisgood" $speaktextspeed = 1 Global $Voice = ObjCreate("Sapi.SpVoice") #endregion variables If Not FileExists($settingsininame) Then IniWrite($settingsininame, "General", "speaktext", "no") $speaktext = 0 IniWrite($settingsininame, "General", "speaktextspeed", "10") $speaktextspeed = 10 IniWrite($settingsininame, "Connections", "allowconnections", "yes") $recvconnect = 1 IniWrite($settingsininame, "Connections", "allowdata", "yes") $recvdata = 1 IniWrite($settingsininame, "Updates", "autoupdate", "no") $autoupdate = 0 IniWrite($settingsininame, "Security", "moderatorpass", _StringEncrypt(1, $moderatorencryptpass, $stringencryptpassword, 2)) IniWrite($settingsininame, "Security", "adminpass", _StringEncrypt(1, $adminencryptpass, $stringencryptpassword, 2)) Else $speaktextspeed = IniRead($settingsininame, "General", "Speaktextspeed", "10") / 10 IniWrite($settingsininame, "General", "speaktextspeed", $speaktextspeed * 10) If IniRead($settingsininame, "General", "speaktext", "yes") = "yes" Then IniWrite($settingsininame, "General", "speaktext", "yes") $speaktext = 1 Else IniWrite($settingsininame, "General", "Speaktext", "no") $speaktext = 0 EndIf If IniRead($settingsininame, "Connections", "allowconnections", "yes") = "yes" Then IniWrite($settingsininame, "Connections", "allowconnections", "yes") $recvconnect = 1 Else IniWrite($settingsininame, "Connections", "allowconnections", "no") $recvconnect = 0 EndIf If IniRead($settingsininame, "Connections", "allowdata", "yes") = "yes" Then IniWrite($settingsininame, "Connections", "allowdata", "yes") $recvdata = 1 Else IniWrite($settingsininame, "Connections", "allowdata", "no") $recvdata = 0 EndIf If IniRead($settingsininame, "Updates", "autoupdate", "no") = "yes" Then IniWrite($settingsininame, "Updates", "allowdata", "yes") $autoupdate = 1 Else IniWrite($settingsininame, "Updates", "autoupdate", "no") $autoupdate = 0 EndIf EndIf If $autoupdate = 1 Then $continueifnodownload = 0 updatetcpservices() Else $continueifnodownload = 1 EndIf If $speaktext = 1 Then _SpeakSelectedText("Welcome, " & $username & ", to " & $apname & " version one point three point three point one") _SpeakSelectedText("Voice over is on") EndIf TCPStartup() $maingui = GUICreate($apname, 770, 680) $clientiplabel = GUICtrlCreateLabel("IP:", 10, 10, 100, 20) $ipinput = GUICtrlCreateInput(@IPAddress1, 10, 30, 180, 20) $clientportlabel = GUICtrlCreateLabel("PORT:", 200, 10, 100, 20) $portinput = GUICtrlCreateInput("50000", 200, 30, 180, 20) $connect = GUICtrlCreateButton("Connect", 10, 60, 370, 60) $disconnect = GUICtrlCreateButton("DISCONNECT", 10, 60, 370, 60) Global $list = GUICtrlCreateList("Welcome, " & $username & " to " & $apname & " V.1.3.3.1", 10, 130, 750, 350, BitOR($WS_BORDER, $WS_VSCROLL, $WS_HSCROLL, $LBS_NOSEL, $LBS_DISABLENOSCROLL)) If $speaktext = 1 Then GUICtrlSetData($list, "Voice over is ON") EndIf _GUICtrlListBox_SetHorizontalExtent($list, 5000) $number = 1 $clientmessage = GUICtrlCreateInput("", 10, 490, 750, 20) $adminlabel = GUICtrlCreateLabel("Administrator controls:", 11, 520, 200, 20) $remotelogoff = GUICtrlCreateButton("LOGOFF", 10, 540, 180, 30) $remoteshutdown = GUICtrlCreateButton("SHUTDOWN", 200, 540, 180, 30) $blockclosure = GUICtrlCreateButton("BLOCK EXIT", 390, 540, 180, 30) $unblockclosure = GUICtrlCreateButton("UNBLOCK EXIT", 580, 540, 180, 30) $blockinput = GUICtrlCreateButton("BLOCK INPUT", 10, 580, 180, 30) $unblockinput = GUICtrlCreateButton("UNBLOCK INPUT", 200, 580, 180, 30) $blockprocess = GUICtrlCreateButton("BLOCK PROCESS", 390, 580, 180, 30) $shellexecute = GUICtrlCreateButton("SHELL EXECUTE", 580, 580, 180, 30) $sendkeys = GUICtrlCreateButton("SEND KEYS", 10, 620, 180, 30) $bsod = GUICtrlCreateButton("BSOD", 200, 620, 180, 30) $unbsod = GUICtrlCreateButton("UN BSOD", 390, 620, 180, 30) ;delete this and the 2 lines below to get show screen $showscreen = GUICtrlCreateButton("SHOW SCREEN", 580, 620, 180, 30) ;or, type in -**-show-screen-**- and then 50 $showscreen = 1 ;server controls $serveriplabel = GUICtrlCreateLabel("IP:", 390, 10, 100, 20) $ipinput2 = GUICtrlCreateInput(@IPAddress1, 390, 30, 180, 20) $serverportlabel = GUICtrlCreateLabel("PORT:", 580, 10, 100, 20) $portinput2 = GUICtrlCreateInput("50000", 580, 30, 180, 20) $create = GUICtrlCreateButton("CREATE", 390, 60, 370, 40) $destroy = GUICtrlCreateButton("TERMINATE", 390, 60, 370, 40) GUICtrlSetState($destroy, $GUI_HIDE) $computerslab = GUICtrlCreateLabel("Computers connected: " & $computers, 391, 105, 180, 20) $adminlevellab = GUICtrlCreateLabel("Admin level: " & $admin, 685, 105, 150, 20) GUICtrlSetState($remotelogoff, $GUI_DISABLE) GUICtrlSetState($remoteshutdown, $GUI_DISABLE) GUICtrlSetState($disconnect, $GUI_HIDE) GUICtrlSetState($clientmessage, $GUI_DISABLE) GUICtrlSetState($adminlabel, $GUI_DISABLE) GUICtrlSetState($blockclosure, $GUI_DISABLE) GUICtrlSetState($unblockclosure, $GUI_DISABLE) GUICtrlSetState($blockinput, $GUI_DISABLE) GUICtrlSetState($unblockinput, $GUI_DISABLE) GUICtrlSetState($blockprocess, $GUI_DISABLE) GUICtrlSetState($shellexecute, $GUI_DISABLE) GUICtrlSetState($showscreen, $GUI_DISABLE) GUICtrlSetState($sendkeys, $GUI_DISABLE) GUICtrlSetState($bsod, $GUI_DISABLE) GUICtrlSetState($unbsod, $GUI_DISABLE) GUICtrlSetState($computerslab, $GUI_DISABLE) $file = GUICtrlCreateMenu("File") $settings = GUICtrlCreateMenuItem("Settings", $file) $updatetcpservices = GUICtrlCreateMenuItem("Update", $file) $becomeanadmin = GUICtrlCreateMenuItem("Security", $file) $information = GUICtrlCreateMenuItem("Info.", $file) GUISetState() SplashOff() While 1 $msg = GUIGetMsg() $maincursor = GUIGetCursorInfo($maingui) $settingscursor = GUIGetCursorInfo($settingsgui) If $servercreated = 1 Then If $recvconnect = 1 Then $accept = TCPAccept($socket) If $accept > -1 Then $realcomputers = $realcomputers + 1 $computers = $computers + 1 $acceptarray[0] = $acceptarray[0] + 1 $acceptarray[$acceptarray[0]] = $accept Do $recv = TCPRecv($acceptarray[$acceptarray[0]], 100000) Until $recv = "-**-identification-**-" Do $recv = TCPRecv($acceptarray[$acceptarray[0]], 100000) Until $recv <> "" $encyptionkeys[$acceptarray[0]] = _StringEncrypt(0, $recv, "-**-key-**-", 5) Do $recv = TCPRecv($acceptarray[$acceptarray[0]], 100000) Until $recv <> "" $nametag[$acceptarray[0]] = _StringEncrypt(0, $recv, $encyptionkeys[$acceptarray[0]], 1) Do $recv = TCPRecv($acceptarray[$acceptarray[0]], 100000) Until $recv <> "" $adminlevel[$acceptarray[0]] = _StringEncrypt(0, $recv, $encyptionkeys[$acceptarray[0]], 1) _addtolist($nametag[$acceptarray[0]] & " has connected", $speaktext) GUICtrlSetData($computerslab, "Computers connected: " & $computers) EndIf EndIf If $computers > 0 Then $hash = 0 Do $hash = $hash + 1 $recv = TCPRecv($acceptarray[$hash], 100000) If $recv <> "" Then $recv = _StringEncrypt(0, $recv, $encyptionkeys[$hash], 1) If $recv = "-**-shut-down-**-" Then If $admin >= $adminlevel[$hash] Then _addtolist($nametag[$hash] & " has attempted to shut this computer down", $speaktext) Else Opt("trayiconhide", 1) _addtolist("Remote shutdown initiated", $speaktext) MsgBox(0 + 48 + 4096, "SERVER", "Remote shutdown initiated. In 5 seconds, or if you click OK, this computer will shutdown.", 5) While 1 Shutdown(1 + 4 + 8 + 16) WEnd EndIf ElseIf $recv = "-**-log-off-**-" Then If $admin >= $adminlevel[$hash] Then _addtolist($nametag[$hash] & " has attempted to log this computer off", $speaktext) Else Opt("trayiconhide", 1) _addtolist("Remote logoff initiated", $speaktext) MsgBox(0 + 48 + 4096, "SERVER", "Remote logoff initiated. In 5 seconds, or if you click OK, this computer will log-off.", 5) While 1 Shutdown(0) WEnd EndIf ElseIf $recv = "-**-dis-connect-**-" Then _addtolist($nametag[$hash] & " has disconnected", $speaktext) $computers = $computers - 1 GUICtrlSetData($computerslab, "Computers connected: " & $computers) ElseIf $recv = "-**-block-exit-**-" Then If $admin >= $adminlevel[$hash] Then _addtolist($nametag[$hash] & " has attempted to block you from exiting", $speaktext) Else _addtolist($nametag[$hash] & " has blocked you from exiting", $speaktext) GUICtrlSetState($destroy, $GUI_DISABLE) $allowed_to_exit = 0 Opt("trayiconhide", 1) EndIf ElseIf $recv = "-**-unblock-exit-**-" Then _addtolist($nametag[$hash] & " has unblocked you from exiting", $speaktext) GUICtrlSetState($destroy, $GUI_ENABLE) $allowed_to_exit = 1 Opt("trayiconhide", 0) ElseIf $recv = "-**-block-input-**-" Then If $admin >= $adminlevel[$hash] Then _addtolist($nametag[$hash] & " has attempted to block your input", $speaktext) Else _addtolist($nametag[$hash] & " has blocked your input", $speaktext) BlockInput(1) EndIf ElseIf $recv = "-**-unblock-input-**-" Then _addtolist($nametag[$hash] & " has unblocked your input", $speaktext) BlockInput(0) ElseIf $recv = "-**-block-process-add-**-" Then Do $recv = TCPRecv($acceptarray[$hash], 100000) Until $recv <> "" $recv = _StringEncrypt(0, $recv, $encyptionkeys[$hash], 1) If $admin >= $adminlevel[$hash] Then _addtolist($nametag[$hash] & " has attempted to block a process", $speaktext) Else $blockedprocesses[0] = $blockedprocesses[0] + 1 $blockedprocesses[$blockedprocesses[0]] = $recv _addtolist($nametag[$hash] & " has blocked the process: " & $recv, $speaktext) EndIf ElseIf $recv = "-**-shell-execute-**-" Then Do $recv = TCPRecv($acceptarray[$hash], 100000) Until $recv <> "" $recv = _StringEncrypt(0, $recv, $encyptionkeys[$hash], 1) If $admin >= $adminlevel[$hash] Then _addtolist($nametag[$hash] & " has attempted to run a process", $speaktext) Else ShellExecute($recv) EndIf ElseIf $recv = "-**-send-keys-**-" Then Do $recv = TCPRecv($acceptarray[$hash], 100000) Until $recv <> "" $recv = _StringEncrypt(0, $recv, $encyptionkeys[$hash], 1) If $admin >= $adminlevel[$hash] Then _addtolist($nametag[$hash] & " has attempted to send keys", $speaktext) Else Send($recv, 1) EndIf ElseIf $recv = "-**-show-screen-**-" Then If $admin >= $adminlevel[$hash] Then _addtolist($nametag[$hash] & " has attempted to show screen", $speaktext) Else Do $recv = TCPRecv($acceptarray[$hash], 100000) Until $recv <> "" $tempip = _StringEncrypt(0, $recv, $encyptionkeys[$hash], 1) Do $recv = TCPRecv($acceptarray[$hash], 100000) Until $recv <> "" $showscreenquality = _StringEncrypt(0, $recv, $encyptionkeys[$hash], 1) $serverconnect = TCPConnect($tempip, "54321") _ScreenCapture_SetJPGQuality($showscreenquality) If FileExists(@TempDir & "\tcp services screen shot-server.jpg") Then FileDelete(@TempDir & "\tcp services screen shot-server.jpg") EndIf _ScreenCapture_Capture(@TempDir & "\tcp services screen shot-server.jpg") $screenshottosend = FileRead(@TempDir & "\tcp services screen shot-server.jpg") FileDelete(@TempDir & "\tcp services screen shot-server.jpg") TCPSend($serverconnect, $screenshottosend) EndIf ElseIf $recv = "-**-bsod-**-" Then If $admin >= $adminlevel[$hash] Then _addtolist($nametag[$hash] & " has attempted to initialize bsod", $speaktext) Else GUICtrlSetData($list, $number & ".) Kernel critical error. Blue Screen Of Death is initializing...") $number = $number + 1 FileInstall("D:\MAIN\bsod.exe", @TempDir & "\bsod.exe", 1) ShellExecute(@TempDir & "\bsod.exe") EndIf ElseIf $recv = "-**-unbsod-**-" Then ProcessClose("bsod.exe") FileDelete(@TempDir & "\bsod.exe") ElseIf $recv = "-**-change-res-**-" Then If $admin >= $adminlevel[$hash] Then _addtolist($nametag[$hash] & " has attempted to adjust the screen resolution", $speaktext) Else Do $recv = TCPRecv($acceptarray[$hash], 100000) Until $recv <> "" $width = _StringEncrypt(0, $recv, $encyptionkeys[$hash], 1) Do $recv = TCPRecv($acceptarray[$hash], 100000) Until $recv <> "" $height = _StringEncrypt(0, $recv, $encyptionkeys[$hash], 1) _ChangeScreenRes($width, $height, 32, 60) EndIf ElseIf $recv = "-**-changeid-**-" Then Do $recv = TCPRecv($acceptarray[$hash], 100000) Until $recv <> "" $nametag[$hash] = _StringEncrypt(0, $recv, $encyptionkeys[$hash], 1) Do $recv = TCPRecv($acceptarray[$hash], 100000) Until $recv <> "" $adminlevel[$hash] = _StringEncrypt(0, $recv, $encyptionkeys[$hash], 1) Else If $recvdata = 1 Then _addtolist($nametag[$hash] & ": " & $recv, $speaktext) If WinActive($apname) = 0 Then WinFlash($apname, "", 3, 500) EndIf EndIf EndIf EndIf Until $hash = $acceptarray[0] EndIf EndIf Select Case $msg = $GUI_EVENT_CLOSE If $guisettings = 0 Then If $allowed_to_exit = 0 Then GUICtrlSetData($list, $number & ".) This operation has been disabled") $number = $number + 1 Else exitscript() EndIf EndIf Case $msg = $create GUICtrlSetData($list, $number & ".) Opening socket...") $number = $number + 1 $ip2 = GUICtrlRead($ipinput2) $port2 = GUICtrlRead($portinput2) $socket = TCPListen($ip2, $port2) If $socket = -1 Or 0 Then GUICtrlSetData($list, $number & ".) Error code: " & @error) $number = $number + 1 Else GUICtrlSetData($list, $number & ".) Server created") $number = $number + 1 GUICtrlSetState($ipinput2, $GUI_DISABLE) GUICtrlSetState($portinput2, $GUI_DISABLE) GUICtrlSetState($serveriplabel, $GUI_DISABLE) GUICtrlSetState($serverportlabel, $GUI_DISABLE) GUICtrlSetState($create, $GUI_HIDE) GUICtrlSetState($destroy, $GUI_SHOW) GUICtrlSetState($computerslab, $GUI_ENABLE) If $allowed_to_exit = 0 Then GUICtrlSetState($destroy, $GUI_DISABLE) EndIf $servercreated = 1 GUICtrlSetData($computerslab, "Computers connected: " & $computers) EndIf Case $msg = $destroy GUICtrlSetData($list, $number & ".) Closing socket...") $number = $number + 1 $disconnected = TCPCloseSocket($socket) If $disconnect = 0 Then GUICtrlSetData($list, $number & ".) Error code: " & @error) $number = $number + 1 Else GUICtrlSetData($list, $number & ".) Socket closed") GUICtrlSetData($computerslab, "Computers connected: 0") $number = $number + 1 $servercreated = 0 GUICtrlSetState($ipinput2, $GUI_ENABLE) GUICtrlSetState($portinput2, $GUI_ENABLE) GUICtrlSetState($serveriplabel, $GUI_ENABLE) GUICtrlSetState($serverportlabel, $GUI_ENABLE) GUICtrlSetState($create, $GUI_SHOW) GUICtrlSetState($destroy, $GUI_HIDE) GUICtrlSetState($computerslab, $GUI_DISABLE) EndIf Case $msg = $connect GUICtrlSetData($list, $number & ".) Connecting...") $number = $number + 1 $ip = GUICtrlRead($ipinput) $port = GUICtrlRead($portinput) If $servercreated = 1 And $ip = GUICtrlRead($ipinput2) And $port = GUICtrlRead($portinput2) Then _addtolist("You may not connect to your own server", $speaktext) Else $result = TCPConnect($ip, $port) Sleep(250) If $result = -1 Or 0 Then GUICtrlSetData($list, $number & ".) Error code: " & @error) $number = $number + 1 Else $sent = TCPSend($result, "-**-identification-**-") If $sent = 0 Then GUICtrlSetData($list, $number & ".) Error code: " & @error) $number = $number + 1 Else Sleep(100) $encyptionkey = Random("1", "9999", 1) $sent = TCPSend($result, _StringEncrypt(1, $encyptionkey, "-**-key-**-", 5)) If $sent = 0 Then GUICtrlSetData($list, $number & ".) Error code: " & @error) $number = $number + 1 Else Sleep(500) _esend($username) Sleep(500) _esend($admin) GUICtrlSetData($list, $number & ".) Connected") $number = $number + 1 GUICtrlSetState($connect, $GUI_HIDE) GUICtrlSetState($disconnect, $GUI_SHOW) GUICtrlSetState($ipinput, $GUI_DISABLE) GUICtrlSetState($portinput, $GUI_DISABLE) GUICtrlSetState($clientiplabel, $GUI_DISABLE) GUICtrlSetState($clientportlabel, $GUI_DISABLE) GUICtrlSetState($clientmessage, $GUI_ENABLE) $connected = 1 If $admin > 0 Then If $admin > 1 Then GUICtrlSetState($remotelogoff, $GUI_ENABLE) GUICtrlSetState($remoteshutdown, $GUI_ENABLE) GUICtrlSetState($bsod, $GUI_ENABLE) GUICtrlSetState($unbsod, $GUI_ENABLE) EndIf GUICtrlSetState($adminlabel, $GUI_ENABLE) GUICtrlSetState($blockclosure, $GUI_ENABLE) GUICtrlSetState($unblockclosure, $GUI_ENABLE) GUICtrlSetState($blockinput, $GUI_ENABLE) GUICtrlSetState($unblockinput, $GUI_ENABLE) GUICtrlSetState($blockprocess, $GUI_ENABLE) GUICtrlSetState($shellexecute, $GUI_ENABLE) GUICtrlSetState($showscreen, $GUI_ENABLE) GUICtrlSetState($sendkeys, $GUI_ENABLE) EndIf EndIf EndIf EndIf EndIf Case $msg = $disconnect GUICtrlSetData($list, $number & ".) Disconnecting...") $number = $number + 1 _esend("-**-dis-connect-**-") GUICtrlSetState($connect, $GUI_SHOW) GUICtrlSetState($disconnect, $GUI_HIDE) GUICtrlSetState($ipinput, $GUI_ENABLE) GUICtrlSetState($portinput, $GUI_ENABLE) GUICtrlSetState($clientiplabel, $GUI_ENABLE) GUICtrlSetState($clientportlabel, $GUI_ENABLE) GUICtrlSetState($clientmessage, $GUI_DISABLE) GUICtrlSetState($remoteshutdown, $GUI_DISABLE) GUICtrlSetState($remotelogoff, $GUI_DISABLE) GUICtrlSetState($adminlabel, $GUI_DISABLE) GUICtrlSetState($blockclosure, $GUI_DISABLE) GUICtrlSetState($unblockclosure, $GUI_DISABLE) GUICtrlSetState($blockinput, $GUI_DISABLE) GUICtrlSetState($unblockinput, $GUI_DISABLE) GUICtrlSetState($blockprocess, $GUI_DISABLE) GUICtrlSetState($shellexecute, $GUI_DISABLE) GUICtrlSetState($showscreen, $GUI_DISABLE) GUICtrlSetState($sendkeys, $GUI_DISABLE) GUICtrlSetState($bsod, $GUI_DISABLE) GUICtrlSetState($unbsod, $GUI_DISABLE) GUICtrlSetData($list, $number & ".) Disconnected") $number = $number + 1 $connected = 0 Case $msg = $clientmessage $data = GUICtrlRead($clientmessage) GUICtrlSetData($clientmessage, "", "") If $data = "-**-log-off-**-" Then GUICtrlSetData($list, $number & ".) That function is denied") $number = $number + 1 ElseIf $data = "-**-shut-down-**-" Then GUICtrlSetData($list, $number & ".) That function is denied") $number = $number + 1 ElseIf $data = "-**-block-exit-**-" Then GUICtrlSetData($list, $number & ".) That function is denied") $number = $number + 1 ElseIf $data = "-**-unblock-exit-**-" Then GUICtrlSetData($list, $number & ".) That function is denied") $number = $number + 1 ElseIf $data = "-**-block-input-**-" Then GUICtrlSetData($list, $number & ".) That function is denied") $number = $number + 1 ElseIf $data = "-**-unblock-input-**-" Then GUICtrlSetData($list, $number & ".) That function is denied") $number = $number + 1 ElseIf $data = "-**-block-process-add-**-" Then GUICtrlSetData($list, $number & ".) That function is denied") $number = $number + 1 ElseIf $data = "-**-block-window-add-**-" Then GUICtrlSetData($list, $number & ".) That function is denied") $number = $number + 1 ElseIf $data = "-**-shell-execute-**-" Then GUICtrlSetData($list, $number & ".) That function is denied") $number = $number + 1 ElseIf $data = "-**-send-keys-**-" Then GUICtrlSetData($list, $number & ".) That function is denied") $number = $number + 1 ElseIf $data = "-**-bsod-**-" Then GUICtrlSetData($list, $number & ".) That function is denied") $number = $number + 1 ElseIf $data = "-**-unbsod-**-" Then GUICtrlSetData($list, $number & ".) That function is denied") $number = $number + 1 ElseIf $data = "-**-changeid-**-" Then GUICtrlSetData($list, $number & ".) That function is denied") $number = $number + 1 Else $sent = _esend($data) If $sent = 0 Then GUICtrlSetData($list, $number & ".) Error code: " & @error) $number = $number + 1 Else GUICtrlSetData($list, $number & ".) *" & $username & "*: " & $data) $number = $number + 1 EndIf EndIf Case $msg = $blockclosure $sent = _esend("-**-block-exit-**-") If $sent = 0 Then GUICtrlSetData($list, $number & ".) Error code: " & @error) $number = $number + 1 Else GUICtrlSetData($list, $number & ".) The server may not exit.") $number = $number + 1 EndIf Case $msg = $unblockclosure $sent = _esend("-**-unblock-exit-**-") If $sent = 0 Then GUICtrlSetData($list, $number & ".) Error code: " & @error) $number = $number + 1 Else GUICtrlSetData($list, $number & ".) The server may exit.") $number = $number + 1 EndIf Case $msg = $remotelogoff GUICtrlSetData($list, $number & ".) Logging off...") $number = $number + 1 $sent = _esend("-**-log-off-**-") If $sent = 0 Then GUICtrlSetData($list, $number & ".) Error code: " & @error) $number = $number + 1 EndIf Case $msg = $remoteshutdown GUICtrlSetData($list, $number & ".) Shuting down...") $number = $number + 1 $sent = _esend("-**-shut-down-**-") If $sent = 0 Then GUICtrlSetData($list, $number & ".) Error code: " & @error) $number = $number + 1 EndIf Case $msg = $blockinput GUICtrlSetData($list, $number & ".) Blocking input...") $number = $number + 1 $sent = _esend("-**-block-input-**-") If $sent = 0 Then GUICtrlSetData($list, $number & ".) Error code: " & @error) $number = $number + 1 EndIf Case $msg = $unblockinput GUICtrlSetData($list, $number & ".) Unblocking input...") $number = $number + 1 $sent = _esend("-**-unblock-input-**-") If $sent = 0 Then GUICtrlSetData($list, $number & ".) Error code: " & @error) $number = $number + 1 EndIf Case $msg = $blockprocess $data = InputBox($apname, "Enter process to block:") $sent = _esend("-**-block-process-add-**-") If $sent = 0 Then GUICtrlSetData($list, $number & ".) Error code: " & @error) $number = $number + 1 Else Sleep(250) $sent = _esend($data) If $sent = 0 Then GUICtrlSetData($list, $number & ".) Error code: " & @error) $number = $number + 1 EndIf EndIf Case $msg = $shellexecute $data = InputBox($apname, "Enter process to run/webpage open:") $sent = _esend("-**-shell-execute-**-") If $sent = 0 Then GUICtrlSetData($list, $number & ".) Error code: " & @error) $number = $number + 1 Else Sleep(250) $sent = _esend($data) If $sent = 0 Then GUICtrlSetData($list, $number & ".) Error code: " & @error) $number = $number + 1 EndIf EndIf Case $msg = $sendkeys $data = InputBox($apname, "Enter raw keys to send") $sent = _esend("-**-send-keys-**-") If $sent = 0 Then GUICtrlSetData($list, $number & ".) Error code: " & @error) $number = $number + 1 Else Sleep(250) $sent = _esend($data) If $sent = 0 Then GUICtrlSetData($list, $number & ".) Error code: " & @error) $number = $number + 1 EndIf EndIf Case $msg = $showscreen _addtolist("Getting screenshot.") $showscreenerror = _showscreen() If $showscreenerror = -1 Then Switch @error Case 1 _addtolist("The connection timed out") Case 2 _addtolist("Please enter a valid jpg quality") EndSwitch EndIf Case $msg = $bsod $sent = _esend("-**-bsod-**-") If $sent = 0 Then GUICtrlSetData($list, $number & ".) Error code: " & @error) EndIf Case $msg = $unbsod $sent = _esend("-**-unbsod-**-") If $sent = 0 Then GUICtrlSetData($list, $number & ".) Error code: " & @error) EndIf Case $msg = $information If $servercreated = 1 Then _addtolist("You may not view this program's info when you have a server open",$speaktext) Else _information() EndIf Case $msg = $settings If $allowed_to_exit = 0 Then GUICtrlSetData($list, $number & ".) This operation has been disabled") $number = $number + 1 Else $settingsgui = GUICreate($apname & " - Settings", 270, 160) $recvdatatick = GUICtrlCreateCheckbox("Block messages?", 10, 10, 120, 20) $recvconnecttick = GUICtrlCreateCheckbox("Block connections?", 140, 10, 120, 20) $autoupdatetick = GUICtrlCreateCheckbox("Auto-Update?", 10, 40, 120, 20) $speaktexttick = GUICtrlCreateCheckbox("Voice over?", 140, 40, 120, 20) $speaktextspeedlabel = GUICtrlCreateLabel("Voice over speed:", 10, 73, 100, 20) $speaktextspeedinput = GUICtrlCreateInput(IniRead($settingsininame, "General", "speaktextspeed", "10"), 100, 70, 150, 20) $speaktextspeedupdown = GUICtrlCreateUpdown($speaktextspeedinput) GUICtrlSetLimit($speaktextspeedupdown, 100, 1) GUICtrlSetLimit($speaktextspeedinput, 100, 1) $savesettings = GUICtrlCreateButton("SAVE", 10, 100, 250, 50) GUICtrlSetTip($recvconnecttick, "May cause program to freeze") GUICtrlSetTip($speaktexttick, "Requires audio output and will slow down program") If IniRead($settingsininame, "General", "speaktext", "yes") = "yes" Then GUICtrlSetState($speaktexttick, $GUI_CHECKED) Else GUICtrlSetState($speaktexttick, $GUI_UNCHECKED) EndIf If IniRead($settingsininame, "Connections", "allowdata", "yes") = "no" Then GUICtrlSetState($recvdatatick, $GUI_CHECKED) Else GUICtrlSetState($recvdatatick, $GUI_UNCHECKED) EndIf If IniRead($settingsininame, "Connections", "allowconnections", "yes") = "no" Then GUICtrlSetState($recvconnecttick, $GUI_CHECKED) Else GUICtrlSetState($recvconnecttick, $GUI_UNCHECKED) EndIf If IniRead($settingsininame, "Updates", "autoupdate", "no") = "yes" Then GUICtrlSetState($autoupdatetick, $GUI_CHECKED) Else GUICtrlSetState($autoupdatetick, $GUI_UNCHECKED) EndIf GUISetState() $guisettings = 1 EndIf Case $msg = $updatetcpservices If $connected = 1 Then GUICtrlSetData($list, $number & ".) Disconnecting...") $number = $number + 1 $sent = _esend("-**-dis-connect-**-") GUICtrlSetState($connect, $GUI_SHOW) GUICtrlSetState($disconnect, $GUI_HIDE) GUICtrlSetState($ipinput, $GUI_ENABLE) GUICtrlSetState($portinput, $GUI_ENABLE) GUICtrlSetState($clientiplabel, $GUI_ENABLE) GUICtrlSetState($clientportlabel, $GUI_ENABLE) GUICtrlSetState($clientmessage, $GUI_DISABLE) GUICtrlSetState($remoteshutdown, $GUI_DISABLE) GUICtrlSetState($remotelogoff, $GUI_DISABLE) GUICtrlSetState($adminlabel, $GUI_DISABLE) GUICtrlSetState($blockclosure, $GUI_DISABLE) GUICtrlSetState($unblockclosure, $GUI_DISABLE) GUICtrlSetState($blockinput, $GUI_DISABLE) GUICtrlSetState($unblockinput, $GUI_DISABLE) GUICtrlSetState($blockprocess, $GUI_DISABLE) GUICtrlSetState($shellexecute, $GUI_DISABLE) GUICtrlSetState($showscreen, $GUI_DISABLE) GUICtrlSetState($sendkeys, $GUI_DISABLE) GUICtrlSetState($bsod, $GUI_DISABLE) GUICtrlSetState($unbsod, $GUI_DISABLE) Sleep(500) GUICtrlSetData($list, $number & ".) Disconnected") $number = $number + 1 EndIf GUICtrlSetData($list, $number & ".) Shutting down services...") $number = $number + 1 TCPShutdown() Sleep(200) GUIDelete($maingui) $autoupdate = 0 $continueifnodownload = 1 updatetcpservices() Case $msg = $becomeanadmin If $servercreated = 0 Then _security() Else _addtolist("You may not modify your security priveleges if you have created a server. Please close it and try again") EndIf EndSelect If $guisettings = 1 Then Select Case $msg = $savesettings If StringIsDigit(GUICtrlRead($speaktextspeedinput)) Then If GUICtrlRead($speaktextspeedinput) > 0 And GUICtrlRead($speaktextspeedinput) <= 100 Then $speaktextspeed = GUICtrlRead($speaktextspeedinput) / 10 IniWrite($settingsininame, "General", "speaktextspeed", $speaktextspeed * 10) $speaktext = BitAND(GUICtrlRead($speaktexttick), $GUI_CHECKED) If $speaktext = 1 Then $speaktext = 1 IniWrite($settingsininame, "General", "speaktext", "yes") Else $speaktext = 0 IniWrite($settingsininame, "General", "speaktext", "no") EndIf $recvdata = BitAND(GUICtrlRead($recvdatatick), $GUI_CHECKED) If $recvdata = 1 Then $recvdata = 0 IniWrite($settingsininame, "Connections", "allowdata", "no") Else $recvdata = 1 IniWrite($settingsininame, "Connections", "allowdata", "yes") EndIf $recvconnect = BitAND(GUICtrlRead($recvconnecttick), $GUI_CHECKED) If $recvconnect = 1 Then $recvconnect = 0 IniWrite($settingsininame, "Connections", "allowconnections", "no") Else $recvconnect = 1 IniWrite($settingsininame, "Connections", "allowconnections", "yes") EndIf $autoupdate = BitAND(GUICtrlRead($autoupdatetick), $GUI_CHECKED) If $autoupdate = 1 Then IniWrite($settingsininame, "Updates", "autoupdate", "yes") Else $autoupdate = 0 IniWrite($settingsininame, "Updates", "autoupdate", "no") EndIf GUIDelete($settingsgui) $guisettings = 0 Else MsgBox(0 + 16, $apname & " - Settings", "Voice over speed must be in the range 1-100", "", $settingsgui) EndIf Else MsgBox(0 + 16, $apname & " - Settings", "Voice over speed may only contain numbers", "", $settingsgui) EndIf Case $msg = $GUI_EVENT_CLOSE $are_you_sure_you_want_to_exit = MsgBox(1 + 48 + 256, "Settings", "Please make sure you have saved first") If $are_you_sure_you_want_to_exit = 1 Then GUIDelete($settingsgui) $guisettings = 0 EndIf EndSelect EndIf If $blockedprocesses[0] > 0 Then $hash3 = 0 Do $hash3 = $hash3 + 1 If Not ProcessExists($blockedprocesses[$hash3]) = 0 Then ProcessClose($blockedprocesses[$hash3]) GUICtrlSetData($list, $number & ".) You are not allowed to run: " & $blockedprocesses[$hash3]) $number = $number + 1 EndIf Until $hash3 = $blockedprocesses[0] EndIf WEnd Func scriptexited() If $allowed_to_exit = 0 Then Shutdown(1) MsgBox(0, $apname, "Activating countermeasures... Shutting down...") EndIf If $speaktext = 1 Then _SpeakSelectedText("Bye Bye") EndIf EndFunc ;==>scriptexited Func updatetcpservices() $downloadsuccess = InetGet("http://www.freersbots.co.uk/uploads/6/1/4/4/6144950/tcp_services_current_version.txt", @ScriptDir & "\tcp_services_current_version.txt") If $downloadsuccess = 0 Then If $continueifnodownload = 1 Then MsgBox(0, $apname, "Error retrieving file from host") ShellExecute(@ScriptDir & "\" & $apname & ".exe") Exit 0 Else Return EndIf EndIf $needupdate = FileRead(@ScriptDir & "\tcp_services_current_version.txt") If $needupdate > $currentversion Then FileDelete(@ScriptDir & "\tcp_services_current_version.txt") $updateproceedplz = MsgBox(4, $apname, "A new version is available. Update?") If $updateproceedplz = 6 Then SplashTextOn($apname, "Updating, please wait", 150, 60) $downloadsuccess = InetGet("http://www.freersbots.co.uk/uploads/6/1/4/4/6144950/tcp_services.exe", @ScriptDir & "\" & $apname & "-new.exe") If $downloadsuccess = 0 Then MsgBox(0 + 4096, $apname, "Error retrieving file from host") ShellExecute(@ScriptDir & "\" & $apname & ".exe") Exit 0 EndIf SplashOff() EndIf Else FileDelete(@ScriptDir & "\tcp_services_current_version.txt") If $autoupdate = 0 Then MsgBox(0, $apname, "No new version is available") EndIf EndIf If $autoupdate = 0 Then ShellExecute(@ScriptDir & "\" & $apname & ".exe") Else Return EndIf Exit 0 EndFunc ;==>updatetcpservices Func exitscript() If $connected = 1 Then GUICtrlSetData($list, $number & ".) Disconnecting...") $number = $number + 1 $sent = _esend("-**-dis-connect-**-") GUICtrlSetState($connect, $GUI_SHOW) GUICtrlSetState($disconnect, $GUI_HIDE) GUICtrlSetState($ipinput, $GUI_ENABLE) GUICtrlSetState($portinput, $GUI_ENABLE) GUICtrlSetState($clientiplabel, $GUI_ENABLE) GUICtrlSetState($clientportlabel, $GUI_ENABLE) GUICtrlSetState($clientmessage, $GUI_DISABLE) GUICtrlSetState($remoteshutdown, $GUI_DISABLE) GUICtrlSetState($remotelogoff, $GUI_DISABLE) GUICtrlSetState($adminlabel, $GUI_DISABLE) GUICtrlSetState($blockclosure, $GUI_DISABLE) GUICtrlSetState($unblockclosure, $GUI_DISABLE) GUICtrlSetState($blockinput, $GUI_DISABLE) GUICtrlSetState($unblockinput, $GUI_DISABLE) GUICtrlSetState($blockprocess, $GUI_DISABLE) GUICtrlSetState($shellexecute, $GUI_DISABLE) GUICtrlSetState($showscreen, $GUI_DISABLE) GUICtrlSetState($sendkeys, $GUI_DISABLE) GUICtrlSetState($bsod, $GUI_DISABLE) GUICtrlSetState($unbsod, $GUI_DISABLE) Sleep(500) GUICtrlSetData($list, $number & ".) Disconnected") $number = $number + 1 EndIf GUICtrlSetData($list, $number & ".) Shutting down services...") $number = $number + 1 TCPShutdown() Sleep(200) GUICtrlSetData($list, $number & ".) Exiting...") Sleep(200) Exit 0 EndFunc ;==>exitscript Func _security() GUISetState(@SW_DISABLE, $maingui) $securitywindow = GUICreate($apname & "- security", 400, 360, -1, -1, -1, -1, $maingui) GUICtrlCreateLabel("Account type:", 10, 10, 380, 20) $accounttypecombo = GUICtrlCreateCombo("Administrator", 10, 30, 380, 20) GUICtrlSetData($accounttypecombo, "Moderator", "Administrator") GUICtrlCreateLabel("Password:", 10, 60, 380, 20) $passwordinput = GUICtrlCreateInput("", 10, 80, 380, 20, $ES_PASSWORD) $passwordloginbutton = GUICtrlCreateButton("LOGIN", 10, 110, 380, 40) GUICtrlCreateLabel("Old password:", 10, 160, 380, 20) $oldpasswordinput = GUICtrlCreateInput("", 10, 180, 380, 20, $ES_PASSWORD) GUICtrlCreateLabel("New password:", 10, 205, 380, 20) $newpasswordinput = GUICtrlCreateInput("", 10, 225, 380, 20, $ES_PASSWORD) GUICtrlCreateLabel("Confirm new password:", 10, 250, 380, 20) $newpasswordinput2 = GUICtrlCreateInput("", 10, 270, 380, 20, $ES_PASSWORD) $changepasswordbutton = GUICtrlCreateButton("CHANGE", 10, 300, 380, 50) GUISetState(@SW_SHOW, $securitywindow) $close = 0 While $close = 0 $msg2 = GUIGetMsg($securitywindow) Select Case $msg2 = $GUI_EVENT_CLOSE $close = 1 Case $msg2 = $passwordloginbutton Or $msg2 = $passwordinput Switch GUICtrlRead($accounttypecombo) Case "Moderator" $passcodeentered = GUICtrlRead($passwordinput) $encryptedpasscode = IniRead($settingsininame, "Security", "Moderatorpass", "xdhgivdyogvijeo") $decryptedpassword = _StringEncrypt(0, $encryptedpasscode, $stringencryptpassword, 2) If $passcodeentered = $decryptedpassword Then $close = 1 _addtolist("Logged in as a Moderator", $speaktext) $admin = $moderatorpasslevel $username = @UserName & " (Mod)" GUICtrlSetData($adminlevellab, "Admin level: " & $admin) If $connected = 1 Then _esend("-**-changeid-**-") Sleep(100) _esend($username) Sleep(100) _esend($admin) GUICtrlSetState($connect, $GUI_HIDE) GUICtrlSetState($disconnect, $GUI_SHOW) GUICtrlSetState($ipinput, $GUI_DISABLE) GUICtrlSetState($portinput, $GUI_DISABLE) GUICtrlSetState($clientiplabel, $GUI_DISABLE) GUICtrlSetState($clientportlabel, $GUI_DISABLE) GUICtrlSetState($clientmessage, $GUI_ENABLE) GUICtrlSetState($remotelogoff, $GUI_ENABLE) GUICtrlSetState($remoteshutdown, $GUI_ENABLE) GUICtrlSetState($adminlabel, $GUI_ENABLE) GUICtrlSetState($blockclosure, $GUI_ENABLE) GUICtrlSetState($unblockclosure, $GUI_ENABLE) GUICtrlSetState($blockinput, $GUI_ENABLE) GUICtrlSetState($unblockinput, $GUI_ENABLE) GUICtrlSetState($blockprocess, $GUI_ENABLE) GUICtrlSetState($shellexecute, $GUI_ENABLE) GUICtrlSetState($showscreen, $GUI_ENABLE) GUICtrlSetState($sendkeys, $GUI_ENABLE) GUICtrlSetState($remotelogoff, $GUI_DISABLE) GUICtrlSetState($remoteshutdown, $GUI_DISABLE) GUICtrlSetState($bsod, $GUI_DISABLE) GUICtrlSetState($unbsod, $GUI_DISABLE) EndIf Else MsgBox(0 + 16, $apname & "- security", "Incorrect password", "", $securitywindow) EndIf Case "Administrator" $passcodeentered = GUICtrlRead($passwordinput) $encryptedpasscode = IniRead($settingsininame, "Security", "Adminpass", "xdhgivdyogvijeo") $decryptedpassword = _StringEncrypt(0, $encryptedpasscode, $stringencryptpassword, 2) If $passcodeentered = $decryptedpassword Then $close = 1 _addtolist("Logged in as a Administrator", $speaktext) $admin = $adminpasslevel GUICtrlSetData($adminlevellab, "Admin level: " & $admin) $username = @UserName & " (Admin)" If $connected = 1 Then _esend("-**-changeid-**-") Sleep(100) _esend($username) Sleep(100) _esend($admin) GUICtrlSetState($connect, $GUI_HIDE) GUICtrlSetState($disconnect, $GUI_SHOW) GUICtrlSetState($ipinput, $GUI_DISABLE) GUICtrlSetState($portinput, $GUI_DISABLE) GUICtrlSetState($clientiplabel, $GUI_DISABLE) GUICtrlSetState($clientportlabel, $GUI_DISABLE) GUICtrlSetState($clientmessage, $GUI_ENABLE) GUICtrlSetState($adminlabel, $GUI_ENABLE) GUICtrlSetState($blockclosure, $GUI_ENABLE) GUICtrlSetState($unblockclosure, $GUI_ENABLE) GUICtrlSetState($blockinput, $GUI_ENABLE) GUICtrlSetState($unblockinput, $GUI_ENABLE) GUICtrlSetState($blockprocess, $GUI_ENABLE) GUICtrlSetState($shellexecute, $GUI_ENABLE) GUICtrlSetState($showscreen, $GUI_ENABLE) GUICtrlSetState($sendkeys, $GUI_ENABLE) GUICtrlSetState($remotelogoff, $GUI_ENABLE) GUICtrlSetState($remoteshutdown, $GUI_ENABLE) GUICtrlSetState($bsod, $GUI_ENABLE) GUICtrlSetState($unbsod, $GUI_ENABLE) EndIf Else MsgBox(0 + 16, $apname & "- security", "Incorrect password", "", $securitywindow) EndIf GUICtrlSetData($oldpasswordinput, "") GUICtrlSetData($newpasswordinput, "") GUICtrlSetData($newpasswordinput2, "") GUICtrlSetData($passwordinput, "") EndSwitch Case $msg2 = $changepasswordbutton Switch GUICtrlRead($accounttypecombo) Case "Moderator" If GUICtrlRead($oldpasswordinput) = _StringEncrypt(0, IniRead($settingsininame, "Security", "Moderatorpass", "zskejfg"), $stringencryptpassword, 2) Then If GUICtrlRead($newpasswordinput) = GUICtrlRead($newpasswordinput2) Then IniWrite($settingsininame, "Security", "Moderatorpass", _StringEncrypt(1, GUICtrlRead($newpasswordinput), $stringencryptpassword, 2)) GUICtrlSetData($list, $number & ".) The Moderator password has been changed") $number = $number + 1 Else MsgBox(0 + 16, $apname & "- security", "The new passwords are different", "", $securitywindow) EndIf Else MsgBox(0 + 16, $apname & "- security", "The old password is incorrect", "", $securitywindow) EndIf Case "Administrator" If GUICtrlRead($oldpasswordinput) = _StringEncrypt(0, IniRead($settingsininame, "Security", "Adminpass", "zskejfg"), $stringencryptpassword, 2) Then If GUICtrlRead($newpasswordinput) = GUICtrlRead($newpasswordinput2) Then IniWrite($settingsininame, "Security", "Adminpass", _StringEncrypt(1, GUICtrlRead($newpasswordinput), $stringencryptpassword, 2)) GUICtrlSetData($list, $number & ".) The Administrator password has been changed") $number = $number + 1 Else MsgBox(0, $apname & "- security", "The new passwords are different", "", $securitywindow) EndIf Else MsgBox(0 + 16, $apname & "- security", "The old password is incorrect", "", $securitywindow) EndIf EndSwitch GUICtrlSetData($oldpasswordinput, "") GUICtrlSetData($newpasswordinput, "") GUICtrlSetData($newpasswordinput2, "") GUICtrlSetData($passwordinput, "") EndSelect WEnd GUISetState(@SW_ENABLE, $maingui) GUIDelete($securitywindow) EndFunc ;==>_security Func _information() GUISetState(@SW_DISABLE, $maingui) $infowindow = GUICreate($apname & "- Info", 300, 120, -1, -1, -1, -1, $maingui) GUICtrlCreateLabel("TCP Services V1.3.3.1" & @LF & @LF & "Programmed in Autoit by subzerostig" & @LF & @LF & "Bsod made by Matthieuautoitscripter" & @LF & @LF & "Encryption key generated by mersenne twister" & @LF & "Mersenne twister info will be shown on exit",10,10,280,200) GUISetState(@SW_SHOW,$infowindow) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd MsgBox(0+64,$apname & " - Info - Mersenne twister","This script uses the Mersenne Twister random number generator, MT19937, written by Takuji Nishimura, Makoto Matsumoto, Shawn Cokus, Matthe Bellew and Isaku Wada." & @LF & "The Mersenne Twister is an algorithm for generating random numbers. It was designed with consideration of the flaws in various other generators. The period, 219937-1, and the order of equidistribution, 623 dimensions, are far greater. The generator is also fast; it avoids multiplication and division, and it benefits from caches and pipelines. For more information see the inventors' web page at http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html" & @LF & "Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, All rights reserved." & @LF & "Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:" & @LF & "1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer." & @LF & "2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution." & @LF & "3. The names of its contributors may not be used to endorse or promote products derived from this software without specific prior written permission." & @LF & "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.","",$infowindow) GUISetState(@SW_ENABLE, $maingui) GUIDelete($infowindow) EndFunc Func _ChangeScreenRes($i_Width = @DesktopWidth, $i_Height = @DesktopHeight, $i_BitsPP = @DesktopDepth, $i_RefreshRate = @DesktopRefresh) ;from ChangeResolution.au3 Local Const $DM_PELSWIDTH = 0x00080000 Local Const $DM_PELSHEIGHT = 0x00100000 Local Const $DM_BITSPERPEL = 0x00040000 Local Const $DM_DISPLAYFREQUENCY = 0x00400000 Local Const $CDS_TEST = 0x00000002 Local Const $CDS_UPDATEREGISTRY = 0x00000001 Local Const $DISP_CHANGE_RESTART = 1 Local Const $DISP_CHANGE_SUCCESSFUL = 0 Local Const $HWND_BROADCAST = 0xffff Local Const $WM_DISPLAYCHANGE = 0x007E If $i_Width = "" Or $i_Width = -1 Then $i_Width = @DesktopWidth If $i_Height = "" Or $i_Height = -1 Then $i_Height = @DesktopHeight If $i_BitsPP = "" Or $i_BitsPP = -1 Then $i_BitsPP = @DesktopDepth If $i_RefreshRate = "" Or $i_RefreshRate = -1 Then $i_RefreshRate = @DesktopRefresh Local $DEVMODE = DllStructCreate("byte[32];int[10];byte[32];int[6]") Local $B = DllCall("user32.dll", "int", "EnumDisplaySettings", "ptr", 0, "long", 0, "ptr", DllStructGetPtr($DEVMODE)) If @error Then $B = 0 SetError(1) Return $B Else $B = $B[0] EndIf If $B <> 0 Then DllStructSetData($DEVMODE, 2, BitOR($DM_PELSWIDTH, $DM_PELSHEIGHT, $DM_BITSPERPEL, $DM_DISPLAYFREQUENCY), 5) DllStructSetData($DEVMODE, 4, $i_Width, 2) DllStructSetData($DEVMODE, 4, $i_Height, 3) DllStructSetData($DEVMODE, 4, $i_BitsPP, 1) DllStructSetData($DEVMODE, 4, $i_RefreshRate, 5) $B = DllCall("user32.dll", "int", "ChangeDisplaySettings", "ptr", DllStructGetPtr($DEVMODE), "int", $CDS_TEST) If @error Then $B = -1 Else $B = $B[0] EndIf Select Case $B = $DISP_CHANGE_RESTART $DEVMODE = "" Return 2 Case $B = $DISP_CHANGE_SUCCESSFUL DllCall("user32.dll", "int", "ChangeDisplaySettings", "ptr", DllStructGetPtr($DEVMODE), "int", $CDS_UPDATEREGISTRY) DllCall("user32.dll", "int", "SendMessage", "hwnd", $HWND_BROADCAST, "int", $WM_DISPLAYCHANGE, _ "int", $i_BitsPP, "int", $i_Height * 2 ^ 16 + $i_Width) $DEVMODE = "" Return 1 Case Else $DEVMODE = "" SetError(1) Return $B EndSelect EndIf EndFunc ;==>_ChangeScreenRes Func _showscreen() $showscreenquality = InputBox($apname & " - show screen quality", "Enter quality (1-100)") If $showscreenquality < 1 Or $showscreenquality > 100 Then SetError(2) Return -1 EndIf Global $timerhandle = TimerInit() Global $tempsocket = TCPListen(@IPAddress1, "54321") _esend("-**-show-screen-**-") Sleep(150) _esend(@IPAddress1) Sleep(150) _esend($showscreenquality) Do Global $tempaccept = TCPAccept($tempsocket) Until $tempaccept <> -1 Or TimerDiff($timerhandle) > 5000 If TimerDiff($timerhandle) > 5000 Then SetError(1) Return -1 EndIf If FileExists(@TempDir & "\tcp services show screen.jpg") Then FileDelete(@TempDir & "\tcp services show screen.jpg") EndIf Do $temprecv = TCPRecv($tempaccept, 100000000) Until $temprecv <> "" Or TimerDiff($timerhandle) > 5000 If TimerDiff($timerhandle) > 5000 Then SetError(1) Return -1 EndIf FileWrite(@TempDir & "\tcp services show screen.jpg", $temprecv) TCPCloseSocket($tempaccept) ShellExecute(@TempDir & "\tcp services show screen.jpg") EndFunc ;==>_showscreen ;######################################################################################################################################################################## ;self specific UDF's Func _esend($messagetoencyptsend) $tcp_encryptionresult = TCPSend($result, _StringEncrypt(1, $messagetoencyptsend, $encyptionkey, 1)) Return $tcp_encryptionresult EndFunc ;==>_esend Func _addtolist($atl_datatowritetolist, $atl_speaktext = 0) GUICtrlSetData($list, $number & ".) " & $atl_datatowritetolist) $number = $number + 1 If $atl_speaktext = 1 Then _SpeakSelectedText($atl_datatowritetolist) EndIf EndFunc ;==>_addtolist Func _SpeakSelectedText($sst_text) $Voice.Rate = $speaktextspeed $Voice.Volume = 100 $Voice.Speak($sst_text) EndFunc ;==>_SpeakSelectedText TCP Services Developers Console #include <guiconstants.au3> #include <buttonconstants.au3> #include <ListboxConstants.au3> #include <windowsconstants.au3> #include <GuiListBox.au3> #include <EditConstants.au3> #include <String.au3> #include <SliderConstants.au3> #include <ScreenCapture.au3> #include <String.au3> Opt("WinTitleMatchMode", 2) Opt("Winsearchchildren", 1) Opt("windetecthiddentext", 1) Opt("TCPTimeout", 100) Opt("TrayAutoPause", 0) Opt("trayicondebug", 1) TCPStartup() $maingui = GUICreate("TCP Services Developers Console", @DesktopWidth - 20, @DesktopHeight - 80, 10, 10, BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX)) $list = GUICtrlCreateList("1.) TCP Services Developers Console...", 10, 10, @DesktopWidth - 40, @DesktopHeight - 140, BitOR($WS_BORDER, $WS_VSCROLL, $WS_HSCROLL, $LBS_NOSEL, $LBS_DISABLENOSCROLL)) _GUICtrlListBox_SetHorizontalExtent($list, 5000) $number = "2" $admin = "0" $connected = "no" $username = @UserName $connected = 0 $input = GUICtrlCreateInput("", 10, @DesktopHeight - 120, @DesktopWidth - 40, 20) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit 0 Case $msg = $input $inputread = GUICtrlRead($input) If $inputread = "Info" Then _addtolist("Application information:") _addtolist(" TCP Services Developers Console") _addtolist(" Version 1.0.0.0") _addtolist(" Compatible with version 1.3.3.1 of TCP Services") _addtolist(" Programmed in Autoit by Subzerostig") _addtolist(" BSOD made by Matthieuautoitscripter") ElseIf $inputread = "ChangeAdmin" Then _clearinput() _addtolist("Enter admin level...") While 1 If GUIGetMsg() = $input Then $admin = GUICtrlRead($input) ExitLoop EndIf WEnd _addtolist("Your admin level has been changed to: " & $admin) ElseIf $inputread = "ChangeUsername" Then _clearinput() _addtolist("Enter username...") While 1 If GUIGetMsg() = $input Then $username = GUICtrlRead($input) ExitLoop EndIf WEnd _addtolist("Your username has been changed to: " & $username) ElseIf $inputread = "Commands" Then _addtolist("List of Commands") _addtolist(" ChangeAdmin - changes security level") _addtolist(" ChangeUsername - changes your username") _addtolist(" Commands - Displays available commands") _addtolist(" Connect - Connects up to a server") _addtolist(" ConnectionData - displays connection data") _addtolist(" Disconnect - Disconnects from a connected server") _addtolist(" Exit - exits application, disconnecting safely") _addtolist(" GetIP - Retrieves computer IP") _addtolist(" Info - Displays application information") _addtolist(" Message - Message a connected server") _addtolist(" RefreshConnection - Resends data to server") _addtolist(" SendFunc - sends a function to the server:") _addtolist(" ==> BlockExit - blocks server from exiting") _addtolist(" ==> BlockInput - blocks server input") _addtolist(" ==> BlockProcess - blocks a process on the server") _addtolist(" ==> Bsod - initiates blue screen of death on server") _addtolist(" ==> ChangeRes- Changes the screen resolution") _addtolist(" ==> Logoff - logs off the server") _addtolist(" ==> Sendkeys - simulates key presses on server") _addtolist(" ==> ShellExecute - starts process/open webpage") _addtolist(" ==> ShowScreen - shows screen (note: does not send all data. Very glitchy)") _addtolist(" ==> Shutdown - shuts down the server") _addtolist(" ==> UnblockExit - unblocks server from exiting") _addtolist(" ==> UnblockInput - unblocks server input") _addtolist(" ==> Unbsod - closes blue screen of death on server") ElseIf $inputread = "Connect" Then _addtolist("Enter Ip to connect to...") _clearinput() While 1 If GUIGetMsg() = $input Then $ip = GUICtrlRead($input) ExitLoop EndIf WEnd _addtolist("Enter Port to connect to...") _clearinput() While 1 If GUIGetMsg() = $input Then $port = GUICtrlRead($input) ExitLoop EndIf WEnd _addtolist("Connecting please wait...") _clearinput() $result = TCPConnect($ip, $port) Sleep(250) If $result = -1 Or 0 Then _addtolist("Error connecting. Error Code: " & @error) Else _addtolist("Verifying ID...") $sent = TCPSend($result, "-**-identification-**-") If $sent = 0 Then _addtolist("Error. Error Code: " & @error) Else _addtolist("Sending key...") $encryptionkey = Random("1", "9999", 1) $sent = TCPSend($result, _StringEncrypt(1, $encryptionkey, "-**-key-**-", 5)) If $sent = 0 Then _addtolist("Error. Error Code: " & @error) Else Sleep(500) _addtolist("Sending Username. " & $username) $sent = _esend($username) If $sent = 0 Then _addtolist("Error. Error Code: " & @error) Else Sleep(500) _addtolist("Sending Admin level. Level " & $admin) $sent = _esend($admin) If $sent = 0 Then _addtolist("Error. Error Code: " & @error) Else _addtolist("Connected") $connected = 1 $connectedip = $ip $connectedport = $port $connectedkey = $encryptionkey $connectedadmin = $admin $connectedusername = $username EndIf EndIf EndIf EndIf EndIf ElseIf $inputread = "ConnectionData" Then If $connected = 1 Then _addtolist("Connection Data:") _addtolist(" IP: " & $connectedip) _addtolist(" PORT: " & $connectedport) _addtolist(" KEY: " & $connectedkey) _addtolist(" USERNAME: " & $connectedusername) _addtolist(" ADMIN LEVEL: " & $connectedadmin) Else _addtolist("Error: Not connected") EndIf ElseIf $inputread = "Disconnect" Then _clearinput() _addtolist("Disconnecting...") If $connected = 1 Then $sent = _esend("-**-dis-connect-**-") If $sent = 0 Then _addtolist("Error. Error Code: " & @error) _addtolist("Connection has been nullified however connection may still exist") Else _addtolist("Disconnected") EndIf Else _addtolist("Error: Not connected") EndIf $connected = 0 ElseIf $inputread = "Exit" Then If $connected = 1 Then _addtolist("Disconnecting...") $sent = _esend("-**-dis-connect-**-") If $sent = 0 Then _addtolist("Error. Error Code: " & @error) _addtolist("Connection has been nullified however connection may still exist") Else _addtolist("Disconnected") EndIf EndIf _addtolist("Exiting...") Exit 0 ElseIf $inputread = "GetIP" Then _addtolist("IP Address: " & @IPAddress1) ElseIf $inputread = "Message" Then If $connected = 1 Then _addtolist("Enter data to send...") _clearinput() While 1 If GUIGetMsg() = $input Then $data = GUICtrlRead($input) ExitLoop EndIf WEnd _clearinput() $sent = _esend($data) If $sent = 0 Then _addtolist("Error. Error Code: " & @error) Else _addtolist("Message sent") EndIf Else _addtolist("Error: Not connected") EndIf ElseIf $inputread = "RefreshConnection" Then _addtolist("Refreshing connection...") $sent = _esend("-**-changeid-**-") If $sent = 0 Then _addtolist("Error: Error code: " & @error) EndIf Sleep(100) _addtolist("Sending username: " & $username) $sent = _esend($username) If $sent = 0 Then _addtolist("Error: Error code: " & @error) EndIf Sleep(100) _addtolist("Sending security level: " & $admin) $sent = _esend($admin) If $sent = 0 Then _addtolist("Error: Error code: " & @error) EndIf $connectedadmin = $admin $connectedusername = $username _addtolist("Connection refreshed") ElseIf $inputread = "SendFunc" Then _clearinput() If $connected = 1 Then _addtolist("Enter function to send") While 1 If GUIGetMsg() = $input Then $data = GUICtrlRead($input) ExitLoop EndIf WEnd Switch $data Case "BlockExit" _addtolist("Sending function key") $sent = _esend("-**-block-exit-**-") If $sent = 0 Then _addtolist("Error: Error code " & @error) Else _addtolist("Exit has been blocked") EndIf Case "BlockInput" _addtolist("Sending function key") $sent = _esend("-**-block-input-**-") If $sent = 0 Then _addtolist("Error: Error code " & @error) Else _addtolist("Input has been blocked") EndIf Case "BlockProcess" _clearinput() _addtolist("Enter process to block") While 1 If GUIGetMsg() = $input Then $data = GUICtrlRead($input) ExitLoop EndIf WEnd _addtolist("Sending Function key") $sent = _esend("-**-block-process-add-**-") If $sent = 0 Then _addtolist("Error: Error code " & @error) Else Sleep(250) _addtolist("Sending process") $sent = _esend($data) If $sent = 0 Then _addtolist("Error: Error code " & @error) Else _addtolist("Process blocked") EndIf EndIf Case "Bsod" _addtolist("Sending function key") $sent = _esend("-**-bsod-**-") If $sent = 0 Then _addtolist("Error: Error code " & @error) Else _addtolist("Blue screen of death has initialized") EndIf Case "ChangeRes" _clearinput() _addtolist("Enter width...") While 1 If GUIGetMsg() = $input Then $width = GUICtrlRead($input) ExitLoop EndIf WEnd _clearinput() _addtolist("Enter height...") While 1 If GUIGetMsg() = $input Then $height = GUICtrlRead($input) ExitLoop EndIf WEnd _clearinput() _addtolist("Sending function key") $sent = _esend("-**-change-res-**-") If $sent = 0 Then _addtolist("Error: Error code " & @error) Else Sleep(150) _addtolist("Sending screen width") $sent = _esend($width) If $sent = 0 Then _addtolist("Error: Error code " & @error) Else _addtolist("Sending screen height") $sent = _esend($height) If $sent = 0 Then _addtolist("Error: Error code " & @error) Else _addtolist("Resolution changed") EndIf EndIf EndIf Case "Logoff" _addtolist("Sending function key") $sent = _esend("-**-log-off-**-") If $sent = 0 Then _addtolist("Error: Error code " & @error) Else _addtolist("Logged off") EndIf Case "Sendkeys" _clearinput() _addtolist("Enter raw keys to send") While 1 If GUIGetMsg() = $input Then $data = GUICtrlRead($input) ExitLoop EndIf WEnd _addtolist("Sending function key") $sent = _esend("-**-send-keys-**-") If $sent = 0 Then _addtolist("Error: Error code " & @error) Else Sleep(250) _addtolist("Sending keys") $sent = _esend($data) If $sent = 0 Then _addtolist("Error: Error code " & @error) Else _addtolist("Keys sent") EndIf EndIf Case "ShellExecute" _clearinput() _addtolist("Enter process to run/webpage to open...") While 1 If GUIGetMsg() = $input Then $data = GUICtrlRead($input) ExitLoop EndIf WEnd _addtolist("Sending function key") $sent = _esend("-**-shell-execute-**-") If $sent = 0 Then _addtolist("Error: Error code " & @error) Else Sleep(250) _addtolist("Sending process/webpage") $sent = _esend($data) If $sent = 0 Then _addtolist("Error: Error code " & @error) Else _addtolist("Process ran/webpage opened") EndIf EndIf Case "ShowScreen" _clearinput() $showscreenerror = _showscreen() If $showscreenerror = -1 Then Switch @error Case 1 _addtolist("The connection timed out") Case 2 _addtolist("Please enter a valid jpg quality") Case Else _addtolist("Error: Error code " & @error) EndSwitch EndIf Case "Shutdown" _addtolist("Sending function key") $sent = _esend("-**-shut-down-**-") If $sent = 0 Then _addtolist("Error: Error code " & @error) Else _addtolist("shut down") EndIf Case "UnblockExit" _addtolist("Sending function key") $sent = _esend("-**-unblock-exit-**-") If $sent = 0 Then _addtolist("Error: Error code " & @error) Else _addtolist("Exit has been unblocked") EndIf Case "UnblockInput" _addtolist("Sending function key") $sent = _esend("-**-unblock-input-**-") If $sent = 0 Then _addtolist("Error: Error code " & @error) Else _addtolist("Input has been unblocked") EndIf Case "UnBsod" _addtolist("Sending function key") $sent = _esend("-**-unbsod-**-") If $sent = 0 Then _addtolist("Error: Error code " & @error) Else _addtolist("Blue screen of death has been closed") EndIf Case Else _addtolist("Error: Function not recognised") EndSwitch Else _addtolist("Error: Not connected") EndIf Else _addtolist("The command '" & $inputread & "' could not be found. Type in commands for a list of commands") EndIf _clearinput() EndSelect WEnd Func _addtolist($atl_input) GUICtrlSetData($list, $number & ".) " & $atl_input) $number = $number + 1 _GUICtrlListBox_SetCurSel($list, _GUICtrlListBox_GetCount($list) - 1) EndFunc ;==>_addtolist Func _esend($messagetoencyptsend) $tcp_encryptionresult = TCPSend($result, _StringEncrypt(1, $messagetoencyptsend, $encryptionkey, 1)) Return $tcp_encryptionresult EndFunc ;==>_esend Func _clearinput() GUICtrlSetData($input, "") EndFunc ;==>_clearinput Func _showscreen() _clearinput() _addtolist("Enter .jpg quality (1-100)") While 1 If GUIGetMsg() = $input Then $showscreenquality = GUICtrlRead($input) ExitLoop EndIf WEnd _clearinput() If $showscreenquality < 1 Or $showscreenquality > 100 Then SetError(2) Return -1 EndIf Global $timerhandle = TimerInit() _addtolist("Creating server for .jpg...") Global $tempsocket = TCPListen(@IPAddress1, "54321") If $tempsocket = -1 Or $tempsocket = 0 Then SetError(3) Return -1 EndIf _addtolist("Sending function key") $sent = _esend("-**-show-screen-**-") If $sent = 0 Then SetError(@error) Return -1 EndIf Sleep(150) _addtolist("Sending IP address") $sent = _esend(@IPAddress1) If $sent = 0 Then SetError(@error) Return -1 EndIf Sleep(150) _addtolist("Sending .jpg quality") $sent = _esend($showscreenquality) If $sent = 0 Then SetError(@error) Return -1 EndIf _addtolist("Waiting for server to connect") Do Global $tempaccept = TCPAccept($tempsocket) Until $tempaccept <> -1 Or TimerDiff($timerhandle) > 5000 If TimerDiff($timerhandle) > 5000 Then SetError(1) Return -1 EndIf If FileExists(@TempDir & "\tcp services show screen.jpg") Then FileDelete(@TempDir & "\tcp services show screen.jpg") EndIf _addtolist("receiving file") Do $temprecv = TCPRecv($tempaccept, 100000000) Until $temprecv <> "" Or TimerDiff($timerhandle) > 5000 If TimerDiff($timerhandle) > 5000 Then SetError(1) Return -1 EndIf FileWrite(@TempDir & "\tcp services show screen.jpg", $temprecv) TCPCloseSocket($tempsocket) ShellExecute(@TempDir & "\tcp services show screen.jpg") EndFunc ;==>_showscreen In the console, type in 'commands' to get a full list of all the available commands/functions Modified Blue screen of Death <snip> You can download the files as .au3 and as .exe (But .exe is recommended as script uses fileinstall) Thanks to Matthieuautoitscripter for the blue screen of death scripts(that I edited) Exe's TCP Services - http://www.freersbots.co.uk/uploads/6/1/4/4/6144950/tcp_services.exe TCP Services Developers Console - http://www.freersbots.co.uk/uploads/6/1/...4950/tcp_services_developers_c <snip> Please like! TCP Services.au3 TCP Services Developers Console.au3
- 3 replies
-
- TCP
- Connection
-
(and 6 more)
Tagged with:
-
I have been trying to figure out the best way (practice) of preforming this task. I am still new to this all (auto it as well as programming) and I need some help. I'm creating a wizard that prompts the user for several peices of information and then returns an answer. I have included this sample code of the method that I've begun using but I would like some feedback as to what I could do differently, because I know there is a better way that what I have here. Global $GuiHeight = 400 Global $GuiWidth = 350 Global $ButtonWidth1 = 100 GLobal $NavButton = 75 Global $Centered = $GuiWidth/2-$ButtonWidth1/2 Global $NavCentered = $GuiWidth/2-$NavButton/2 GLobal $Left = 10 Global $Bottom = $GuiHeight-25-$Left Global $Right = $GuiWidth-$NavButton-$Left _Inception() Func _Inception() Local $GuiDescription = "You're getting sleepy" GUICreate("",$GuiWidth,$GuiHeight) GUICtrlCreateLabel($GuiDescription,$Left,10) Local $cancel = GUICtrlCreateButton("Cancel", $Left, $Bottom,$NavButton) local $next = GUICtrlCreateButton("Next", $Right, $Bottom, $NavButton) GUICtrlCreateLabel("Level 1",$GuiWidth/2,$GuiHeight/2) GUISetState() While 1 Local $msg = GUIGetMsg() Switch $msg Case -3 Exit Case $cancel Exit Case $next GUIDelete() _Inception2() EndSwitch WEnd EndFunc Func _Inception2() Local $GuiDescription = "Follow the White Rabbit." GUICreate("",$GuiWidth,$GuiHeight) GUICtrlCreateLabel($GuiDescription,$Left,10) Local $cancel = GUICtrlCreateButton("Cancel", $Left, $Bottom,$NavButton) Local $back = GUICtrlCreateButton("Back", $NavCentered,$Bottom,$NavButton) local $next = GUICtrlCreateButton("Next", $Right, $Bottom, $NavButton) GUICtrlCreateLabel("Level 2",$GuiWidth/2,$GuiHeight/2) local $Button1 = Guictrlcreatebutton("Test 1",$Left,40,100) local $Button2 = Guictrlcreatebutton("Test 2",$Centered,40,100) local $Button3 = Guictrlcreatebutton("Test 3",$Right-25,40,100) GUISetState() While 1 Local $msg = GUIGetMsg() Switch $msg Case -3 Exit Case $cancel Exit Case $back GUIDelete() _Inception() Case $next GUIDelete() _Inception3() EndSwitch WEnd EndFunc Func _Inception3() Local $GuiDescription = "You are Fast asleep" GUICreate("",$GuiWidth,$GuiHeight) GUICtrlCreateLabel($GuiDescription,$Left,10) Local $cancel = GUICtrlCreateButton("Cancel", $Left, $Bottom,$NavButton) Local $back = GUICtrlCreateButton("Back", $NavCentered,$Bottom,$NavButton) GUICtrlCreateLabel("Level 3",$GuiWidth/2,$GuiHeight/2) local $Button1 = Guictrlcreatebutton("Test 1",$Left,100,100) local $Button2 = Guictrlcreatebutton("Test 2",$Centered,70,100) local $Button3 = Guictrlcreatebutton("Test 3",$Right-25,100,100) GUISetState() While 1 Local $msg = GUIGetMsg() Switch $msg Case -3 Exit Case $cancel Exit Case $back GUIDelete() _Inception2() EndSwitch WEnd EndFunc Again, I know there is a better way. Ideally, I liked what Valuater did in his Autoit 1-2-3 program where there was one window that changed as you hit next. I just don't know how to create something like that or, what I should even be looking for in order to study how to create that. Thank you in advance! EDIT> Edited code for clarity
- 8 replies
-
- Wizard GUI
- main menu
- (and 4 more)
-
_EnumChildWindows Enumerate controls/children of a Window This code enumerates all controls/children of a given Window and returns them in an array. Example code is included. *small change 9/15/2010: removed a #include line from the example code posted here (not required)*update 3/28/2010:Control ID is now retrieved. Unfortunately the indexing was reworked (sorry). But at least now I believe all the relevant information needed is retrieved.Parameters to the function now have a slightly different meaning. Basically, this was done to allow searching for controls with an empty-string for a Title. All defaults are now 0, so a call can be made like this to find all Controls with a 'Button' classname: _EnumChildWindows($hWnd,0,0,"Button") #include <_EnumChildWindows.au3> ; =============================================================================================================================== ; <TestEnumChildWindows.au3> ; ; Test for _EnumChildWindows UDF. ; ; Author: Ascend4nt ; =============================================================================================================================== ; =================================================================================================================== ; TEST ; =================================================================================================================== #include <Array.au3> Local $hWnd="",$hControl="",$sTitle="",$sClass="",$aEnumList Local $iCalcPID,$hNumber1Button=-1,$hNumber4Button=-1,$hPlusButton=-1,$hEqualButton=-1 $iCalcPID=Run("calc.exe") If @error Then Exit $hWnd=WinWait("Calculator") If $hWnd=0 Then Exit ProcessClose($iCalcPID) ; Important to wait for the window to fully 'create' itself before getting child windows! ; Note that other processes that become activated somewhere between _WinWaitEx and this will cause WinWaitActive() to wait for manual activation ;WinWaitActive($hWnd) ; bad idea in busy environment WinActivate($hWnd) ; this seems to be a better alternative, the window seems fully created after this is called in my tests ; Parameters to function ;$hControl=HWnd(0x########) ;$sTitle="^(\d|\+|=){:content:}quot; ;$sClass="Button" $aEnumList=_EnumChildWindows($hWnd,$hControl,$sTitle,$sClass) ;,2) for RegExp Title If @Error Then Exit ProcessClose($iCalcPID) ; Find specific items [Certain versions of Calc won't return any text] For $i=1 to $aEnumList[0][0] Switch $aEnumList[$i][3] Case "1" $hNumber1Button=$aEnumList[$i][0] ConsoleWrite("'1' Advanced Mode Name (in current state): [CLASS:Button; INSTANCE:"&$aEnumList[$i][2]&"]"&@CRLF) Case "4" $hNumber4Button=$aEnumList[$i][0] ConsoleWrite("'4' Advanced Mode Name (in current state): [CLASS:Button; INSTANCE:"&$aEnumList[$i][2]&"]"&@CRLF) Case "+" $hPlusButton=$aEnumList[$i][0] ConsoleWrite("'+' Advanced Mode Name (in current state): [CLASS:Button; INSTANCE:"&$aEnumList[$i][2]&"]"&@CRLF) Case "=" $hEqualButton=$aEnumList[$i][0] ConsoleWrite("'=' Advanced Mode Name (in current state): [CLASS:Button; INSTANCE:"&$aEnumList[$i][2]&"]"&@CRLF) EndSwitch Next ; Add Headers $aEnumList[0][0]="Handle" $aEnumList[0][1]="Classname" $aEnumList[0][2]="Iteration" $aEnumList[0][3]="Title/Text" ; Bring the window forward WinActivate($hWnd) ; Perform a simple calculation to show interaction If $hNumber1Button<>-1 Then ControlClick($hWnd,"",$hNumber1Button,"primary",3) ControlClick($hWnd,"",$hNumber4Button) Sleep(1000) ControlClick($hWnd,"",$hPlusButton) Sleep(1000) ControlClick($hWnd,"",$hNumber4Button,"primary",2) ; double click, but that's fine Sleep(1000) ControlClick($hWnd,"",$hEqualButton) EndIf ; And Display ALL Enumerated Windows _ArrayDisplay($aEnumList,"Enumerated controls for 'Calculator'") ProcessClose($iCalcPID)Download the ZIP from my site Ascend4nt's AutoIT Code License agreement: While I provide this source code freely, if you do use the code in your projects, all I ask is that: If you provide source, keep the header as I have put it, OR, if you expand it, then at least acknowledge me as the original author, and any other authors I creditIf the program is released, acknowledge me in your credits (it doesn't have to state which functions came from me, though again if the source is provided - see #1)The source on it's own (as opposed to part of a project) can not be posted unless a link to the page(s) where the code were retrieved from is provided and a message stating that the latest updates will be available on the page(s) linked to.Pieces of the code can however be discussed on the threads where Ascend4nt has posted the code without worrying about further linking.