Results 1 to 8 of 8

Thread: [RESOLVED] Can't add a reference to the specified file

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Posts
    200

    Resolved [RESOLVED] Can't add a reference to the specified file

    I am having a problem trying to reference the CEUtil.dll file in my VB6 application. When I try to reference the DLL, I get the following error message: "Can't add a reference to the specified file." I, then, went to verify that it was registered so I used regsvr32 to register ceutil.dll, and I recieved the following error message: "CEUtil.dll was loaded, but the DLLRegisterServer entry point was not found. The file cannot be registered." I am new to working with DLL files in VB6, so any help would be great. Thanks again!

    Nenio foriras ĝis ĝi havas instru ni kiu ni devas scii.

  2. #2
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    Re: Can't add a reference to the specified file

    Is this a COM DLL?

    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Can't add a reference to the specified file

    It sounds as if it is a standard DLL (like C++ produces), rather than an ActiveX DLL (like VB produces).

    That means you cannot add a Reference, but instead need to declare each of the functions you want to use, which would be something like this:
    Code:
    Declare Function Beep Lib "kernel32.dll" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
    However, without the developer documentation for the DLL, you won't know what the functions are called, or what parameters they need.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Posts
    200

    Re: Can't add a reference to the specified file

    Thanks Si, you rock (as usual). Teh function I want to declare is called getDeviceID(void); now I've never used DLLs in a VB program like this. Once I add the following line; I there anything else in my code I will need to do?

    Private Declare Sub getDeviceID() Lib "CEUtil.dll"()

    Thanks!

  5. #5
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Can't add a reference to the specified file

    If getDeviceID doesn't take any parameters and doesn't return anything, that is correct - and to call it you can use either of these:
    Code:
    getDeviceID
    Call getDeviceID
    However.. I would expect something with that name to return a value. Perhaps it should be like this (depending on what data type is returned):
    Code:
    Private Declare Function getDeviceID() Lib "CEUtil.dll"() as Long
    ..and could be called like either of these:
    Code:
    MsgBox getDeviceID
    MyVariable = getDeviceID

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Posts
    200

    Re: Can't add a reference to the specified file

    I'm now getting "Error 453 - Can't find DLL entry point GetDeviceID in C:\WINNT\System32\ceutil.dll". Could it be that the GetDeviceID function does not exist in the ceutil.dll file? Is there a way I can view the contents of the ceutil.dll file, which seems to be a fairly standard Microsoft file. Thanks!

    Nenio foriras ĝis ĝi havas instru ni kiu ni devas scii.

  7. #7
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Can't add a reference to the specified file

    It could be that the function does not exist, but it is more likely that the parameters or return type are not correct.

    See if you also have a file called ceutil.h, as that is a text file which contains the declarations.


    edit:
    based on this documentation it seems that the name is wrong - it should be ceGetDeviceID

    It also returns a value, but it is hard to tell what data type it should be, as the one listed is "DEVICEID" (which is not a normal data type). Based on experience I would guess that it is a Long, in which case the code would be like this:
    Code:
    Private Declare Function ceGetDeviceID() Lib "CEUtil.dll"() as Long
    Last edited by si_the_geek; Jul 22nd, 2008 at 04:07 PM.

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Posts
    200

    Re: Can't add a reference to the specified file

    Thanks to all those who commented, but I was successfully able to do this with the following code:

    Code:
    Private Declare Function CeGetDeviceId Lib "C:\WINNT\system32\ceutil.dll" () As Boolean
    
    If CeGetDeviceId() = False Then
            Dim num As Integer
            num = MsgBox("Handheld scanner not detected.  Exiting ScanTransferV3 application.", vbCritical, "CeGetDeviceId() Failed")
            End
        End If
    Thanks Again !!

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