JumpyNET Posted April 19, 2005 Posted April 19, 2005 I need to make a program that acts as a shortcut. I need to use ChDir() an Process.Start() functions. And it also has to have an icon. I don't want any forms or any other extra stuff loaded in to slow my program down. How can I accomplish this the most minimalist way? :cool: I'm using VB.NET 2003. Quote
Jay1b Posted April 19, 2005 Posted April 19, 2005 Use SubMain Edit: Look into DOS batch programs.... Quote
JumpyNET Posted April 19, 2005 Author Posted April 19, 2005 OK I'll try the Sub Main... I started a new "Empty Project" and added a new module wich has the following code: Module Module1 Private Sub Main() ChDir("C:\") Process.Start("notepad.exe") End Sub End Module What else do I need for this, because it doesn't work? PS: I really want to do this with VB. :-\ Quote
Jay1b Posted April 19, 2005 Posted April 19, 2005 (edited) Batch programs are far more suited to this task. A good developer will use the best tools for the job, not just the ones he knows (or wants to know). Why dont you just create a shortcut? Why exactly do you want to use VB for it? Edited April 19, 2005 by Jay1b Quote
JumpyNET Posted April 19, 2005 Author Posted April 19, 2005 Batch programs are far more suited to this task. A good developer will use the best tools for the job, not just the ones he knows (or wants to know). Why dont you just create a shortcut? Why exactly do you want to use VB for it? A simple windows shortcut doesn't change the directory (that's what I need the ChDir for). For example a program called DGIndex will create it's confuguration file to the directory where the shortcut is located instead of the program's folder. Besides I want to learn more about VB. Quote
Administrators PlausiblyDamp Posted April 19, 2005 Administrators Posted April 19, 2005 If you bring up the properties for a shortcut there is an entry to change where it starts from (Start In). If you wish to learn more about VB then this is possibly too simplistic an example (that is also fraught with problems outside of your control i.e. notepad.exe ignores the working directory for open / save dialogs), however a working sample looks like Class SampleClass Public Shared Sub Main() Environment.CurrentDirectory = "c:\" Process.Start("notepad.exe") End Sub End Class just be aware that notepad will still default to the 'My Documents' folder... Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
JumpyNET Posted April 19, 2005 Author Posted April 19, 2005 Thanks it works now! At first I didn't have any Class at all. Quote
Leaders snarfblam Posted April 19, 2005 Leaders Posted April 19, 2005 A simple windows shortcut doesn't change the directory (that's what I need the ChDir for) Can't you specify working directory in a shortcut? Using an exe in place of a shortcut seems like overkill to me. Quote [sIGPIC]e[/sIGPIC]
JumpyNET Posted April 26, 2005 Author Posted April 26, 2005 Can't you specify working directory in a shortcut? Using an exe in place of a shortcut seems like overkill to me. I tried to keep my question simple. There are also other advantages in using an exe. For example I can make my "shortcut" launch a certain operation in the destination program by simulating a keypress. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.