 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Sat Nov 03, 2007 7:57 am Post subject: Re: Problem in visual basic |
|
|
| DarkShadowz wrote: | This is too easy...
| Code: | Private Sub PicMaple_Click()
Shell ("C:\Nexon\MapleStory\MapleStory.exe")
End Sub |
You forgot some puncuation to the code  |
Just so you know you code wont compile. Infact it wont even let you type that and then do something else You used paranthesis in your shell line without using call or setting a return variable, which in VB6 is improper syntax and wont compile.
Instead, you should use either:
| Code: | Private Sub Command1_Click()
Call Shell("C:\Nexon\MapleStory\MapleStory.exe", vbNormalFocus)
End Sub
Private Sub Command1_Click()
Dim dblReturn As Double
dblReturn = Shell("C:\Nexon\MapleStory\MapleStory.exe")
End Sub
Private Sub Command1_Click()
Dim dblReturn As Double
dblReturn = Shell("C:\Nexon\MapleStory\MapleStory.exe", vbNormalFocus)
End Sub |
And so on. Again I will say Shell is not the best function to use in this case, instead use CreateProcess. Along with that, statically coding the path into the program is also not a good idea as it will not work for everything that wishes to use the program.
As Symbol said, if Maple stores the install path (path to the game/game directory) in the registry, you should read the registry for it. This will ensure the path will work for everyone.
If the path is not stored in the registry you should allow the users to input the path manually or create a 'Select File' dialog to point to the location of the exe and save it for later use and such in a configuration file. (Such as an INI, XML, or registry.)
_________________
- Retired. |
|
| Back to top |
|
 |
XxOsirisxX Grandmaster Cheater Supreme
Reputation: 0
Joined: 30 Oct 2006 Posts: 1597
|
Posted: Sat Nov 03, 2007 11:29 am Post subject: |
|
|
The "( )" Dose'nt matter for those "( )" lovers.
You can put it with or without it for this, and will works anyways.
As for the notepad..
| Code: | Private Sub Command1_Click()
Shell "Notepad.exe", vbNormalFocus
End Sub |
It will opens in any PC. Since is a default Windows component. Also will works with mspaint.exe by the same way..
The code of the threadstarted is right, the problem "May" be the name of the Command1. But even the Command1 name is wrong, there are no reason to gave an error, since the button in that case, will not exist.
The only problem that may cause an error is a error on the location, so, "Run-Time '53', File Not Found".
If he is getting another error, it's caused of some settings in the PC which don't allow him to continue, not due the script.
_________________
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|