Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/27/2012 in all areas

  1. water

    Call script with arguments?

    Glad to be of service
    1 point
  2. Jos

    Help inetget doesn't work!

    You have been acting very impatient and have been pretty unclear about what your problems are and not showing too much effort yourself.I have no desire to help people that act like you do. Clear enough? Jos
    1 point
  3. 1 point
  4. Thanks for sharing, good luck.
    1 point
  5. doudou

    AutoItObject UDF

    I have some questions about _AutoItObject_WrapperCreate(): Would it create an AutoIt object from any IUnknown pointer (there are several plain Win API functions that return interface pointers to system objects)?If answer to #1 is yes, is the pointer freed after $obj = 0?Does the interface definition ($tagInterface parameter in _AutoItObject_WrapperCreate()) need to be complete or will it suffice to define only some of methods the object implements? Looking at the samples I can't really get the clue...Is it allowed for $tagInterface to contain ANY of super-interfaces or do I always have to create wrapper to IUnknown / base interface and QueryInterface() it then?Particularly I'm trying to implement in-memory stream (IStream) object in AutoIt by utilizing CreateStreamOnHGlobal for use it in some COM calls, however it does not seem to work - either I get COM error ("Name unknown") or access violation. Here is the code: #include <Memory.au3> #include <WinAPI.au3> #include "AutoItObject.au3" Global $tagIStream = _ "QueryInterface long(ptr;ptr;ptr);" & _ "AddRef ulong();" & _ "Release ulong();" & _ ; IUnknown "Read long(ptr;ULONG;ULONG_PTR);" & _ "Write long(ptr;ULONG;ULONG_PTR);" ; ISequentialStream Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc") Func _ErrFunc() ConsoleWrite("! COM Error ! Number: 0x" & Hex($oError.number, 8) & " ScriptLine: " & $oError.scriptline & " - " & $oError.windescription & @CRLF) Return EndFunc ;==>_ErrFunc _AutoItObject_Startup() Dim $hMem = _MemGlobalAlloc(0x1000, $GHND) If $hMem Then Dim $tStream = DllStructCreate("ptr") Dim $res = DllCall("ole32.dll", "long", "CreateStreamOnHGlobal", "HANDLE", $hMem, "BOOL", 0, "ptr", DllStructGetPtr($tStream, 1)) If 0 = $res[0] And 0 <> DllStructGetData($tStream, 1) Then Dim $oStream = _AutoItObject_WrapperCreate(DllStructGetData($tStream, 1), $tagIStream) If IsObj($oStream) Then MsgBox(0, "Test", "IStream Created!") ConsoleWrite("Still there 1" & @LF) Dim $tw = DllStructCreate("wchar[128];ULONG") DllStructSetData($tw, 1, "Test string") Dim $hr = $oStream.Wtite(DllStructGetPtr($tw, 1), StringLen("Test string") * 2, DllStructGetPtr($tw, 2)) ConsoleWrite("HR(" & VarGetType($hr) & ")=" & $hr & @LF) $oStream = 0 ConsoleWrite("Still there 2" & @LF) Else MsgBox(0, "Error _AutoItObject_WrapperCreate", _WinAPI_GetLastErrorMessage()) EndIf Else MsgBox(0, "Error CreateStreamOnHGlobal", _WinAPI_GetLastErrorMessage()) EndIf Dim $p = _MemGlobalLock($hMem) If $p Then Dim $tr = DllStructCreate("wchar[128]", $p) MsgBox(0, "Test", "" & DllStructGetData($tr, 1)) _MemGlobalUnlock($hMem) Else MsgBox(0, "Error", _WinAPI_GetLastErrorMessage()) EndIf $tStream = 0 ConsoleWrite("Still there 3" & @LF) _MemGlobalFree($hMem) ConsoleWrite("Still there 4" & @LF) Else MsgBox(0, "Error GlobalAlloc", _WinAPI_GetLastErrorMessage()) EndIf ConsoleWrite("Still there 5" & @LF) Comments and ideas are highly appriciated.
    1 point
×
×
  • Create New...