Update.
Added support for CDecl keyword. Now you can use it in the Declare statement like:
So from now on, the community can use C librariesCode:Option Explicit Private Declare Function snwprintf1 CDecl Lib "msvcrt" _ Alias "_snwprintf" ( _ ByVal pszBuffer As Long, _ ByVal lCount As Long, _ ByVal pszFormat As Long, _ ByRef pArg1 As Any) As Long Private Declare Function snwprintf2 CDecl Lib "msvcrt" _ Alias "_snwprintf" ( _ ByVal pszBuffer As Long, _ ByVal lCount As Long, _ ByVal pszFormat As Long, _ ByRef pArg1 As Any, _ ByRef pArg2 As Any) As Long Private Declare Function wtoi64 CDecl Lib "msvcrt" _ Alias "_wtoi64" ( _ ByVal psz As Long) As Currency Sub Main() Dim sBuf As String sBuf = Space$(255) Debug.Print Left$(sBuf, snwprintf1(StrPtr(sBuf), Len(sBuf), StrPtr("Test %ld"), ByVal 123&)) Debug.Print Left$(sBuf, snwprintf2(StrPtr(sBuf), Len(sBuf), StrPtr("Test %ld, %s"), ByVal 123&, ByVal StrPtr("Hello"))) Debug.Print wtoi64(StrPtr("1234567")) End Sub![]()




Reply With Quote
