Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/07/2013 in all areas

  1. BinaryBrother

    Detect Antivirus

    I couldn't find a satisfactory example on the forums, mainly because the interface that I'm using is undocumented and MS wants to keep it that way. This is the first revision of this example. I just wanted to post it while I had time to give other users a better starting point. Only works on Vista+, only gets first instance of AV found. If nobody cleans this up, I'll come back in a few days and post the finished product. Windows XP has an interface [/root/SecurityCenter], but I don't need it. This returns an $Array[4] with the below information. Console: Current AV: Microsoft Security Essentials State: Enabled pathToSignedProductExe: C:\Program Files\Microsoft Security Client\msseces.exe pathToSignedReportingExe: C:\Program Files\Microsoft Security Client\MsMpEng.exe Func _GetAVInfo() Dim $lArray[4] $oWMI = ObjGet("winmgmts:\\localhost\root\SecurityCenter2") $colItems = $oWMI.ExecQuery("Select * from AntiVirusProduct") For $objAntiVirusProduct In $colItems $lArray[0] = $objAntiVirusProduct.displayName $lArray[1] = $objAntiVirusProduct.productstate $lArray[2] = $objAntiVirusProduct.pathToSignedProductExe $lArray[3] = $objAntiVirusProduct.pathToSignedReportingExe Next Dim $AvStatus = Hex($lArray[1]) If StringMid($AvStatus, 5, 2) = "10" Or StringMid($AvStatus, 5, 2) = "11" Then $lArray[1] = "Enabled" ElseIf StringMid($AvStatus, 5, 2) = "00" Or StringMid($AvStatus, 5, 2) = "01" Then $lArray[1] = "Disabled" EndIf Return $lArray EndFunc ;==>_GetAVInfo Resources: http://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/bd97d9e6-75c1-4f58-9573-9009df5de19b/security-center-api http://social.msdn.microsoft.com/Forums/en-US/6501b87e-dda4-4838-93c3-244daa355d7c/wmisecuritycenter2-productstate http://screen317.spywareinfoforum.org/ http://neophob.com/2010/03/wmi-query-windows-securitycenter2 Another method to check for Antivirus/Firewall status http://chentiangemalc.wordpress.com/2013/04/09/accessing-windows-security-centre-status-from-powershell/ http://msdn.microsoft.com/en-us/library/bb432509(VS.85).aspx
    1 point
  2. https://github.com/NYTimes/objective-c-style-guide [sarcasm] Hurrah! The programming experts at the New York Times have published their style guide for C. Start cleaning up your code folks. [/sarcasm] This was aparently written for Objective-C, but they want it to be adopted for all C-style languages. That's right. All this time, you thought turning to technical publications and fellow coders was the way to go, when in fact you should have been turning to a newspaper. [can't seem to /sarcasm]
    1 point
  3. BrewManNH

    Comparing variables

    @PincoPanco, you have a bug in your script. This will prevent your script from comparing $c to $1 so if $c = "Q", the script displays all as "not equal". $1 = "Q" $2 = "W" $3 = "Y" $4 = "U" $5 = "S" $c = "Y" dim $oracle[2] = ["not equal","equal"] for $1 = 1 to 5 ; <<<<<<<<<<<<<<<<<<<<< you're reusing the variable $1 ConsoleWrite("$" & $1 & " " & $oracle[(eval($1) == $c)] & " $c" & @crlf) next
    1 point
  4. Jos

    Possible Tidy Issue

    Uploaded Tidy v2.3.0.14 that should fix the regression you reported. Cheers Jos
    1 point
  5. I read that, they advocate this style which I have never managed to get on with if (something) { ... ... .. } I stopped reading after that
    1 point
  6. Wow. Someone who actually understands what a reproducer is. How refreshing to be able to focus on solving a problem instead of repeatedly dragging people through the troubleshooting process. Unfortunately, in this case, it just results n me telling you that I have never seen this before and I am surprised at the results that you obtained. What I have done when faced with surprising results like this is 1) rewrite your AutoIt reproducer in VBscript and insure that the behavior is the same and 2) take your VBscript reproducer to the appropriate Microsoft Community forum and ask about it there where the population of DOM experts and Microsoft DOM developers is much higher and 3) come back here and report the results of that investigation. Dale
    1 point
  7. mLipok

    Detect Antivirus

    Works with Trend Micro Client/Server Security Agent Antivirus Thanks this is very useful
    1 point
  8. You commented out the call to the 2nd function. Change this: ;~ $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl) to this: _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl) ALso, the list of variables to send to the second functioin needs to come before the call to the second function. Thusly: func main() Local $oExcel = _ExcelBookOpen(@DesktopDir & "\test.xls", 0) Local $Number = '' Local $Email = '' For $i = 1 To 10 $Number = _ExcelReadCell($oExcel, $i, 1) ; You assign to this but do nothing with it $Email = _ExcelReadCell($oExcel, $i, 2) ; You assign to this but do nothing with it $SmtpServer = "MailServer" ; address for the smtp-server to use - REQUIRED $FromName = "Name" ; name from who the email was sent $FromAddress = $Email ; address from where the mail should come $ToAddress = "your@Email.Address.com" ; destination address of the email - REQUIRED $Subject = "Userinfo" ; subject from the email - can be anything you want it to be $Body = "" ; the messagebody from the mail - can be left blank but then you get a blank mail $AttachFiles = "" ; the file(s) you want to attach seperated with a ; (Semicolon) - leave blank if not needed $CcAddress = "CCadress1@test.com" ; address for cc - leave blank if not needed $BccAddress = "BCCadress1@test.com" ; address for bcc - leave blank if not needed $Importance = "Normal" ; Send message priority: "High", "Normal", "Low" $Username = "******" ; username for the account used from where the mail gets sent - REQUIRED $Password = "********" ; password for the account used from where the mail gets sent - REQUIRED $IPPort = 25 ; port used for sending the mail $ssl = 0 _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl) If @error Then MsgBox(0, "Error sending message", "Unable to find specified file name.") EndIf ; enables/disables secure socket layer sending - put to 1 if using httpS next EndFunc
    1 point
  9. Sorry I missed the question above: Bitcoin and JSON allow you to write your own interface to do things that the "basic" wallet supports, but does not have currently built into the GUI interface. You could build a completely functional local or remote wallet from AUTOIT if you wanted to (JSON provides you almost unlimited control of the daemon). That still may be vague, but think of Bitcoin like "electronic cash" and JSON as a way to programatically interact with that wallet.
    1 point
  10. another way to make the entire gui movable for every control is: . ;http://www.autoitscript.com/forum/topic/153261-who-wants-to-help-me-learn-enhanced-gui-building/page-2#entry1104018 ;Post #19 ;D:\DOKUME~1\ADMINI~1\LOKALE~1\Temp\SLICER\Avatar\photo-thumb-79839.png ;by Wombat ;Script grabbed by SLICER by Edano here: http://www.autoitscript.com/forum/topic/152402-slicer-autoit-forum-script-grabber/?p=1093575 Opt("GUIOnEventMode",1) $GUI=GUICreate("SLICER by Edano",130,17,1,0,0x80800000);,0x100000);$WS_POPUP+$WS_BORDER;$GUI_WS_EX_PARENTDRAG GUISetIcon(@SystemDir&"\shell32.dll",-45) GUISetFont(8,1000,0,"Arial") GUISetBkColor(0) GUICtrlSetState(GUICtrlCreateLabel("",0,0,130,19),128) GUICtrlSetBkColor(-1,0xFFFFFF) ; by Edano GUICtrlSetFont(GUICtrlCreateLabel(" SLICER",0,1,98,14,512),9);,0x100000),9);,800,0,"Tahoma");ex_parentdrag GUICtrlSetBkColor(-1,0xFF0000) GUICtrlSetColor(-1,0xFFFFFF) GUICtrlCreateIcon(@SystemDir&"\shell32.dll",-45,2,3,10,10) GUICtrlSetCursor(GUICtrlCreateLabel("+",98,1,10,14,512),0);,0x100000),0);ex_parentdrag GUICtrlSetTip(-1,"Always on top") GUICtrlSetBkColor(-1,0xFF0000) GUICtrlSetColor(-1,0xFFFFFF) ;GUICtrlSetOnEvent(-1,"_Top") GUICtrlSetFont(-1,11) GUICtrlSetCursor(GUICtrlCreateLabel(Chr(150),108,1,10,14,513),0);,0x100000),0);ex_parentdrag ;GUICtrlSetOnEvent(-1,"_Minimize"); "–" GUICtrlSetBkColor(-1,0xFF0000) GUICtrlSetColor(-1,0xFFFFFF) ;GUICtrlSetTip(-1,"Minimize") GUICtrlSetFont(-1,10) GUICtrlSetCursor(GUICtrlCreateLabel("x",118,1,12,14,513),0);,0x100000),0);ex_parentdrag GUICtrlSetBkColor(-1,0xFF0000) ;GUICtrlSetOnEvent(-1,"_Exit") GUICtrlSetColor(-1,0xFFFFFF) GUICtrlSetTip(-1,"Exit") GUICtrlSetFont(-1,9) GUICtrlSetBkColor(GUICtrlCreateLabel("",0,16,130,2),0xF20000);,-1,0x100000),0xF20000);ex_parentdrag GUISetOnEvent(-7,"_Drag") GUISetState() while sleep(20) wend Func _Drag() DllCall("user32.dll","int","SendMessage","hwnd",@GUI_WinHandle,"int",274,"int",0xF012,"int",0) EndFunc . here the gui will move with the mouse as long as left mouse button is pressed over the gui ("-7"). (good for touch screens) Edit: only in on-event-mode of course Edit: sorry had to edit the code 100 times. should be ok now
    1 point
  11. 1 point
  12. First things first, there's no function GUICtrlSet, you're looking for GUICtrlSetData. Second, you have @SW_HIDE in the "working dir" parameter and the last parameter is in the "show_flag" parameter. Third, do you want this to update as it's running, or after the ping command has finished, or does it matter? The code below shows both methods regarding point #3, you can choose one or the other, or both for that matter because the second one will overwrite the first one's entries with the total received text. #include <Constants.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) ; Change to OnEvent mode Dim $hWin = GUICreate("Ping", 400, 200) Dim $hEdit = GUICtrlCreateEdit("", 5, 5, 390, 190);,$GUI_SS_DEFAULT_EDIT - $WS_HSCROLL + $ES_READONLY) GUISetOnEvent($GUI_EVENT_CLOSE, "_Die") GUISetState(@SW_SHOW) _Ping("yahoo.com") While True Sleep(1000) WEnd Func _Die() GUIDelete($hWin) Exit EndFunc ;==>_Die Func _Ping($Target) Local $hWndCmd = Run(@ComSpec & " /c ping " & $Target, "", @SW_HIDE, $STDIN_CHILD + $STDERR_MERGED) Local $sCmdOutput= "", $LastCmdOutput = "" While True $sCmdOutput &= StdoutRead($hWndCmd) If @error Then ExitLoop ; this section will display it as it is being read If $sCmdOutput <> $LastCmdOutput Then GUICtrlSetData($hEdit, $sCmdOutput) $LastCmdOutput = $sCmdOutput EndIf ; end section WEnd GUICtrlSetData($hEdit, $sCmdOutput) ; this will display it after the ping command has finished ;~ MsgBox(0, Default, $sCmdOutput) EndFunc ;==>_Ping
    1 point
  13. Malkey, I was having an internal wager whether it would be you or jchd who posted an SRE solution - my left hand won! M23
    1 point
  14. Added: Multiple web-hosting #cs Resources: Internet Assigned Number Authority - all Content-Types: http://www.iana.org/assignments/media-types/ World Wide Web Consortium - An overview of the HTTP protocol: http://www.w3.org/Protocols/ Credits: Manadar for starting on the webserver. Alek for adding POST and some fixes Creator for providing the "application/octet-stream" MIME type. #ce #include <Misc.au3> ; Only used for _Iif #include <Array.au3> ; // OPTIONS HERE // Local $sRootDir = @ScriptDir & "\" ; The absolute path to the root directory of the server. Local $sIP = @IPAddress1 ; ip address as defined by AutoIt Local $iPort = 80 ; the listening port Local $sServerAddress = "http://" & $sIP & ":" & $iPort & "/" Local $iMaxUsers = 15 ; Maximum number of users who can simultaneously get/post Local $sServerName = "ManadarX/1.1 (" & @OSVersion & ") AutoIt " & @AutoItVersion ; // END OF OPTIONS // Local $aSocket[$iMaxUsers] ; Creates an array to store all the possible users Local $sBuffer[$iMaxUsers] ; All these users have buffers when sending/receiving, so we need a place to store those Local $sDomain = '' ;which domain has been requested by the client For $x = 0 To UBound($aSocket) - 1 ; Fills the entire socket array with -1 integers, so that the server knows they are empty. $aSocket[$x] = -1 Next TCPStartup() ; AutoIt needs to initialize the TCP functions $iMainSocket = TCPListen($sIP, $iPort) ;create main listening socket If @error Then ; if you fail creating a socket, exit the application MsgBox(0x20, "AutoIt Webserver", "Unable to create a socket on port " & $iPort & ".") ; notifies the user that the HTTP server will not run Exit ; if your server is part of a GUI that has nothing to do with the server, you'll need to remove the Exit keyword and notify the user that the HTTP server will not work. EndIf ConsoleWrite("Server created on " & $sServerAddress & @CRLF) ; If you're in SciTE, While 1 $iNewSocket = TCPAccept($iMainSocket) ; Tries to accept incoming connections If $iNewSocket >= 0 Then ; Verifies that there actually is an incoming connection For $x = 0 To UBound($aSocket) - 1 ; Attempts to store the incoming connection If $aSocket[$x] = -1 Then $aSocket[$x] = $iNewSocket ;store the new socket ExitLoop EndIf Next EndIf For $x = 0 To UBound($aSocket) - 1 ; A big loop to receive data from everyone connected If $aSocket[$x] = -1 Then ContinueLoop ; if the socket is empty, it will continue to the next iteration, doing nothing $sNewData = TCPRecv($aSocket[$x], 1024) ; Receives a whole lot of data if possible ;~ ConsoleWrite($sNewData & @CRLF) If @error Then ; Client has disconnected $aSocket[$x] = -1 ; Socket is freed so that a new user may join ContinueLoop ; Go to the next iteration of the loop, not really needed but looks oh so good ElseIf $sNewData Then ; data received $sBuffer[$x] &= $sNewData ;store it in the buffer If StringInStr(StringStripCR($sBuffer[$x]), @LF & @LF) Then ; if the request has ended .. $sFirstLine = StringLeft($sBuffer[$x], StringInStr($sBuffer[$x], @LF)) ; helps to get the type of the request $sRequestType = StringLeft($sFirstLine, StringInStr($sFirstLine, " ") - 1) ; gets the type of the request If $sRequestType = "GET" Then ; user wants to download a file or whatever .. $sRequest = StringTrimRight(StringTrimLeft($sFirstLine, 4), 11) ; let's see what file he actually wants If StringInStr(StringReplace($sRequest, "\", "/"), "/.") Then ; Disallow any attempts to go back a folder _HTTP_SendFileNotFoundError($aSocket[$x]) ; sends back an error Else If $sRequest = "/" Then ; user has requested the root $sRequest = "/index.html" ; instead of root we'll give him the index page EndIf $sRequest = StringReplace($sRequest, "/", "\") ; convert HTTP slashes to windows slashes, not really required because windows accepts both $sDomain = StringRegExp($sNewData, '(?i)host:(.*)', 3) ; extract the fqdn from the client request $sRootDir &= IniRead('hosts.ini', 'hosts', StringStripWS($sDomain[0], 3), 'www') ; construct the path ConsoleWrite('$sRootDir ' & $sRootDir & @CRLF) If FileExists($sRootDir & $sRequest) Then ; makes sure the file that the user wants exists $sFileType = StringRight($sRequest, 4) ; determines the file type, so that we may choose what mine type to use ConsoleWrite($sRootDir & $sRequest & @CRLF) Switch $sFileType Case "html", ".htm" ; in case of normal HTML files _HTTP_SendFile($aSocket[$x], $sRootDir & $sRequest, "text/html") Case ".css" ; in case of style sheets _HTTP_SendFile($aSocket[$x], $sRootDir & $sRequest, "text/css") Case ".jpg", "jpeg" ; for common images _HTTP_SendFile($aSocket[$x], $sRootDir & $sRequest, "image/jpeg") Case ".png" ; another common image format _HTTP_SendFile($aSocket[$x], $sRootDir & $sRequest, "image/png") Case Else ; this is for .exe, .zip, or anything else that is not supported is downloaded to the client using a application/octet-stream _HTTP_SendFile($aSocket[$x], $sRootDir & $sRequest, "application/octet-stream") EndSwitch Else _HTTP_SendFileNotFoundError($aSocket[$x]) ; File does not exist, so we'll send back an error.. EndIf EndIf ElseIf $sRequestType = "POST" Then ; user has come to us with data, we need to parse that data and based on that do something special $aPOST = _HTTP_GetPost($sBuffer[$x]) ; parses the post data $sComment = _HTTP_POST("wintext", $aPOST) ; Like PHPs _POST, but it requires the second parameter to be the return value from _Get_Post _HTTP_ConvertString($sComment) ; Needs to convert the POST HTTP string into a normal string ConsoleWrite($sComment) $sDomain = StringRegExp($sNewData, '(?i)host:(.*)', 3) $sRootDir &= IniRead('hosts.ini', 'hosts', StringStripWS($sDomain[0], 3), 'www') ConsoleWrite('$sRootDir ' & $sRootDir & @CRLF) $data = FileRead($sRootDir & "\template.html") $data = StringReplace($data, "<?au3 Replace me ?>", $sComment) $h = FileOpen($sRootDir & "\index.html", 2) FileWrite($h, $data) FileClose($h) $h = FileOpen($sRootDir & "\clean.html", 2) FileWrite($h, $sComment) FileClose($h) _HTTP_SendFile($aSocket[$x], $sRootDir & "\index.html", "text/html") ; Sends back the new file we just created EndIf $sBuffer[$x] = "" ; clears the buffer because we just used to buffer and did some actions based on them $aSocket[$x] = -1 ; the socket is automatically closed so we reset the socket so that we may accept new clients EndIf EndIf $sRootDir = @ScriptDir & "\" ; since this is one huge loop where one socket is handled at a time , we have to reinitialise the path Next Sleep(10) WEnd Func _HTTP_ConvertString(ByRef $sInput) ; converts any characters like %20 into space 8) $sInput = StringReplace($sInput, '+', ' ') StringReplace($sInput, '%', '') For $t = 0 To @extended $Find_Char = StringLeft(StringTrimLeft($sInput, StringInStr($sInput, '%')), 2) $sInput = StringReplace($sInput, '%' & $Find_Char, Chr(Dec($Find_Char))) Next EndFunc ;==>_HTTP_ConvertString Func _HTTP_SendHTML($hSocket, $sHTML, $sReply = "200 OK") ; sends HTML data on X socket _HTTP_SendData($hSocket, Binary($sHTML), "text/html", $sReply) EndFunc ;==>_HTTP_SendHTML Func _HTTP_SendFile($hSocket, $sFileLoc, $sMimeType, $sReply = "200 OK") ; Sends a file back to the client on X socket, with X mime-type Local $hFile, $sImgBuffer, $sPacket, $a ConsoleWrite("Sending " & $sFileLoc & @CRLF) $hFile = FileOpen($sFileLoc, 16) $bFileData = FileRead($hFile) FileClose($hFile) _HTTP_SendData($hSocket, $bFileData, $sMimeType, $sReply) EndFunc ;==>_HTTP_SendFile Func _HTTP_SendData($hSocket, $bData, $sMimeType, $sReply = "200 OK") $sPacket = Binary("HTTP/1.1 " & $sReply & @CRLF & _ "Server: " & $sServerName & @CRLF & _ "Connection: close" & @CRLF & _ "Content-Lenght: " & BinaryLen($bData) & @CRLF & _ "Content-Type: " & $sMimeType & @CRLF & _ @CRLF) TCPSend($hSocket, $sPacket) ; Send start of packet While BinaryLen($bData) ; Send data in chunks (most code by Larry) $a = TCPSend($hSocket, $bData) ; TCPSend returns the number of bytes sent $bData = BinaryMid($bData, $a + 1, BinaryLen($bData) - $a) WEnd $sPacket = Binary(@CRLF & @CRLF) ; Finish the packet TCPSend($hSocket, $sPacket) TCPCloseSocket($hSocket) EndFunc ;==>_HTTP_SendData Func _HTTP_SendFileNotFoundError($hSocket) ; Sends back a basic 404 error Local $s404Loc = $sRootDir & "\404.html" If (FileExists($s404Loc)) Then _HTTP_SendFile($hSocket, $s404Loc, "text/html") Else _HTTP_SendHTML($hSocket, "404 Error: " & @CRLF & @CRLF & "The file you requested could not be found.") EndIf EndFunc ;==>_HTTP_SendFileNotFoundError Func _HTTP_GetPost($s_Buffer) ; parses incoming POST data Local $sTempPost, $sLen, $sPostData, $sTemp ; Get the lenght of the data in the POST $sTempPost = StringTrimLeft($s_Buffer, StringInStr($s_Buffer, "Content-Length:")) $sLen = StringTrimLeft($sTempPost, StringInStr($sTempPost, ": ")) ; Create the base struck $sPostData = StringSplit(StringRight($s_Buffer, $sLen), "&") Local $sReturn[$sPostData[0] + 1][2] For $t = 1 To $sPostData[0] $sTemp = StringSplit($sPostData[$t], "=") If $sTemp[0] >= 2 Then $sReturn[$t][0] = $sTemp[1] $sReturn[$t][1] = $sTemp[2] EndIf Next Return $sReturn EndFunc ;==>_HTTP_GetPost Func _HTTP_Post($sName, $sArray) ; Returns a POST variable like a associative array. For $i = 1 To UBound($sArray) - 1 If $sArray[$i][0] = $sName Then Return $sArray[$i][1] EndIf Next Return "" EndFunc ;==>_HTTP_Post The Hosts.ini - which is needed to define the domain-name and its associated path wrt @ScriptDir. ie. all the hosted domain folders should reside in the @ScriptDir path [Hosts] yoyo.com=yoyo www.yoyo.com=yoyo subdomain.yoyo.com=sub_yoyo gogo.co.uk=gogo Directory Structure Directory of D:\webserver_011\Post_Server <DIR> gogo <DIR> sub_yoyo <DIR> www <DIR> yoyo hosts.ini server.au3 In order to successfully test this , you will have to modify the hosts file or add records for these domains in your DNS server. eg. 192.168.93.145 localhost yoyo.com www.yoyo.com subdomain.yoyo.com gogo.co.uk Re: Anti-DDOS -- some things are still remaining.
    1 point
  15. Hi Trancexx, System is Windows 2003 Server --> thats the testing platform and its not a production server. Am using both the Apache and Manadar's http server for testing , but one at a time. Source-Code : will share it as soon as its finished (like all my other source-codes which you will find in this forum ) PS: I have also implemented multiple web-site hoisting using Manadar's code To Do this : Grab the HTTP response received from the Client ie. Browser "Host:" is the FQDN requested by the client. hence essentially, you need to create an array of domains currently hosted on the server and then modify the $sRootdir within the loop to correspond with the requested FQDN and its associated path on the file system. So small modification will allow you to host multiple domains on a single server Anti-DDOS Method in a gist: Before using TcpRecv to receive the HTTP content, grab the IP using SocketToIP() (picked up from TCPRecv eg) store the IP and kick in the DDOS Module. In Apache, after the headers are received the DDOS kicks into action. Over here we simply do this task at time of Socket creation. After TCPRecv receive we validate the headers - if found incorrect -- simply close the socket and proceed ahead. This way you are skipping a lot of code processing and saving time. The ideology is similar to manner in which we handle exceptions. Secondly, how we perceive a DDOS attack differs from person to person. This above method doesn't stop DNS R-DDOS (reflective DDOS) as the ports are different and services running on these ports are different. Any other questions / queries , please ask. regards DeltaRocked
    1 point
  16. Here's a snippet that demonstrates how to use the _GUIToolTip_xxx UDF functions, it's only a brief demo showing some of the techniques to use them. There are no examples in the help file that show how to create them, display them, or use them in general, so I had to figure this out by grabbing snippets here and there from around the internet and seeing how they work. There are several UDFs that utilize the tooltip UDF with explanations on how to use them with the controls that they are made for, for example the ListView and Tabs UDFs have functions that allow you to create tooltips for those controls, but not any general purpose examples are around the forum. It took me a while to find out how to get these to work but once I got the basics down they weren't hard to use at all. This script shows you how to create the tooltip, and how you can color them once they're created. It's heavily commented so it should be easy to follow. Take note of the comment after the _GUIToolTip_SetTipTextColor function, it's important to realize how to color the text correctly. #include <GUIConstantsEx.au3> #include <GUIToolTip.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $MESSAGE = "The following buttons have been clicked" Local $add, $clear, $close, $msg, $mylist Local $hGUI = GUICreate("My GUI list") Local $hToolTip = _GUIToolTip_Create($hGUI, $TTS_BALLOON) ; create a balloon style tooltip control ; turn off visual style for the tooltip otherwise color settings won't work DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", $hToolTip, "wstr", 0, "wstr", 0) ; if you remove the previous line the tooltip displays normally, but you can't color it $add = GUICtrlCreateButton("Add", 64, 32, 75, 25) Local $hAdd = GUICtrlGetHandle($add) ; we need handles of the controls to use them with the tooltips $clear = GUICtrlCreateButton("Clear", 64, 72, 75, 25) Local $hClear = GUICtrlGetHandle($clear) $mylist = GUICtrlCreateList("buttons that have been clicked", 176, 32, 121, 97) Local $hMylist = GUICtrlGetHandle($mylist) $close = GUICtrlCreateButton("my closing button", 64, 160, 175, 25) Local $hClose = GUICtrlGetHandle($close) GUISetState() ; the last number (9) in the below functions indicates that the $iID parameter is a handle to the control and not an identifier of the tooltip ; as well as subclassing the tooltip control _GUIToolTip_AddTool($hToolTip, 0, "Add something to the list", $hAdd, 0, 0, 0, 0, 9) ; this sets a tooltip to the add button _GUIToolTip_AddTool($hToolTip, 0, "This is the close button", $hClose, 0, 0, 0, 0, 9) ; this sets a tooltip to the close button _GUIToolTip_AddTool($hToolTip, 0, "This is the ListBox", $hMylist, 0, 0, 0, 0, 9) ; this sets a tooltip to the list control _GUIToolTip_AddTool($hToolTip, 0, "Clear the list box", $hClear, 0, 0, 0, 0, 9) ; this sets a tooltip to the clear button _GUIToolTip_AddTool($hToolTip, 0, "This is a tooltip for the whole GUI", $hGUI, 0, 0, 0, 0, 9) ; this sets a tooltip to the GUI, and not any control _GUIToolTip_SetTipBkColor($hToolTip, "0xA6EEA4") ; RGB value of the color for the background of the tooltip _GUIToolTip_SetTipTextColor($hToolTip, "0x6835EE") ; ColorRef value (BGR instead of RGB) for the text color of the tooltip While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $add GUICtrlSetData($mylist, "You clicked button No1|") Case $msg = $clear GUICtrlSetData($mylist, "") Case $msg = $close MsgBox(0, "", "the closing button has been clicked", 2) Exit EndSelect WEnd EndFunc ;==>Example
    1 point
  17. Here is a modified version of the original script, this modification demonstrates that you can use multiple ToolTip controls and have different settings apply to each of them. #include <GUIConstantsEx.au3> #include <GUIToolTip.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $MESSAGE = "The following buttons have been clicked" Local $add, $clear, $close, $msg, $mylist Local $hGUI = GUICreate("My GUI list") Local $hToolTip1 = _GUIToolTip_Create($hGUI, $TTS_BALLOON) ; create a balloon style tooltip control Local $hToolTip2 = _GUIToolTip_Create($hGUI, $TTS_BALLOON) ; create a balloon style tooltip control ; turn off visual style for the tooltip otherwise color settings won't work DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", $hToolTip1, "wstr", 0, "wstr", 0) ; if you remove the previous line the tooltip displays normally, but you can't color it ; This line will allow the tooltip to show multiple lines. If the line is too long to fit, it will be ; wrapped to the next line. If you add @CRLF to the tip text without this line, it will only display the firstline ; of text. _GUIToolTip_SetMaxTipWidth($hToolTip1, 1000) ;;1000 is only proforma, you can set it longer or shorter $add = GUICtrlCreateButton("Add", 64, 32, 75, 25) Local $hAdd = GUICtrlGetHandle($add) ; we need handles of the controls to use them with the tooltips $clear = GUICtrlCreateButton("Clear", 64, 72, 75, 25) Local $hClear = GUICtrlGetHandle($clear) $mylist = GUICtrlCreateList("buttons that have been clicked", 176, 32, 121, 97) Local $hMylist = GUICtrlGetHandle($mylist) $close = GUICtrlCreateButton("my closing button", 64, 160, 175, 25) Local $hClose = GUICtrlGetHandle($close) GUISetState() ; the last number (9) in the below functions indicates that the $iID parameter is a handle to the control and not an identifier of the tooltip ; as well as subclassing the tooltip control _GUIToolTip_AddTool($hToolTip1, 0, "Add something to the list" & @CRLF & "Click this button", $hAdd, 0, 0, 0, 0, 9) ; this sets a tooltip to the add button _GUIToolTip_AddTool($hToolTip1, 0, "This is the close button", $hClose, 0, 0, 0, 0, 9) ; this sets a tooltip to the close button _GUIToolTip_AddTool($hToolTip1, 0, "This is the ListBox", $hMylist, 0, 0, 0, 0, 9) ; this sets a tooltip to the list control ; Because these tools are added to ToolTip2, the visual style setting doesn't apply on them ; Also, because the function _GUIToolTip_SetMaxTipWidth wasn't applied to ToolTip2, the second line for the Clear button won't show. _GUIToolTip_AddTool($hToolTip2, 0, "Clear the list box" & @CRLF & "Click this button", $hClear, 0, 0, 0, 0, 9) ; this sets a tooltip to the clear button _GUIToolTip_AddTool($hToolTip2, 0, "This is a tooltip " & @CRLF & "for the whole GUI", $hGUI, 0, 0, 0, 0, 9) ; this sets a tooltip to the GUI, and not any control _GUIToolTip_SetTipBkColor($hToolTip1, "0xA6EEA4") ; RGB value of the color for the background of the tooltip _GUIToolTip_SetTipTextColor($hToolTip1, "0x6835EE") ; ColorRef value (BGR instead of RGB) for the text color of the tooltip While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $add GUICtrlSetData($mylist, "You clicked button No1|") Case $msg = $clear GUICtrlSetData($mylist, "") Case $msg = $close MsgBox(0, "", "the closing button has been clicked", 2) Exit EndSelect WEnd EndFunc ;==>Example
    1 point
  18. Here's the same script with multiline tooltip text. #include <GUIConstantsEx.au3> #include <GUIToolTip.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $MESSAGE = "The following buttons have been clicked" Local $add, $clear, $close, $msg, $mylist Local $hGUI = GUICreate("My GUI list") Local $hToolTip = _GUIToolTip_Create($hGUI, $TTS_BALLOON) ; create a balloon style tooltip control ; turn off visual style for the tooltip otherwise color settings won't work DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", $hToolTip, "wstr", 0, "wstr", 0) ; if you remove the previous line the tooltip displays normally, but you can't color it ; This line will allow the tooltip to show multiple lines. If the line is too long to fit, it will be ; wrapped to the next line. If you add @CRLF to the tip text without this line, it will only display the firstline ; of text. _GUIToolTip_SetMaxTipWidth($hToolTip, 1000) ;;1000 is only proforma, you can set it longer or shorter $add = GUICtrlCreateButton("Add", 64, 32, 75, 25) Local $hAdd = GUICtrlGetHandle($add) ; we need handles of the controls to use them with the tooltips $clear = GUICtrlCreateButton("Clear", 64, 72, 75, 25) Local $hClear = GUICtrlGetHandle($clear) $mylist = GUICtrlCreateList("buttons that have been clicked", 176, 32, 121, 97) Local $hMylist = GUICtrlGetHandle($mylist) $close = GUICtrlCreateButton("my closing button", 64, 160, 175, 25) Local $hClose = GUICtrlGetHandle($close) GUISetState() ; the last number (9) in the below functions indicates that the $iID parameter is a handle to the control and not an identifier of the tooltip ; as well as subclassing the tooltip control _GUIToolTip_AddTool($hToolTip, 0, "Add something to the list" & @CRLF & "Click this button", $hAdd, 0, 0, 0, 0, 9) ; this sets a tooltip to the add button _GUIToolTip_AddTool($hToolTip, 0, "This is the close button", $hClose, 0, 0, 0, 0, 9) ; this sets a tooltip to the close button _GUIToolTip_AddTool($hToolTip, 0, "This is the ListBox", $hMylist, 0, 0, 0, 0, 9) ; this sets a tooltip to the list control _GUIToolTip_AddTool($hToolTip, 0, "Clear the list box", $hClear, 0, 0, 0, 0, 9) ; this sets a tooltip to the clear button _GUIToolTip_AddTool($hToolTip, 0, "This is a tooltip " & @CRLF & "for the whole GUI", $hGUI, 0, 0, 0, 0, 9) ; this sets a tooltip to the GUI, and not any control _GUIToolTip_SetTipBkColor($hToolTip, "0xA6EEA4") ; RGB value of the color for the background of the tooltip _GUIToolTip_SetTipTextColor($hToolTip, "0x6835EE") ; ColorRef value (BGR instead of RGB) for the text color of the tooltip While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $add GUICtrlSetData($mylist, "You clicked button No1|") Case $msg = $clear GUICtrlSetData($mylist, "") Case $msg = $close MsgBox(0, "", "the closing button has been clicked", 2) Exit EndSelect WEnd EndFunc ;==>Example You have to add _GUIToolTip_SetMaxTipWidth to get it to display multiline text, don't ask me why, but that's how it works.
    1 point
×
×
  • Create New...