How would i use a button to open up a directory to browse for wow.exe, im making a wow auto login its my first c# project somthing simple as i know it would be stupid to dive straight in.
How would i use a button to open up a directory to browse for wow.exe, im making a wow auto login its my first c# project somthing simple as i know it would be stupid to dive straight in.
Just wrote this, just change the path to your Wow.exe :-)Code:using System; using System.Diagnostics; int main() { Process.Start(@"C:/Program Files/World of Warcraft/Wow.exe"); }
Last edited by Krillere; 07-13-2010 at 04:31 AM.
I think it's just Process.Start(). Am i right?
Wait yes sorry, I just wrote that code out of my head, was thinking of another function, I'll just change the codeblock :-)
If you need to run as Admin use this,
Code:ProcessStartInfo processInfo = new ProcessStartInfo(); processInfo.Verb = "runas"; processInfo.FileName = location; Process.Start(processInfo);
None of you directly answered his question.
He wants a dialog to popup where he can select the file WoW.exe
In your form, create a new "OpenFileDialog" option from the list, then create a new button and put this code:
Then you can invoke the launching the program.Code:if (openFileDialog1.ShowDialog() == DialogResult.OK ) { ProcessStartInfo processInfo = new ProcessStartInfo(); processInfo.Verb = "runas"; processInfo.FileName = openFileDialog1.FileName; }
Then this should also work,
This is off the top of my head, so I do not know if it will work.Code:// create an open file dialog OpenFileDialog dlgOpen = new OpenFileDialog(); dlgOpen.Filter = "World Of Warcraft (WoW.exe)|wow.exe"; dlgOpen.Title = "Type File"; dlgOpen.InitialDirectory = ("C:\\Program Files\\World of Warcraft\\"); // set properties for the dialog dlgOpen.Title = "Select World Of Warcraft File"; dlgOpen.ShowReadOnly = true; dlgOpen.Multiselect = false; // display the dialog and return results if (dlgOpen.ShowDialog() == DialogResult.OK) { ProcessStartInfo processInfo = new ProcessStartInfo(); processInfo.Verb = "runas"; processInfo.FileName = dlgOpen.FileName;; Process.Start(processInfo); }
^^ This is the more defined way to do it; however if you want the give the user control over the file then use my one, however DarkLinux's code is better.
I was rereading your question, the auto login in part will be more difficult I think. You might need to hook wow to use some APIs. Thats the only way I can think of auto logging in. Or you could just use the keyboard functions, but then you could not do anything els with the computer. You could not run it in the background, thats all.
WoW APIs World of Warcraft API - WoWWiki - Your guide to the World of Warcraft
Also found this post, if you are going with the non hook method.
http://www.devasp.net/net/articles/display/690.html
Or
[2008] Sending BM_Click to Calculator doesn't work? - VBForums
This will help you with the logging in button