|
-
May 22nd, 2006, 03:45 AM
#1
DLL Path
I'd like to write:
Private Declare Sub MySub Lib App.Path & "\Mydll.dll" (MyParam As ...)
rather than
Private Declare Sub MySub Lib "C:\VB\Projects\MyProj\Mydll.dll" (MyParam As ...)
but unfortunately this is not allowed.
Is there any way round or some trick to make the declaration path a relative one? I like to keep the dll in the app (and not in the Windows) directory because I'm often making changes and updates to it.
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
-
May 22nd, 2006, 03:49 AM
#2
Re: DLL Path
If your dll is registered then it should not be necessary to declare the path as the default initial location windows looks for files is the applications path. Then in Windows. Then in System32. Basically a shortened enumeration of the locations windows looks.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 22nd, 2006, 03:55 AM
#3
Re: DLL Path
 Originally Posted by RobDog888
If your dll is registered then it should not be necessary to declare the path as the default initial location windows looks for files is the applications path. Then in Windows. Then in System32. Basically a shortened enumeration of the locations windows looks.
I tried to register it but I got this message:
"...Mydll.dll was loaded but the DllRegisterServer entry point was not found"
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
-
May 22nd, 2006, 04:02 AM
#4
Re: DLL Path
Thats a different error then path not found. Did you use VB 6 to write the dll or is it a third party dll? Did you try it with the hard coded path and did it work?
Try using Depends.exe to determine any dependancies that may not exist or ??? if its a third party dll.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 22nd, 2006, 04:08 AM
#5
Re: DLL Path
When you try it with the DLL in the application folder, do you recieve any error.
VB Code:
Private Declare Sub MySub Lib "C:\VB\Projects\MyProj\Mydll.dll" (MyParam As ...)
If it is a Win32 Standard DLL then it does not need any registration.
It should work even if the DLL is present in the same folder as your EXE.
Use [code] source code here[/code] tags when you post source code.
My Articles
-
May 22nd, 2006, 04:10 AM
#6
Re: DLL Path
Yes, thats what I thought that it did look in the application path folder first but it sounds like the error mesage is dll dependant and not a Declare type issue.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 22nd, 2006, 04:51 AM
#7
Re: DLL Path
 Originally Posted by RobDog888
[color=navy]Thats a different error then path not found. Did you use VB 6 to write the dll or is it a third party dll?
I wrote it in c++
 Originally Posted by RobDog888
[color=navy]Did you try it with the hard coded path and did it work?]
It did, yes.
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
-
May 22nd, 2006, 05:18 AM
#8
Re: DLL Path
I believe it is possible to declare it like:
VB Code:
Private Declare Sub MySub Lib "Mydll.dll" (MyParam As ...)
VB should look in the application path as well.
-
May 22nd, 2006, 05:33 AM
#9
Re: DLL Path
 Originally Posted by Frans C
VB should look in the application path as well.
It doesn't work either. Btw I've tried in VB6 under Win98.
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
-
May 22nd, 2006, 06:16 AM
#10
Re: DLL Path
Did you try this in the IDE or with an exe?
If you run the application from the IDE, windows regards the directory where VB6.exe is located as the application directory, and not the directory where your project is located.
-
May 22nd, 2006, 08:04 AM
#11
Re: DLL Path
 Originally Posted by Frans C
Did you try this in the IDE or with an exe?
If you run the application from the IDE, windows regards the directory where VB6.exe is located as the application directory, and not the directory where your project is located.
You're right, it works after I've compiled it. But it's a nuisance having to cope with this from the IDE, as I'm still developing the project (and will be for quite long, probably) and I work on it from various computers having different pathes.
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|