nznet Posted March 17, 2012 Author Share Posted March 17, 2012 Hi John, Sorry about that... should not have missed the array part. I have chnaged to the following: #include <Array.au3> Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") $hWnd = WinGetHandle("Notepad") $Struct = DllStructCreate('wchar[1024]') $text = DllCall("tgsdkx.dll","int","CaptureFromHWND","hwnd",$hwnd, "ptr", $struct) If IsArray($text) Then MsgBox(0, "Text", $text[0]) Else MsgBox(0, "Error", @error) EndIf ;_ArrayDisplay($text, "Text") Func MyErrFunc() Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & hex($oMyError.number,8) & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) Endfunc The error message that is returned is '0'. Thanks, Stephen Link to comment Share on other sites More sharing options...
JohnOne Posted March 17, 2012 Share Posted March 17, 2012 (edited) Well if the @error is 0 (which means success) the return ($text) should be an array, and theerror message should never show, so that has me stumped.But you are passing it a struct, instead of a pointer to a struct.it could also mean that it simply is not possible to use it in that fashion.in any case, look up DllStructGetData() function, and test it for a value.or since this is a dll calltry$Struct = DllStructCreate('str')$StrPtr = DllStructGetPtr($Struct)DllStructSetData($Struct,1)$text = DllCall("tgsdkx.dll","int","CaptureFromHWND","hwnd",$hwnd,"ptr", $StrPtr )Or$Struct = DllStructCreate('str')DllStructSetData($Struct,1,"")$text = DllCall("tgsdkx.dll","int","CaptureFromHWND","hwnd",$hwnd,"struct", $Struct )etc...Try passing the struct ByRefetc...But my guess, is you simply cannot use dll in this fashion. Edited March 17, 2012 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Richard Robertson Posted March 17, 2012 Share Posted March 17, 2012 As far as I know COM in AutoIt doesn't support parameters passed by reference. Link to comment Share on other sites More sharing options...
nznet Posted March 17, 2012 Author Share Posted March 17, 2012 Hi John, Tried your other two suggestions. Both return an error returns '0'. Thanks Stephen Link to comment Share on other sites More sharing options...
nznet Posted March 28, 2012 Author Share Posted March 28, 2012 (edited) Hi Guys, Sorry Richard... I did not respond to your posting the other week. Thanks for pitching in. And Thanks John for your Valent atempt to help. However, is there any other suggestions anyone can give. If it means I need to go back to TextGrab to have them modify a dll to suit I am prepared to do this if I know what changes need to be made. Kind Regards Stephen Edited March 28, 2012 by nznet Link to comment Share on other sites More sharing options...
drum Posted March 2, 2013 Share Posted March 2, 2013 Did you ever get the TextGrab library to work?? I am looking at it for a project I am working on. Link to comment Share on other sites More sharing options...
drum Posted March 2, 2013 Share Posted March 2, 2013 I have had a quick play with the last code from Stephen, and something is fundermentally wrong with either the code, mysetup or my myunderstanding because even if I feed the DllCall complete gibberish I get the exact same "0" result. Link to comment Share on other sites More sharing options...
careca Posted March 12, 2013 Share Posted March 12, 2013 If i wanted to do something like that, i would, 1. detect mouse click, 2. select everything. 3. Copy to clipboard. Now this may be stupid, or out of context as i haven't bothered to read all posts, but it's just my 2 cents. Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now