Results 1 to 2 of 2

Thread: IS IT EVEN POSSIBLE???

  1. #1
    Guest

    Unhappy

    I have a C program with a function that I would like to be able to call from Visual Basic. I am guessing the way to do this would be to make a DLL with MS Visual C++ (which I have), but I haven't the faintest clue as how to go about doing this. What would be the simplest, easiest, and quickest way to accomplish my objective?

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    Go to new Win32 Dll Project and put this in the code section:
    Code:
    void _stdcall Msg(HWND handle)
    { 
    MessageBox(handle,"SomeText","Message",MB_OK);
    }
    Create a .def file in your project which contains:
    Code:
    LIBRARY "dllname.dll"
    EXPORTS
    Msg 1
    This function displays a message box. To call it from VB use this:
    Code:
    Private Declare Sub Msg Lib "dllname.dll" (ByVal handle As Long)
    
    Private Sub Command1_Click()
    Msg Form1.hWnd
    End Sub
    [Edited by Vlatko on 12-11-2000 at 09:38 AM]
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

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