Jump to content

piccaso

MVPs
  • Posts

    872
  • Joined

  • Last visited

Everything posted by piccaso

  1. nah, could be better latest version is here: http://therap.svn.sourceforge.net/viewvc/t...20by%20Piccaso/
  2. Check out PcHelpware Its a free component (dll) from the ultravnc devs. iirc i posted an example on theyr forums on how to use it with autoit...
  3. replace 'long_ptr' with 'long*' and it will work again
  4. here's a concept that should work... #include<sqlite.au3> $ppszRow = ;mysql_fetch_row(res) $uiLen = ;mysql_num_fields(res) dim $aRow[$uiLen],$vPointers = DllStructCreate("ptr[" & $uiLen & "]",$ppszRow) Do $uiLen -= 1 $aRow[$uiLen] = _szStringRead(DllStructGetData($vPointers,1,$uiLen+1)) Until $uiLen = 0 Func _szStringRead($pszString, $uiLen = -1) Local $aStrLen, $vszString If $pszString = 0 Then Return "" If $uiLen < 1 Then $aStrLen = DllCall("msvcrt.dll", "int:cdecl", "strlen", "ptr", $pszString) If @error Then Return SetError(1, 0, "") $uiLen = $aStrLen[0] + 1 EndIf $vszString = DllStructCreate("char[" & $uiLen & "]", $pszString) If @error Then Return SetError(2, 0, "") Return SetError(0, $iLen, DllStructGetData($vszString, 1)) EndFunc
  5. http://msdn2.microsoft.com/ if you seek information on some particular function you can also use google: site:microsoft.com <function>
  6. Thank you Valik. I got it to work on other compilers too, but for some reason borlands still requires stdio.h to be included. Probably my mistake, i'm more familiar with C, not much into that '++' The only reason for using C++ was to get the typeof(T).name() functionality...
  7. I was tired of searching and translating headers to find the right DllCall/DllStruct type to use so i made 2 Macros to help with that: t(<Type>) Displays Size and Primitive typeType can be a Type, Constant or an existing variable. c(<Constant>) Translates constants into AutoIt Code Tested with Gnu c++ 3.x, Borland C++ 5.5.1, MSVC8 Here is the source with some examples: // Headers reqired by Macros #include <typeinfo> // typeid #include <cstdio> // printf #ifdef __GNUG__ #include <cstdlib> // free #include <cstring> // strlen #include <cxxabi.h> // abi::__cxa_demangle #endif // __GNUG__ // Macros #define c(c) std::printf("Global Const $%s = 0x%X\n",#c,c); #define _s(s) std::printf("sizeof(%s) = %d (0x%X) Bytes, %d Bit",#s,sizeof(s),sizeof(s),sizeof(s)*8) #ifdef __GNUG__ // Workaroud for crappy g++ typeid(T).name() #define t(t) _s(t);__demangle(typeid(typeof(t)*).name(),#t); void __demangle(const char * type, char*s){ int st; size_t n; char* unm = abi::__cxa_demangle(type,NULL,0,&st); if (unm != NULL){ n = strlen(unm);unm[n-1]=0; printf(", Primitive: %s\n",unm); free(unm); } else printf("\ntype: %s error: %d unmangled: %s\n",s,st,type); } #else // __GNUG__ #define t(t) _s(t);std::printf(", Primitive: %s\n",typeid(t).name()); #endif // NOT __GNUG__ /////////////////////// // Include headers here /////////////////////// #include <windows.h> int main (){ ////////////////// // Use Macros Here ////////////////// t(size_t); t(LPDWORD); t(HRESULT); t(LRESULT); t(ATOM); t(HGDIOBJ); t(LPWSTR); // Display primitive of constants t(STD_INPUT_HANDLE); t(INVALID_HANDLE_VALUE); t(TIME_ZONE_ID_INVALID); // Display primitive of variables PFLOAT pf; t(pf); // Translating Constants c(STATUS_WAIT_0); c(STATUS_ABANDONED_WAIT_0) c(STATUS_USER_APC); c(STATUS_TIMEOUT); c(STATUS_PENDING); return 0; } This does not only work with windows header, and its pretty usefull if you are translating from headers like libcurl which some macro maniac wrote. Most of the windows types are easily identified by their naming but still some of them might be confusing. For example: I would think that 'HRESULT' is a handle and use 'ptr' or 'hwnd' which might work but in order to be correct it should be 'long'. If someone of you has similar tricks or improvement ideas on this one please post them
  8. looks like a pointer to me... typedef DBFInfo * DBFHandle; But we're both right
  9. DllCall returns an Array (your first post doesn't look like you realised that) try this: $dll = DllOpen("shapelib.dll") Dim $lRet,$sPath,$hDBF $sPath = @ScriptDir & "\test" $hDBF = DllCall($dll, "ptr", "DBFCreate", "str", $sPath) $lRet = DllCall($dll, "int", "DBFAddField", "ptr", $hDBF[0], "str", "name", "int", 1, "int", 10, "int", 0) DllCall($dll, "int", "DBFWriteIntegerAttribute","ptr", $hDBF[0], "int", 0, "int", 0, "int", 10) DllCall($dll, "none", "DBFClose", "ptr", $hDBF[0]) DllClose($dll)
  10. Welcome to the forums But this part of the forum if for reporting AutoIt Bug's, so next time please post into 'General Help and Support'. Depending on what you want to assign to this variable it might be one of these: $VarSoft = "WinActivate(""Setup"")" $VarSoft = WinActivate("Setup")
  11. that's because AutoitX is a dynamic library, you cant use it as a static library.
  12. i have no idea what OPC is but try this: $oOpc = ObjCreate("OPC.Automation") if @error Then Exit -1 $aServers = $oOpc.GetOPCServers() for $i = 0 to UBound($aServers) ConsoleWrite($aServers[$i] & @CRLF) Next Dont forget to register the dll before doing that
  13. Did you try setting up a Hook which 'eats' certain scan codes?
  14. Ok it was just a rhetorical question, no need to answer, i read your patterns. I know now what functionality your after But anyway, this will never work: Func whatever() $x = "some val" ConsoleWrite(_ExpandVarStrings("$x$") & @CRLF) EndFunc whatever() Because $x is not in the global scope, thus Eval() cant reach it. Same goes for my suggested concept...
  15. I Could swear it didnt work when i tried it a minute ago... Well even better This is no bug, you need some kind of terminator. or how would you threat that? $Where = "Here" Expand("$WhereDoesTheVariableNameEnd?")
  16. Maybe i don't get it right, but why not let execute do all the work? Func _Expand($s) Local $o = Opt("ExpandVarStrings",1) $s = StringReplace($s,'"','""') Local $r = Execute('"' & $s & '"') Opt("ExpandVarStrings",$o) Return $r EndFunc $a = "aa" $x = "xx" ConsoleWrite(_Expand("@AutoItVersion@, $a$, $x$") & @CRLF) Please don't get me wrong, i don't want to criticize your code...
  17. Yes, That would be nice As Alternative you could subscribe to the whole "News and Announcement" Forum and to the "Latest Beta" Thread.
  18. here: http://www.autoitscript.com/forum/index.php?showtopic=55994
  19. I remember someone posing DDE udf's... Search the example forum for it
  20. Apply that fix from here, and it should be working again.
  21. I assumed that the last parameter is the buffer size... $vBuff = DllStructCreate("char[1048576]") ; Size in bytes $dll = DllOpen("7-zip32.dll") $check = DllCall($dll, "int", "SevenZip", "hwnd", 0, _ "str", "l " & Chr(34) & "just-an-archive.7z" & Chr(34), _ "ptr", DllStructGetPtr($vBuff), _ ; Pass a pointer instead of 'str' "int", DllStructGetSize($vBuff)) ; the size of the buffer? DllClose($dll) MsgBox(0, "", DllStructGetData($vBuff,1))
  22. No trick, Just Create a buffer large enough to hold your data with DllStructCreate and pass a pointer
  23. You dont have to wrap your mind around date calculations, there are udf's for that too: #include <WinAPI.au3> #include <Date.au3> ConsoleWrite(_TimeConversion("970ABF44") & @CRLF) Func _TimeConversion($s_TimeAsFloat32) ; Using: WinAPI.au3, Date.au3 Local $s_Endian, $n_TimeInSec, $i_Hours, $i_Mins, $i_Sec $s_Endian = StringMid($s_TimeAsFloat32, 7, 2) & StringMid($s_TimeAsFloat32, 5, 2) _ & StringMid($s_TimeAsFloat32, 3, 2) & StringMid($s_TimeAsFloat32, 1, 2) $n_TimeInSec = _WinAPI_IntToFloat (Dec($s_Endian)) _TicksToTime($n_TimeInSec * 1000, $i_Hours, $i_Mins, $i_Sec) Return $i_Hours & ":" & $i_Mins & ":" & $i_Sec EndFunc I know, i'm too late
×
×
  • Create New...