Jump to content

VicTT

Active Members
  • Posts

    360
  • Joined

  • Last visited

Everything posted by VicTT

  1. http://www.aptuner.com/ftp/apmain/APTunerInstall308.exe The above is a link to the application I'm attempting to automate. AutoIt Window Info reveals 3 controls of Class "AfxWnd80s" that I suspect are Windows on their own. I am attempting to get handles to them and extract a class list (though I'm not exactly sure this is the way to go around it): $subwinhandle returned is not null (for i={1,3} - AfxWnd80s1 has no ID in AutoIt Window info, Ctrl_ID(AfxWnd80s2)=1, Ctrl_ID(AfxWnd80s3)=3 ), but WinGetClassList does not return anything for i={1,2,3} I'm attempting to read some text from AfxWnd80s2 (Text below Cents and Note) in the area denoted 2 in the screenshot. I'm not even sure this *can* be done, and if the handles returned by GetDlgItem are valid, or even if I'm calling the right function to get them. Any help would be greatly appreciated. Thank you in advance. #include <WinAPI.au3> $h=WinGetHandle("AP Tuner") $x="AfxWnd80s" for $i=1 to 3 $y=ControlGetHandle($h,"","[CLASS:"&$x&"; INSTANCE:"&$i&"]") $subwinhandle=_WINAPI_GetDlgItem($h,$i) $z=_WinGetClassList($subwinhandle) MsgBox(0,$subwinhandle,$z) next
  2. Just in case anyone cares, or needs the working code: This works after refactoring: #include <Array.au3> Global $dllhandle=DllOpen("kernel32.dll") Func DebugDllCall($ret,$error,$extended) if $error then ConsoleWrite("DllCall error: "&DllCallErrorTranslate($error)) Return SetError(1,$error,0) ;DllCall error endif if $ret[0]=0 then ConsoleWrite("API error: "&_WinAPI_GetLastErrorMessage()) Return SetError(2,-1,0) endif Return $ret EndFunc Func DllCallErrorTranslate($errorcode) Select Case $errorcode=1 Return "Unable to use the DLL file" Case $errorcode=2 Return "Unknown return type" Case $errorcode=3 Return "Function not found in DLL file" Case $errorcode=4 Return "Bad number of parameters" Case Else Return $errorcode EndSelect EndFunc Func API_GlobalAlloc($nrbytes,$movable=1,$zinit=1) Local $flags=0 if $zinit then $flags=BitOR($flags,0x0040) if $movable then $flags=BitOR($flags,0x0002) $ret=DllCall($dllhandle,"ptr","GlobalAlloc","uint",$flags,"dword",$nrbytes) DebugDllCall($ret,@error,@extended) Return $ret[0] EndFunc Func API_GlobalSize($ptr) $ret=DllCall($dllhandle,"dword","GlobalSize","ptr",$ptr) DebugDllCall($ret,@error,@extended) Return $ret[0] EndFunc $h=API_GlobalAlloc(1028) ConsoleWrite(API_GlobalSize($h))
  3. My code is the following: #include <Array.au3> Global $dllhandle=DllOpen("kernel32.dll") Func DebugDllCall($cstring) $parameter_arr=StringSplit($cstring,";",1) $parameter_arr[0]="CallArgArray" _ArrayDisplay($parameter_arr) Local $ret=Call("DllCall",$parameter_arr) if @error then Local $errorcode=@error ConsoleWrite(DllCallErrorTranslate($errorcode)) Return SetError(1,$errorcode,0) ;DllCall error endif if $ret[0]=0 then ConsoleWrite(_WinAPI_GetLastErrorMessage()) Return SetError(2,-1,0) endif Return $ret EndFunc Func DllCallErrorTranslate($errorcode) Select Case $errorcode=1 Return "Unable to use the DLL file" Case $errorcode=2 Return "Unknown return type" Case $errorcode=3 Return "Function not found in DLL file" Case $errorcode=4 Return "Bad number of parameters" EndSelect EndFunc Func API_GlobalAlloc($nrbytes,$movable=1,$zinit=1) Local $flags=0 if $zinit then $flags=BitOR($flags,0x0040) if $movable then $flags=BitOR($flags,0x0002) $ret=DebugDllCall($dllhandle&";ptr;GlobalAlloc;uint;"&$flags&";dword;"&$nrbytes) ;MsgBox(0,"",$ret) Return $ret[0] EndFunc Func API_GlobalSize($ptr) $ret=DebugDllCall($dllhandle&";dword;GlobalSize;ptr;"&$ptr) Return $ret[0] EndFunc $h=API_GlobalAlloc(1024) ConsoleWrite(API_GlobalSize($h)) I'm running this on Vista, latest official AutoIt version. The problem occurs when API_GlobalAlloc calls DebugDllCall, which takes the ";"-delimited string and makes a parameter array for the call function from it. It works when I just DllCall and supply all of the parameters. Otherwise I get "Bad Number Of Parameters". _ArrayDisplay within DebugDllCall looks good. What am I doing wrong? EDIT: Error in my code: "Case $errorcode" should have been "Case $errorcode=4", which is the reason I was getting "Bad number of parameters". EDIT2: By adding MsgBox(0,"",@extended) after $ret=DebugDllCall($dllhandle&";ptr;GlobalAlloc;uint;"&$flags&";dword;"&$nrbytes) I get @extended=57005 (which is the @error returned by DllCall), and the documentation only provides an explanation for errors 1,2,3 and 4.What the heck does that mean? EDIT3: Apparently, I'm getting an errorcode from the call function, @error=0xDEAD=57005, saying that either "DllCall" isn't a valid function name, or I'm calling it with the wrong number of parameters. Still, from the _ArrayDisplay, that doesn't seem to be the case. EDIT4: Conclusion: I'm just an idiot that didn't rtfm. "Call" can't call "DllCall" because it can't call built-in AutoIt functions as mentioned in the Call Function Reference: "The function cannot be a built-in AutoIt function or plug-in function.". I was about to file a bug report. Meh..
  4. BUMP..Today's my birthday, and consequently I'd love an answer to my very old question
  5. These are screenshots that I hope I've made self-explanatory for anyone. I'll repeat myself a bit just to make sure: 1. I do not want to automate these windows 2. I do not want ipconfig /release or ipconfig /renew
  6. That won't achieve the 'disconnect' effect properly, as all that does is ask for another IP. I need it to disconnect from the network just like it would if I were to press the "Disconnect" button.
  7. I have recently purchased a wireless router that is giving me random spikes/disconnects on WLAN due to an unwanted water infiltration via faulty isolation of network cable. Problem is I'm trying to play a game between the Laptop (connected wirelessly, and randomly disconnecting, and reconnecting, running Vista) and the desktop (connected on LAN), and it disconnects. I want to write a script that, upon noticing the signal value drop (which is usually Windows Vista saying that it hasn't received ANY data from the router in the past few seconds), will disconnect and reconnect to the same Wireless Network. I've searched the forums, and have not found solutions that work under Vista. Until I get a new cable/router, this should help, since the main problem is the delay between when windows officially labels the connection dead and tries to reconnect (succeeding), and the 2-3 second time-frame in which the signal drops to nil. Also, the connection is labeled dead when the access is "Local only", and the solution cannot use window automation, since that would mean minimizing the game in order to deliver clicks/keypresses which is not acceptable (Yes, I am aware that you can send keypresses/mouseclicks to minimized windows using SendMessage, but that kind of solution is not what I'm looking for.). Ideas?
  8. Is there any difference with regard to speed between: a)MouseGetPos(0) and _WinAPI_GetMousePosX() b)MouseGetPos(1) and _WINAPI_GetMousePosY() Should either be used in different circumstances? What is their relation with GUIGetCursorInfo()?
  9. Given several listviews with the style $LVS_SHOWSELALWAYS and only that style (with several selected items, that need to remain that way) how should I go about determining which item was last clicked?(it won't be the only one selected)
  10. My thanks..let's hope that coding speed is directly proportional to the amount of stress.
  11. A very quick question awaiting an even quicker answer than the question required to be stated: How can you do multiple-item selection on an ListView Control? (from the user perspective) It has a style called $LVS_SINGLESEL which lets only one item be selected at the same time. It's urgent, because the project I'm working on is basicly due today. Project=long story.
  12. Can you demonstrate through a piece of code? EDIT: Especially referring to the "set the picture as a background" and "disable it" part. EDIT2: Disabling it through GuiCtrlSetState(-1,$GUI_DISABLE).
  13. I need to build the GUI EXACTLY like in the 2 pictures I uploaded..I don't know how to put the graphic of the button over the button control and NOT have them affect each other (such as, when clicking the Button, it gets on top of the graphic, and stuff like that)..Or how would I build those tabs, so that when I click them, an edit box to appear? EDIT: The tab thing would be solved through child-windows, but that still leaves the button-graphic problem unsolved..also, the only way I've thought about getting those tabs exactly like in the picture is putting a huge graphic control and checking for clicks on certain areas to activate a certain child window..If you have ideas, or even better...much better...excellent actually...SAMPLE CODE...I'd be more than happy...I'd be extatic...
  14. Download the zip archive and look a bit through it..if you can tell me why in heaven's name I get @error=3 Function Not Found, even though the function is in the dll's export table, then you get a free cookie on the house.. EDIT: Solved through the use of a hex-viewer
  15. If you are refering to the old one that you copy&pasted from, no I haven't because I have no idea where to get it from... EDIT: I have the latest one, in which the function looks something like: Func _TreeView_GetText($hWnd, $hNode) Local $iItem, $tItem, $pItem, $pBuffer, $tBuffer, $pMemory, $tMemMap, $pText $tBuffer = _tagCHARARRAY(4096) $pBuffer = _tagGetPtr($tBuffer) $tItem = __tagTVITEMEX() $pItem = _tagGetPtr($tItem) _tagSetData($tItem, "Mask" , $TVIF_TEXT) _tagSetData($tItem, "hItem" , $hNode ) _tagSetData($tItem, "TextMax", 4096 ) if _Lib_InProcess($hWnd) then _tagSetData($tItem, "Text", $pBuffer) _API_SendMessage($hWnd, $TVM_GETITEM, 0, $pItem) else $iItem = _tagGetSize($tItem) $pMemory = _Mem_Init($hWnd, $iItem + 4096, $tMemMap) $pText = $pMemory + $iItem _tagSetData($tItem, "Text", $pText) _Mem_Write($tMemMap, $pItem, $pMemory, $iItem) _API_SendMessage($hWnd, $TVM_GETITEM, 0, $pMemory) _Mem_Read($tMemMap, $pText, $pBuffer, 4096) _Mem_Free($tMemMap) endif Return _tagGetData($tBuffer, 1) EndFunc
  16. Hmm...One big problem...I don't have the def's of _DllStructSetData and don't know how the _Mem's work...Hmmm...If this could be reduced to something more readable so that I wouldn't have to bounce back and forth between UDF definitions, it would be great... As far as I understood, using _Mem_Init() you allocate 4k of memory, and use that as a buffer zone..Anyone can write to that, but it's still not clear how I would do that..You can read it...It's still very unclear..
  17. So how would I do it?I'm seeing A3LMemory.au3 as being useful...But with all the funny redefinitions/naming scheme of the functions, I don't really understand how to use it..
  18. I just picked it as being the first 'untaken' (according to the helpfile) message, and used that....
  19. I'm sure it could prove useful, and I will implement it as soon as I can..Any ideas on why my program(s) don't work, though? Thank you for answering ...It only took you 30 minutes, while others have been ignoring it for 5 days..
  20. The exact kind of unhelpful comment used solely for incrementing your post count..At least be a dear and help the man out if he has complied to your crudely-stated demands..Or is that too much of a hassle for a {post_count++;} you can achieve by posting one-liners in the Chat Forum?
  21. Sender: #include <Misc.au3> $x=DllStructCreate("char[6]") DllStructSetData($x,1,"Hello") _SendMessage(WinGetHandle("RECEIVER"),0x0401,DllStructGetPtr($x),DllStructGetSize($x)) #cs Attempted fixes: 1. Using types "dword", or "ptr" as parameter 6 of _SendMessage #ce Receiver: Global $t="RECEIVER" Func Rcvd($hwnd,$msg,$w,$l) if $msg=0x0401 then MsgBox(64,$t,"Got the message..wparam(pointer) is "&$w&" and lparam(size) is "&$l,1) $struct=DllStructCreate("char["&$l&"]",$w) if @error then Return MsgBox(16,$t,"Could not alloc dllstruct") if IsDllStruct($struct) then MsgBox(64,"","We have the structure!",1) if DllStructGetPtr($struct)=$w then MsgBox(64,"","We even have it at the same address!",1) $a=DllStructGetData($struct,1) if @error then MsgBox(48,$t,"Failed to get the data from the dllstruct(WHY??!!)..Failed with error "&@error,3) else MsgBox(32,"","Damn..It worked..Data received: "&$a) endif endif EndFunc GUICreate("RECEIVER") GUIRegisterMsg(0x0401,"Rcvd") while 1 Sleep(50) wend The problem is that I'm getting the structure, apparently at the same address, but I'm getting @error=2 when calling DllStructGetData($struct,1) to get the "hello"..I'm really stuck, and would heartfully appreciate any input on the matter...I'm sure the bigger half of you know more Windows API than me..
  22. #include "FTP.au3" $conn=_FTPOpen("Agent") $session=_FTPConnect($conn,"81.196.20.133","coolschool","mishusss") if @error then MsgBox(0,"","Error connecting") _FTPGetFile($session,"http://www.coolschool.home.ro/didit.swf",@ScriptDir&"\didit.swf") I'm trying to connect to www.coolschool.home.ro, port 21 and get didit.swf...It's giving me a connect error...Am I using the right calling scheme?
  23. Maybe if you would post the program you used to build the cypher, or give at least 2-3 more examples, I could try.. Otherwise, it's pretty hard to find patterns..
×
×
  • Create New...