Welcome to Dream.In.Code
Become a VB Expert!

Join 137,195 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 2,339 people online right now. Registration is fast and FREE... Join Now!




I have looked EVERYWHERE!

 
Reply to this topicStart new topic

I have looked EVERYWHERE!

tssguy123
18 Jul, 2008 - 08:16 AM
Post #1

New D.I.C Head
*

Joined: 18 Jul, 2008
Posts: 3

I am looking to create a simple .exe that deletes a folder (C:/Program Files/World Of Warcraft/Cache), and then Opens the .exe C:/Program Files/World Of Warcraft/WoW.exe

IPB Image

Oh...

My problem is I do not know the code for either buttons.

I tried OPEN 'WoW.exe for input'


By the way, I just started VB6 yesterday by making my own browser.

Yesssss!

I got the .exe to run with

CODE

Private Sub cmdExec_Click() ' cmdExec is the name of the command button on any form.

Dim RetVal

RetVal = Shell("C:\Program Files\World Of Warcraft\WoW.exe", 1)    ' Run WoW.



End Sub


This post has been edited by tssguy123: 18 Jul, 2008 - 08:51 AM
User is offlineProfile CardPM
+Quote Post

PixelCard
RE: I Have Looked EVERYWHERE!
18 Jul, 2008 - 11:46 AM
Post #2

D.I.C Head
Group Icon

Joined: 20 Jun, 2008
Posts: 139



Thanked: 3 times
Dream Kudos: 650
My Contributions
Try the code to delete the folder:

vb

Dim fSystemObject As New Scripting.FileSystemObject
fSystemObject.DeleteFolder "C:\Program Files\World Of Warcraft\Cache", True


Why do you use the RetVal to execute a shell command? Try just executing the shell command:

vb

Shell("C:\Program Files\World Of Warcraft\WoW.exe", 1)


This post has been edited by PixelCard: 18 Jul, 2008 - 11:50 AM
User is offlineProfile CardPM
+Quote Post

saurabhv
RE: I Have Looked EVERYWHERE!
18 Jul, 2008 - 11:53 AM
Post #3

New D.I.C Head
*

Joined: 18 Jul, 2008
Posts: 8

QUOTE(tssguy123 @ 18 Jul, 2008 - 09:16 AM) *

I am looking to create a simple .exe that deletes a folder (C:/Program Files/World Of Warcraft/Cache), and then Opens the .exe C:/Program Files/World Of Warcraft/WoW.exe

IPB Image

Oh...

My problem is I do not know the code for either buttons.

I tried OPEN 'WoW.exe for input'


By the way, I just started VB6 yesterday by making my own browser.

Yesssss!

I got the .exe to run with

CODE

Private Sub cmdExec_Click() ' cmdExec is the name of the command button on any form.

Dim RetVal

RetVal = Shell("C:\Program Files\World Of Warcraft\WoW.exe", 1)    ' Run WoW.



End Sub



it is quite easy

here

create a button and change its name to "delete" without quotes and the put the following code in your code module:

[code]
Private Sub delete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles delete.Click

My.Computer.FileSystem.DeleteDirectory("address of the folder you want to delete", FileIO.DeleteDirectoryOption.DeleteAllContents, FileIO.RecycleOption.SendToRecycleBin, FileIO.UICancelOption.DoNothing)
End Sub

now run the code and if it does what you want it to do then click on the Build menu on top, and then select Publish [Your application name] and now follow the wizard.

Hope it helped
User is offlineProfile CardPM
+Quote Post

PixelCard
RE: I Have Looked EVERYWHERE!
18 Jul, 2008 - 11:59 AM
Post #4

D.I.C Head
Group Icon

Joined: 20 Jun, 2008
Posts: 139



Thanked: 3 times
Dream Kudos: 650
My Contributions
QUOTE(saurabhv @ 18 Jul, 2008 - 12:53 PM) *

QUOTE(tssguy123 @ 18 Jul, 2008 - 09:16 AM) *

I am looking to create a simple .exe that deletes a folder (C:/Program Files/World Of Warcraft/Cache), and then Opens the .exe C:/Program Files/World Of Warcraft/WoW.exe

IPB Image

Oh...

My problem is I do not know the code for either buttons.

I tried OPEN 'WoW.exe for input'


By the way, I just started VB6 yesterday by making my own browser.

Yesssss!

I got the .exe to run with

CODE

Private Sub cmdExec_Click() ' cmdExec is the name of the command button on any form.

Dim RetVal

RetVal = Shell("C:\Program Files\World Of Warcraft\WoW.exe", 1)    ' Run WoW.



End Sub



it is quite easy

here

create a button and change its name to "delete" without quotes and the put the following code in your code module:

[code]
Private Sub delete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles delete.Click

My.Computer.FileSystem.DeleteDirectory("address of the folder you want to delete", FileIO.DeleteDirectoryOption.DeleteAllContents, FileIO.RecycleOption.SendToRecycleBin, FileIO.UICancelOption.DoNothing)
End Sub

now run the code and if it does what you want it to do then click on the Build menu on top, and then select Publish [Your application name] and now follow the wizard.

Hope it helped


He is using VB6, not .NET, so the above code won't work in this case.

QUOTE

now run the code and if it does what you want it to do then click on the Build menu on top, and then select Publish [Your application name] and now follow the wizard.


By the way, why should the topic starter publish his application, huh?

This post has been edited by PixelCard: 18 Jul, 2008 - 12:05 PM
User is offlineProfile CardPM
+Quote Post

tssguy123
RE: I Have Looked EVERYWHERE!
23 Jul, 2008 - 02:01 PM
Post #5

New D.I.C Head
*

Joined: 18 Jul, 2008
Posts: 3

Well, I got it working.
I was wondering what code I could use to make a popup well popup when You click the delete button that says Deleted or Are You Sure you want to delete? Y/N

Just some sort of confirmation..


User is offlineProfile CardPM
+Quote Post

KyleG
RE: I Have Looked EVERYWHERE!
23 Jul, 2008 - 02:29 PM
Post #6

New D.I.C Head
*

Joined: 11 Jun, 2008
Posts: 41



Thanked: 1 times
My Contributions
Doesn't anybody use batch files any more?

Step 1: Create a new text file with notepad
Step 2: Type these two lines into the text file, quotes and all:
CODE

RMDIR /S "C:\Program Files\World Of Warcraft\Cache"
"C:\Program Files\World Of Warcraft\WoW.exe"

Step 3: Save and close the text file
Step 4: Rename the file to WhateverYouWant.bat
Step 5: Double-click the file to run it just like any other program
User is offlineProfile CardPM
+Quote Post

tope10
RE: I Have Looked EVERYWHERE!
26 Jul, 2008 - 12:50 AM
Post #7

New D.I.C Head
*

Joined: 25 Jun, 2008
Posts: 22



Thanked: 2 times
My Contributions
QUOTE

I just made to code for deleting the folder and for starting the application/
before you execute the program add the dll "Micrsoft Scripting Runtime Library". To add the dll goto project menu then references, locate the said dll and check it and click ok, then run the program..



CODE

Dim fsodelete As New FileSystemObject
Dim ans As VbMsgBoxResult
Private Sub cmdDeleteCache_Click()
    ans = MsgBox("Sure you want to delete the cache files?", vbQuestion + vbYesNo)
    
    If ans = vbYes Then
        fsodelete.DeleteFolder "C:/Program Files/World Of Warcraft/Cache", True
    End If
End Sub

Private Sub cmdStart_Click()
    Shell "C:/Program Files/World Of Warcraft/WoW.exe", vbNormalFocus

End Sub



smile.gif
User is offlineProfile CardPM
+Quote Post

tssguy123
RE: I Have Looked EVERYWHERE!
27 Jul, 2008 - 05:55 PM
Post #8

New D.I.C Head
*

Joined: 18 Jul, 2008
Posts: 3

QUOTE(KyleG @ 23 Jul, 2008 - 03:29 PM) *

Doesn't anybody use batch files any more?

Step 1: Create a new text file with notepad
Step 2: Type these two lines into the text file, quotes and all:
CODE

RMDIR /S "C:\Program Files\World Of Warcraft\Cache"
"C:\Program Files\World Of Warcraft\WoW.exe"

Step 3: Save and close the text file
Step 4: Rename the file to WhateverYouWant.bat
Step 5: Double-click the file to run it just like any other program



I wanted it to have some sort of GUI.

Thats why.

This was inspired by a batch file, but I wanted to improve it.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/4/08 12:10PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month