Results 1 to 6 of 6

Thread: How to use .DLL with VB???

  1. #1

    Thread Starter
    Hyperactive Member mikef's Avatar
    Join Date
    Jun 2000
    Location
    Beach bound...
    Posts
    510

    Question How to use .DLL with VB???

    I have a very simple DLL that contain 5 routines.

    1) What do I have to do to make this DLL available to Visual Basic??

    2) What do I need to do to register this DLL with Windows, or do I???

    I tried a few things, but I keep getting an Error saying "FILE NOT FOUND" and it referes to the below line in my declarations:

    Private Declare Sub trInfo Lib "trackw" (rev%)

    I have also tried it this way:

    Private Declare Sub trInfo Lib "c:\windows\trackw.dll" (rev%)

    Is this case sensitive??? I am lost?!?!?!


    thanks for the help.
    "If I had known it was going to be that kinda party, I would have stuck my disk in the mash potatos!"

  2. #2
    Frenzied Member seoptimizer2001's Avatar
    Join Date
    Apr 2001
    Location
    Toledo, Ohio USA GMT -5
    Posts
    1,075
    You have to register it first. The best place to put it is in the System32 folder. Anyways then open a command prompt and type 'regsvr32 nameoffile' if you put it in system32 folder or 'regsvr32 [pathtofile]' if not. This will allow you to reference it from references in VB.

  3. #3
    jim mcnamara
    Guest
    You register COM servers, not regular dll's

    If you wrote the dll in VB it is a COM object, so you have to register it. Otherwise, Put the file in c:\Windows\System directory

    A regular dll callyou declare it like this

    Declare Function PrinterProperties Lib "somthin" (ByVal hWnd As Long, ByVal hPrinter As Long) As Long


    "somthin" points to \windows\system\somthin.dll

  4. #4

    Thread Starter
    Hyperactive Member mikef's Avatar
    Join Date
    Jun 2000
    Location
    Beach bound...
    Posts
    510
    Thanks! I was pretty sure I had to register it or something.

    I tried to use the service to register though, and I got this message:

    LoadLibrary("trackw.dll") failed.
    GetLastError returns 0x0000001f.

    This DLL was written for Win 3.1... does that matter??? What would need to be changed??

    I was hoping since it was so simple that no changes would be necessary, but it looks like they might be!


    Thanks for your excellent help.
    "If I had known it was going to be that kinda party, I would have stuck my disk in the mash potatos!"

  5. #5

    Thread Starter
    Hyperactive Member mikef's Avatar
    Join Date
    Jun 2000
    Location
    Beach bound...
    Posts
    510
    It all started as an ASM library add-in for Qbasic and PBasic... but then we made it into a DLL, but I don't know if the DLL is in ASM or C...

    I am assuming I can use it, I just am not setting it up properly???

    Thanks again... your answers have been more than helpful.
    "If I had known it was going to be that kinda party, I would have stuck my disk in the mash potatos!"

  6. #6

    Thread Starter
    Hyperactive Member mikef's Avatar
    Join Date
    Jun 2000
    Location
    Beach bound...
    Posts
    510
    I keep getting the same error:

    Runtime error: 48

    File Not Found

    This is how I have it declared and the file is in the C:\windows\system directory:

    Private Declare Sub trInfo Lib "trackw" (rev As Integer)


    Is this right??? What am I doing wrong???
    "If I had known it was going to be that kinda party, I would have stuck my disk in the mash potatos!"

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