|
|
#1 |
|
Forum King
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. |
|
|
|
|
|
#2 |
|
Smokes Two Joints
Beta Team |
'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! |
|
|
|
|
|
#3 |
|
Forum King
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. |
|
|
|
|
|
#4 |
|
Forum King
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. |
|
|
|
|
|
#5 |
|
Major Dude
|
possibly by hexing the .exe and reg files but not sure.
|
|
|
|
|
|
#6 |
|
Forum King
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. |
|
|
|
|
|
#7 |
|
Forum King
|
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 |
|
|
|
|
|
#8 |
|
Banned
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? |
|
|
|
|
|
#9 |
|
Forum King
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. |
|
|
|
|
|
#10 |
|
Forum King
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. |
|
|
|
|
|
#11 |
|
Forum King
|
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 |
|
|
|
|
|
#12 |
|
Forum King
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. |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|