Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dependency Walker Help

Status
Not open for further replies.

Jenniferlynn

Technical User
Feb 28, 2003
60
0
0
GB
Hello,
I am supporting a Visual Basic Application and trying to figure out a dll registration problem. I have downloaded Dependency Walker and am just trying to figure out how to use it, but I'm afraid I'm finding ir Mind Bogling!

Could anyone provide me with some instructions or point me somewhere I can find an explaination of what it all means. I can find a lot of information telling me what it is but not a lot explaining how to identify what the problem is.

Sorry if this is very simple, I'm just finding it a bit overwhelming as the list of dependency dlls is huge!

Any help would be greatly appreciated!

jen
 
Jenniferlynn

A little off thread but...
Depends a little on what kind of errors your dlls (or absent dlls) are giving but you may like to write yourself a little utility program like the following which will check if a given list of dlls etc is load/ usable on the host computer. You can distribute a utility like this on CD with your app, so if the customer reports the dreaded error 48 just get him to run it to find the file(s) at fault.

Copy this lot into a new Form having Label1, Command1 and Command2


Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long

Const FORMAT_MESSAGE_FROM_SYSTEM = &H1000

Private Declare Function FormatMessage Lib "kernel32" Alias _
"FormatMessageA" (ByVal dwFlags As Long, lpSource As Long, _
ByVal dwMessageId As Long, ByVal dwLanguageId As Long, _
ByVal lpBuffer As String, ByVal nSize As Long, ByVal Arguments As Any) _
As Long

Private Function MessageText(lCode As Long) As String
Dim sRtrnCode As String
Dim lRet As Long

'FormatMessage API fails on messages requiring inserts (%1) so we hardcode the following exceptions
Select Case lCode
Case 34
MessageText = "The wrong diskette is in the drive. Insert %2 (Volume Serial Number: %3) into drive %1."
Case 106
MessageText = "Insert the diskette for drive %1. "
Case 129
MessageText = "The %1 application cannot be run in Win32 mode."
Case 182, 188, 189, 190, 191, 192, 194, 195, 198, 201, 202
MessageText = "The operating system cannot run %1."
Case 193
MessageText = "is not a valid Win32 application."
Case 216
MessageText = "The image file %1 is valid, but is for a machine type other than the current machine"
Case 317
MessageText = "The system cannot find message text for message number 0x%1 in the message file for %2. "
Case Else
sRtrnCode = Space$(256)
lRet = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0&, lCode, 0&, sRtrnCode, 256&, 0&)
If lRet > 0 Then
MessageText = Trim$(Left(sRtrnCode, lRet - 2))
Else
MessageText = "Error not found."
End If
End Select

End Function

Private Sub Command1_Click()

Dim hInst As Long, lRet As Long, msg$

Dim FileName$(1 To 20) 'adjust this list to include the dependent files
FileName(1) = "COMCAT.DLL"
FileName(2) = "OLEAUT32.DLL"
FileName(3) = "OLEPRO32.DLL"
FileName(4) = "ASYCFILT.DLL"
FileName(5) = "MSVBVM60.DLL"
FileName(6) = "MSVCRT40.DLL"
FileName(7) = "MSVCIRT.DLL"
FileName(8) = "MSVCRT.DLL"
FileName(9) = "MFC40.DLL"

FileName(10) = "STDOLE2.TLB"

FileName(11) = "MSCOMCTL.OCX"
FileName(12) = "MSCOMCT2.OCX"
FileName(13) = "COMDLG32.OCX"
FileName(14) = "GRID32.OCX"
FileName(15) = "THREED32.OCX"
FileName(16) = "MSMASK32.OCX"
FileName(17) = "MSMAPI32.OCX"
FileName(18) = "TABCTL32.OCX"

FileName(19) = "VBPRNDLG.DLL"

FileName(20) = "MUST_FAIL.DLL"

Cls
DoEvents
For i = 1 To UBound(FileName)
Err.Clear

hInst = LoadLibrary(FileName(i))
lRet = Err.LastDllError

If hInst > 0 Then
hInst = FreeLibrary(hInst)
lRet = Err.LastDllError
Print i & ". " & FileName(i) & " - Loaded ok/ ";
If hInst > 0 Then
Print "Unloaded ok"
Else
Print "Not unloaded " & lRet
End If
Else
Print i & ". " & FileName(i) & "- Error " & lRet & " Loading library " & MessageText(lRet)
End If
DoEvents
Next

End Sub

Private Sub Command2_Click()

Unload Me

End Sub

Private Sub Form_Click()

'Dim i&
' For i = 1 To 200
' MsgBox i & " " & MessageText(i)
' Next

End Sub

Private Sub Form_Load()

Label1 = "If MyApp fails at any point with 'Error 48 - Error Loading DLL' this utility may help to determine which file is at fault"

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top