Re: VB6 app cannot copy dll to system32

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"Michael J. Wheeler" <MichaelJWheeler@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:4CD54C4C-151A-450D-9F89-3B0537E02551@xxxxxxxxxxxxxxxx
Mike,

I am not hard coding a fully qualified path to the DLL. I am basically
just
doing ' Lib "mydll.dll" '... I've tried having the DLL in the same
directory
as the executable, but it gives me a runtime error 53.. file not found and
my
DLL is listed.


It was just a shot in the dark....but I've seen it before so thought it was
worth bringing up.

I'm not sure about that runtime error though. As I recall, that's not the
error you get if the DLL can't be found for a declared (external) function.
I'll test something real quick....

Nope. That's the error. Here's the code I tested:

-----BEGIN CODE
Private Declare Function GetWindowsDirectory Lib "C:\kernel32" Alias
"GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As
Long

Private Function WinDir() As String

Dim sBuffer As String

On Error GoTo EH

sBuffer = String$(260, 0)
Call GetWindowsDirectory(sBuffer, 260)
WinDir = sBuffer

Exit Function

EH:

MsgBox Err.Description & " (" & Err.Number & ")"

End Function


Private Sub Form_Load()

MsgBox WinDir

End Sub
-----END CODE


I coulda sworn it was a different error (at least the number) than VB's
*standard* "file not found" error. Guess I was wrong.

--
Mike
Microsoft MVP Visual Basic



.



Relevant Pages

  • Re: VB6 app cannot copy dll to system32
    ... not the VB code calling it! ... I am not hard coding a fully qualified path to the DLL. ... "GetWindowsDirectoryA" (ByVal lpBuffer As String, ... Dim sBuffer As String ...
    (microsoft.public.vb.general.discussion)
  • Re: Explicit Linking of DLLs in VB.net
    ... yes this technique will only work on managed assemblys (exe or dll) ... "YourObject" is a form and is limited to the form methods. ... Wel implement propertys, methods, events in your interface and start ... Public Shared Function LoadMeByName(ByVal vstrAssemblyName As String, ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Explicit Linking of DLLs in VB.net (attn Michel or any others)
    ... loads the dll and finds a form in the dll. ... Dim extForm As Form = extAssembly.CreateInstance("test.entry", ... Wel implement propertys, methods, events in your interface and start ... Public Shared Function LoadMeByName(ByVal vstrAssemblyName As String, ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Access crashes when calling DLL function.
    ... I have started bypassing code in the form to find the problem. ... are local String variables. ... I then built a simple input form (in the same mdb) that calls the crashing ... functions from a DLL they provide. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Populating CString in Win32 dll interface that accepts LPCTSTR
    ... ReleaseBuffer() if I actually modify the buffer after GetBuffer is called ... But the OP wanted the string to be "populated" by the DLL. ... Unicode or ANSI string, but the DLL might think it is a non-const pointer to an ANSI ...
    (microsoft.public.vc.mfc)