IT-Consultant: Charles Pegge > OxygenBasic Examples

Files Binder in o2

(1/2) > >>

Zlatko Vid:
Hello Charles

In a old topic from o2 forum you said:

In Oxygen:

--- Quote ---exe=getfile "C:\minGUI.exe"
src=getfile "C:\CaptionString.abp"
putfile "C:\MRuntime.exe",exe+src
--- End quote ---

So let say if my exe file is 1000 bytes in size
then my string binded file code file must start from 1001 that
final exe is continued....right?

That part is fine :
But then how i can load that binded file from 1001 location from the final exe?

Charles Pegge:
Hi Aurel,
The easiest way: (ok for files up to around 20 meg)

--- Code: ---string s=getfile("C:\MRuntime.exe")
string src=mid(s,1001)

--- End code ---

Zlatko Vid:
Thanks Charles
This looks almost to simple to be true
so runtime exe call string from himself hmm
ok i will try just to see is possible on that way

Charles Pegge:
Yes, this is a much simplified way of handling files. Otherwise there is always fopen .. fclose

Zlatko Vid:
Hello Charles ..and others of course..

I finally find some time to try to rebuild this Binder program.
I can say that Binding work ...
here is my prog:

--- Code: --- $ filename "Bind32.exe"
 uses RTL32

' embedfile "t.txt",d
' byte exef,srcf

exef =  getfile "C:\GUIApp.exe"
print len(exef) + " bytes"

srcf =  getfile "C:\mySrc.txt"
print len(srcf) + " bytes"

putfile "C:\MyRuntime.exe",exef + srcf
print "OK..." + len exef + srcf

--- End code ---

and here is simple GUI program with one button
which should trigg or better to say load binded string from the end of exe .
Binded string is just ordinary .txt file called mySrc.txt which contain text ---> "Aurel"

so i tried to load with your suggested method

case b1ID  'open file
              if notifycode=0
                 'call our binded string ....
                  sf = getfile("C:\GUIApp.exe")
                  src = mid(sf,22528,5) '22528 + 1 ..add LEN of src
                  print strptr src

              end if

when i try it without strptr then i get nothing in message box
when i use strptr then i get adress ( number)
so my question is how to get it as string text ?

here is code of GUI app

--- Code: ---'test GUI app as runtime to call binded string from himself
$ filename "GUIApp.exe"
include "" : include "" : #lookahead

INT win,x=0,y=0,w=400,h=300,wstyle = WS_MINMAXSIZE
INT button1, b1ID = 100
STRING sf ' src file
STRING src  ' source str

' open window
win = SetWindow("Skeleton GUI 038 App...",x,y,w,h,0,wstyle)
'create button control
SetButton(win ,10,40,100,32,"Call String ?",0x50001000,0x200,b1ID)

Wait()  '/// message loop function ///

Function WndProc(sys hwnd,wmsg,wparam,lparam) as sys callback
win = hwnd 'assign WIN with HWND
CASE win
Select wmsg

    'case WM_CREATE
'button1 = SetButton(win,10,40,80,26,"Call string ...",0x50001000,0x200,b1ID)

    case WM_COMMAND
         controlID = LoWord(wParam) 'get control ID
         notifyCode = HiWord(wParam) 'get notification message

         select controlID
           case b1ID  'open file
              if notifycode=0
                 'call our binded string ....
                  sf = getfile("C:\GUIApp.exe")
                  src = mid(sf,22528,5) '22528 + 1 ..add LEN of src
                  print strptr src

              end if
         end select

End Select

RETURN Default

--- End code ---

Well...this method ..if work can be used for so many things like config inside .exe or similar..


[0] Message Index

[#] Next page

Go to full version