Results 1 to 40 of 66

Thread: [VB6] VBCDeclFix - The Add-in allows you to use Cdecl functions in VB6 IDE.

Threaded View

  1. #8

    Thread Starter
    PowerPoster
    Join Date
    Feb 2015
    Posts
    2,797

    Re: [VB6] VBCDeclFix - The Add-in allows you to use Cdecl functions in VB6 IDE.

    Update.

    Added support for CDecl keyword. Now you can use it in the Declare statement like:

    Code:
    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
    So from now on, the community can use C libraries

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width