Jump to content

DarkenRahl

Members
  • Posts

    8
  • Joined

  • Last visited

Everything posted by DarkenRahl

  1. No help from this place?
  2. I am trying networking with autoit and for one reason or the other, TCPRecv is not returning any responses. What am I doing wrong? #cs This script connects to google and retrieves the index page and echos it in a message box. #ce TCPStartup() AutoItSetOption("TCPTimeout", 10000) Global $ip, $conn, $recv $ip = TCPNameToIP("google.com") $port ="443" If $ip == "" Then MsgBox(0, "TCPNameToIP", "Failed to get the ip address") Exit EndIf MsgBox(0, "IPAddress Of Google is ", $ip) $conn = TCPConnect($ip, $port) If @error Then MsgBox(0, "TCPConnect", "Connection To server failed. " & @CRLF & "Error : " & @error) Exit EndIf MsgBox(0, "TCPConnect", "Connected to " & $ip & " : "&$port) TCPSend($conn, 'GET / HTTP/1.0' & @CRLF) If @error Then MsgBox(0, "TCPSend", "Send To server failed. " & @CRLF & "Error : " & @error) Exit EndIf MsgBox(0, "TCPSend", "Data sent to " & $ip & " : "&$port) $recv = TCPRecv($conn, 2000) If @error Then MsgBox(0, "TCPSRecv", "Recv from server failed. " & @CRLF & "Error : " & @error) Exit EndIf MsgBox(0, "Data", $recv)
  3. Thank you Danifirex
  4. I'm still trying Dll's in autoit.. This time the GetClipboardData function. I wrote a code an am wondering if its the ideal way to get clipboard data.. I hear that messing with pointers can cause programmes to malfunction. I know autoit has a more simplier way with the clipget() function but just trying to learn dll in autoit... ;//Open Clipboard for data reading $clipboardopen = DllCall("User32.dll", "bool", "OpenClipboard", "HWND", Null) If $clipboardopen[0] <> 0 Then ;//Get Clipboard data.. $clipbaordget returns a pointer $clipboardget = DllCall("User32.dll", "handle", "GetClipboardData", "UINT", 1) ;//We create struct with pointer of $clipboardget $struct = DllStructCreate("struct;char var1[128];endstruct", $clipboardget[0]) ;//We get the data of the pointer with structgetdata $results = DllStructGetData($struct, "var1") MsgBox(64, "Struct Pointer", $results) EndIf
  5. Thanks to you all. I figured out the problem with your help. All the parameters of the SYSTEMTIME struct needed be filled with the dllstructsetdata before anything happened. The final script required admin to run. The finished code is so. #RequireAdmin #include <WinAPI.au3> #include <WinAPIDiag.au3> Local $setTime = DllStructCreate("WORD wYear; WORD wMonth; WORD wDayOfWeek; WORD wDay; WORD wHour; WORD wMinute; WORD wSecond; WORD wMilliseconds") DllStructSetData($setTime, 1, 2012) DllStructSetData($setTime, 2, 6) DllStructSetData($setTime, 4, 2) DllStructSetData($setTime, 5, 11) DllStructSetData($setTime, 6, 54) DllStructSetData($setTime, 7, 32) DllStructSetData($setTime, 8, 254) Local $aRet=DllCall("Kernel32.dll", "bool", "SetLocalTime", "ptr", DllStructGetPtr($setTime)) if @error Then MsgBox(16,"Error","Error DllCall") Exit EndIf If $aRet[0]=0 Then Local $iError=_WinAPI_GetLastError() MsgBox(16,"Error SetLocalTime",_WinAPI_GetErrorMessage($iError)) Else MsgBox(64,"Info","Everything should be OK") EndIf
  6. I run my programme with the autoit require admin function. Still the same error. Danifirex, I believe the error is from the parameter but I just don't know what to do.. ANy help?
  7. I am reading dealing with dll in autoit and I came accross this exercise. The setLocalTime function in the kernel32.dll is supposed to set the local time of the machine (at least that's how i understand it). My code runs and echos the new time in the msgbox but the time fails to change on the system. Am i doing anything wrong? $setTime = DllStructCreate("WORD wYear; WORD wMonth; WORD wDayOfWeek; WORD wDay; WORD wHour; WORD wMinute; WORD wSecond; WORD wMilliseconds") DllStructSetData($setTime, "wHour", 3) DllStructSetData($setTime, "wMinute", 35) DllStructSetData($setTime, "wYear", 1608) DllCall("Kernel32.dll", "int", "SetLocalTime", "ptr", DllStructGetPtr($setTime)) MsgBox(64, "Dll Time Function", "The time is " & DllStructGetData($setTime, "wHour")& ':' & DllStructGetData($setTime, "wMinute") & " PM")
×
×
  • Create New...