| View previous topic :: View next topic |
| Author |
Message |
uwo Newbie
Joined: 03 May 2004 Posts: 3
|
Posted: May 3rd, 2004 03:31 PM Post subject: Binary file.......... HELP ME ! |
|
|
I want to create THIS FILE(download attach and extract file for view file)
I wish to create this file every time when i push a button, if by mustache I delete it, when i push a button and the file created in automatic mode.
Thank's in advance
Excuse my english......!!!!!!!!! |
|
| Back to top |
|
Gilad_r Centurion
Joined: 03 Mar 2004 Posts: 156
|
Posted: May 3rd, 2004 04:50 PM Post subject: |
|
|
load it in a resource file and then:
[vb:1:59cbb966bb] Dim b() As Byte
b() = LoadResData(ID, TYPE) 'set ID and TYPE according to what you set when you put it in the resource file
Open "c:\new.upd" For Binary As #1
Put #1, , b
Close #1
[/vb:1:59cbb966bb]
or just don't delete it in the first place
HTH
Gilad _________________ "you should make amends with you" (Incubus) |
|
| Back to top |
|
uwo Newbie
Joined: 03 May 2004 Posts: 3
|
Posted: May 4th, 2004 01:11 AM Post subject: |
|
|
Thank you GILAD , but I am new in Visual Basic...i don't know what to put in ID and in TYPE please be more explicit if you may perhaps you'll do the lines yourself
THE FILE 'TEST.UPD' (whicw is atached upper) is used by another aplication and is rased by it after beeing used automaticaly I WOULD LIKE TO CREATE ANOTHER APLICATION WHICH TO CREATE (TO REPLACE) THE FILE RASED PREVIOUSLY
thank you very much  |
|
| Back to top |
|
Gilad_r Centurion
Joined: 03 Mar 2004 Posts: 156
|
Posted: May 4th, 2004 06:42 AM Post subject: |
|
|
do you know how to load a file to a RES file?
goto to the menu 'Add-Ins' --> 'Add-In manager...'
load the 'VB 6 Resource Editor', press OK.
goto to the menu 'Tools' --> 'Resource Editor'
press on 'Add Custom Resource...' (it's the one before the '?')
select the file you want to add as a resource
right-click on the newly added file and select 'Properties...'
now you can edit the resouce ID and TYPE (and also Language),
and these are the values you have to put in a code like the one above.
the function LoadResData loads the data from the appropriate resource file (which is now a part of your app) to a byte array.
after doing that you can create the new file by stating: (NewFileName is a string containing the full path to the new file)
[vb:1:8daaad94ff]FileNum = FreeFile
Open NewFileName For Bianry As FileNum[/vb:1:8daaad94ff]
then you put the data you want into the file using: (b is the name of the byte array you loaded the RES file to...)
[vb:1:8daaad94ff] Put FileNum, , b[/vb:1:8daaad94ff]
and close the file:
[vb:1:8daaad94ff]Close FileNum[/vb:1:8daaad94ff]
and that's it...
HTH
Gilad _________________ "you should make amends with you" (Incubus) |
|
| Back to top |
|
uwo Newbie
Joined: 03 May 2004 Posts: 3
|
Posted: May 4th, 2004 01:00 PM Post subject: |
|
|
| Thank you very, very much GILAD , It WORKS !!! =D =D =D |
|
| Back to top |
|
|