|
-
Apr 18th, 2005, 12:37 PM
#1
Thread Starter
Frenzied Member
~Resolved~Screwy problems with Shell
This one has me stumped. I wrote a program that you add a program to a list, made for Chat server's where I hang out. Now, if my program is in a different directory than the server, it doesn't find *Any* of it's configuration files and they all get re-created making the person lose all their server data. If you run the program from the same directory there is no problem at all.
I am guess it's similar to how command works, where you have to change to the right directory before executing an exe.
My question is, how do I make this work right without slapping a copy of the program in every directory?
Last edited by Spajeoly; Apr 18th, 2005 at 01:33 PM.
-
Apr 18th, 2005, 12:44 PM
#2
Re: Screwy problems with Shell....
The problem with Shell is that there are no parameters for specifying the working directory. There is, although,
the CurDir function that allows you to specify this in another line of code. Preferably before the shell call.
Another option is to use the ShellExecute API to start you processes instead of Shell. ShellExecute API has a parameter
for specifying the working directory.
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 
-
Apr 18th, 2005, 12:49 PM
#3
Re: Screwy problems with Shell....
CurDir will only return the current directory. The function to change the directory is ChDir.
-
Apr 18th, 2005, 01:03 PM
#4
Re: Screwy problems with Shell....
Doh! Shows how much I use it. I always use ShellExecute over Shell now-a-days.
Thanks for catching that one Joacim
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 
-
Apr 18th, 2005, 01:33 PM
#5
Thread Starter
Frenzied Member
Re: Screwy problems with Shell....
I used the ShellExecute API, the ChDir didn't do jack but return errors. I tried it before I posted the thread.
Thanks a lot for the suggestion RobDog
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
|