Old 23rd January 2002, 19:58   #1
eleet-2k2
Forum King
 
eleet-2k2's Avatar
 
Join Date: Aug 2001
Location: Mobil Ave.
Posts: 5,381
Some VB6 help please...

Hello again. Sorry for these help posts. I feel kind of embarrased posting these but I really need help. I'm writing a program that requires the changing of a filename, including the extension. Could someone please offer some sample lines of code, or a whole segment to do the process, or even some help please.

I need help with the following things: (This is easy stuff for you l33ter programmers )
1. Change a filename and the file extension. I.e. to .bak or something.

2. How to move files to different folders. For example, C:\My documents\myfile.exe to c:\windows\system\ .

Thanks you for any and all help.

"Welcome to the Island of people who know too much."..."Did you really think balloons would stop him?!"
See what I'm listening too.
eleet-2k2 is offline   Reply With Quote
Old 23rd January 2002, 20:34   #2
liquidmotion
Smokes Two Joints
Beta Team
 
liquidmotion's Avatar
 
Join Date: Feb 2001
Location: SFBA
Posts: 3,680
Send a message via ICQ to liquidmotion
'Begin shitty code

Public Function RenameFile(strFilename as string, strNewFilename as string) as boolean
On Error GoTo ERR_RENAME

dim intFile as integer
dim strTemp as string

'read old file into string
intFile = FreeFile

Open strFilename for access as #intFile
Do While Not EOF(intFile)
lineinput #intFile, strTemp
doevents
Loop
close #intFile

'Put file into new file
intFile = FreeFile

open strNewFilename for input as #intFile
print #intFile, strTemp
close #intFile

'Delete old file
Kill strFilename

RenameFile = True

ERR_RENAME:
RenameFile = False
end Function

Have fun!

For a good time: shup | stashbox | my homepage
liquidmotion is offline   Reply With Quote
Old 23rd January 2002, 22:23   #3
eleet-2k2
Forum King
 
eleet-2k2's Avatar
 
Join Date: Aug 2001
Location: Mobil Ave.
Posts: 5,381
Thanks liquid. I'll post a reply or PM if I have any problems.

"Welcome to the Island of people who know too much."..."Did you really think balloons would stop him?!"
See what I'm listening too.
eleet-2k2 is offline   Reply With Quote
Old 23rd January 2002, 22:42   #4
eleet-2k2
Forum King
 
eleet-2k2's Avatar
 
Join Date: Aug 2001
Location: Mobil Ave.
Posts: 5,381
Here's another question, I was wondering if it is possible to move the exe of a program to another directory but still be able to run the program, with only moving the exe file. Is that possible, since I know it is with shortcuts, but I have to actually move the exe. Any help please?

"Welcome to the Island of people who know too much."..."Did you really think balloons would stop him?!"
See what I'm listening too.
eleet-2k2 is offline   Reply With Quote
Old 23rd January 2002, 22:43   #5
deathazre
Major Dude
 
Join Date: Oct 2001
Location: behind the wheel of a Cat service truck
Posts: 1,847
Send a message via ICQ to deathazre Send a message via AIM to deathazre
possibly by hexing the .exe and reg files but not sure.
deathazre is offline   Reply With Quote
Old 23rd January 2002, 22:54   #6
eleet-2k2
Forum King
 
eleet-2k2's Avatar
 
Join Date: Aug 2001
Location: Mobil Ave.
Posts: 5,381
Oh well. I hate using hex ed's and editing registry. It's soooo boring with the alphanumeric and other assorted value types.

"Welcome to the Island of people who know too much."..."Did you really think balloons would stop him?!"
See what I'm listening too.
eleet-2k2 is offline   Reply With Quote
Old 23rd January 2002, 23:35   #7
Curi0us_George
Forum King
 
Curi0us_George's Avatar
 
Join Date: Apr 2001
Location: Oxford, MS Posts: -1
Posts: 5,179
Send a message via AIM to Curi0us_George Send a message via Yahoo to Curi0us_George
What exactly are you trying to do by moving the file? Give us a bit more info. There might be a simpler way, if I knew what you actually wanted to do. Are you wanting to move the file while it's running? Move it and then run it? Something else?

For the freedom to express myself in my own way without fear of being censored or banned.

47 65 6C 61 65 64 2E 63 6F 6D 00
Curi0us_George is offline   Reply With Quote
Old 24th January 2002, 09:16   #8
rm'
Banned
 
rm''s Avatar
 
Join Date: Jul 2000
Posts: 11,361
While we are on the topic of VB, I need help parsing text. Say I have a number such as 3897473988.383948973988938

I would need to use the decimal as a delimiter... I can get that far, and place each token into a list box by using a for-next loop... but that's not what I need. I need the left side in one distinct variable, and the right side in another. Any suggestions?
rm' is offline   Reply With Quote
Old 24th January 2002, 13:10   #9
eleet-2k2
Forum King
 
eleet-2k2's Avatar
 
Join Date: Aug 2001
Location: Mobil Ave.
Posts: 5,381
Curious George: What I had in mind was moving an exe to a completely new folder and then still be able to run the exe from the new dir but have it work and not give me errors about the files not being with it.

RM: Let me get this straight. Lets say 123.456 is your number but you need the "123" part as the right side of another variable? So do you mean like this:

123.456 (take the 123)
and make variable #2 with the value of 123.789?

If that's the case, why not put the number into an integer variable (or round off the decimal to the the nearest 1, or even chopping the decimal off completely) and then do something like this:

sngNumber1 = 123.456
intNumber2 = sngNumber1
lngNumber3 = intNumber2.4254747

Simply, try casting the decimal number into a variable that doesn't support decimals, and then cast your new variable into another variable that does support decimals.

"Welcome to the Island of people who know too much."..."Did you really think balloons would stop him?!"
See what I'm listening too.
eleet-2k2 is offline   Reply With Quote
Old 24th January 2002, 23:13   #10
eleet-2k2
Forum King
 
eleet-2k2's Avatar
 
Join Date: Aug 2001
Location: Mobil Ave.
Posts: 5,381
So can no one help me? I just revived the thread to see if I could get more help.

"Welcome to the Island of people who know too much."..."Did you really think balloons would stop him?!"
See what I'm listening too.
eleet-2k2 is offline   Reply With Quote
Old 24th January 2002, 23:21   #11
Curi0us_George
Forum King
 
Curi0us_George's Avatar
 
Join Date: Apr 2001
Location: Oxford, MS Posts: -1
Posts: 5,179
Send a message via AIM to Curi0us_George Send a message via Yahoo to Curi0us_George
Hrm. You could probably just move the other files along with it. Short of that, you'll have to hax0r the executable, unless it's getting the file locations from the registry or an ini, though neither of those is likely.

For the freedom to express myself in my own way without fear of being censored or banned.

47 65 6C 61 65 64 2E 63 6F 6D 00
Curi0us_George is offline   Reply With Quote
Old 25th January 2002, 17:10   #12
eleet-2k2
Forum King
 
eleet-2k2's Avatar
 
Join Date: Aug 2001
Location: Mobil Ave.
Posts: 5,381
Alright, thanks anyway Curious. I was thinking that myself but I think I can manage it to work so that I just delete all known shortcuts, impleent my program nad make a shortcut to that. Thanks!

"Welcome to the Island of people who know too much."..."Did you really think balloons would stop him?!"
See what I'm listening too.
eleet-2k2 is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Community Center > General Discussions

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump