Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Problem in visual basic
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sat Nov 03, 2007 7:57 am    Post subject: Re: Problem in visual basic Reply with quote

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 Razz


Just so you know you code wont compile. Infact it wont even let you type that and then do something else Wink 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
View user's profile Send private message Visit poster's website
XxOsirisxX
Grandmaster Cheater Supreme
Reputation: 0

Joined: 30 Oct 2006
Posts: 1597

PostPosted: Sat Nov 03, 2007 11:29 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites