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 


Can someone tell me what I'm doing wrong? [VB 6]

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
AdamWest
Master Cheater
Reputation: 0

Joined: 05 Jul 2007
Posts: 354
Location: Quahog, Rhode Island

PostPosted: Fri May 02, 2008 7:02 pm    Post subject: Can someone tell me what I'm doing wrong? [VB 6] Reply with quote

When I try to compile, I get errors on my Shell execution and the Show Desktop command button (number Cool

Code:


Private Sub Command1_Click()
ShellExecute 0, "open", "http://forum.cheatengine.org/index.php", vbNullString, vbNullString, 1
End Sub

Private Sub Command2_Click()
ShellExecute 0, "open", "http://waretrader.com/", vbNullString, vbNullString, 1
End Sub

Private Sub Command3_Click()
ShellExecute 0, "open", "http://youtube.com/", vbNullString, vbNullString, 1
End Sub

Private Sub Command4_Click()
Shell "C:\Program Files\Cheat Engine\Cheat Engine Client.exe"
End Sub

Private Sub Command5_Click()
Shell "C:\Program Files\Cain\Cain.exe"
End Sub

Private Sub Command6_Click()
Shell "C:\Program Files\LimeWire\LimeWire.exe"
End Sub

Private Sub Command7_Click()
Shell "C:\Program Files\CCleaner\CCleaner.exe"
End Sub

Private Sub Command8_Click()

Me.Show
DoEvents
Dim texts As TextStream
Set texts = fsys.CreateTextFile("C:\nirmal.scf")
texts.WriteLine "[Shell]"
texts.WriteLine "Command = 2"
texts.WriteLine "IconFile=explorer.exe,3"
texts.WriteLine "[Taskbar]"
texts.WriteLine "Command=ToggleDesktop"
End Sub
End Sub

Private Sub Command9_Click()

    End
End Sub

_________________

"I myself am made entirely of flaws, stitched together with good intentions." - Augusten Burroughs
Back to top
View user's profile Send private message AIM Address
HalfPrime
Grandmaster Cheater
Reputation: 0

Joined: 12 Mar 2008
Posts: 532
Location: Right there...On your monitor

PostPosted: Fri May 02, 2008 7:06 pm    Post subject: Reply with quote

Code:
ShellExecute 0, "open", "http://youtube.com/", vbNullString, vbNullString, 1

...
Code:
ShellExecute(0, "open", "http://youtube.com/", vbNullString, vbNullString, 1)

_________________
Back to top
View user's profile Send private message
AdamWest
Master Cheater
Reputation: 0

Joined: 05 Jul 2007
Posts: 354
Location: Quahog, Rhode Island

PostPosted: Fri May 02, 2008 7:09 pm    Post subject: Reply with quote

HalfPrime wrote:
Code:
ShellExecute 0, "open", "http://youtube.com/", vbNullString, vbNullString, 1

...
Code:
ShellExecute(0, "open", "http://youtube.com/", vbNullString, vbNullString, 1)

I get Syntax error when I compile with this

Everything works fine but the webpages and "go to desktop"

_________________

"I myself am made entirely of flaws, stitched together with good intentions." - Augusten Burroughs
Back to top
View user's profile Send private message AIM Address
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8588
Location: 127.0.0.1

PostPosted: Fri May 02, 2008 10:53 pm    Post subject: Reply with quote

Your code is fine the way it is, you only need ( ) around the code if you use 'Call' in front of it. You get errors because ShellExecute is an API and you did not define it in the project.

Add the following to the top of that code:

Code:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long


Your Command8 button has two 'End Sub' 's after it which will cause issues.

Your other code errors because the types are not defined. You need to include the Microsoft Script Runtime to use the TextStream type. Along with that you did not use Set correctly. To use TextStream, you need to do the following:

Code:
    Dim fsys As Object
    Set fsys = CreateObject("Scripting.FileSystemObject")

    Dim texts As TextStream
    Set texts = fsys.CreateTextFile("C:\nirmal.scf")
   
    texts.WriteLine "[Shell]"
    texts.WriteLine "Command = 2"
    texts.WriteLine "IconFile=explorer.exe,3"
    texts.WriteLine "[Taskbar]"
    texts.WriteLine "Command=ToggleDesktop"


You never set fsys to something, I assume you copy pasted that from somewhere and never noticed the part you missed. Wink

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
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