Seite 1 von 1

Bitte um Hilfe zu includefile u. includebinary

Verfasst: 08.01.2005 21:46
von roboehler
Ich habe mit purebasic392 einen Euroumrechner geschrieben. Damit man 2 bmp-Bilder nicht von außen dazuladen muss, habe ich sie ins Programm
mit include integriert. Die Datei ist dadurch von ca. 17000 byte auf ca. 70000 byte gewachsen. (Anzeichen für mich, dass er die Bilder anscheinend in den code integriert hat. Sobald ich aber das Programm auf einem anderen Rechner laufen lasse packt er die Bilder beim Starten nicht aus. Was mach ich mit include falsch?
Beispielcode:

;----------------Constants (WINDOW1)
#berechneDM=1
#dm=2
#euro=3
#text=4
#text0=16
#text2=17
#wertdm=5
#berechneEuro=6
#dm1=7
#euro1=8
#text1=9
#werteuro=10
#W1Image1 = 11
#W1Image2 = 18
#W1Text3 = 12
#ende = 13
#W1Btn3 = 14
#Window1 =15
;----------------Constants (WINDOW2)
#Window2 = 2
#W2Btn1 = 1
#W2Text1 = 2
#W2Text2 = 3
#W2Text3 = 4
#W2Text4 = 5
#W2Text5 = 6
#Font = 17

;----------------Flags (WINDOW2)
#Window2Flags = #PB_Event_CloseWindow | #PB_Window_MinimizeGadget

#Window1Flags = #PB_Window_SystemMenu | #PB_Window_SizeGadget

;FontID.l = LoadFont(#Font, Name$, Höhe [, Flags])
;FontID.l = LoadFont(#Font, "Arial", 30 ,1)


new:
;LoadFont (1, "Arial", 30) ; Load Arial Font, Size 30
Global Picture1
Picture1 = LoadImage(1, "Rprodu.bmp")
Global Picture2
Picture2 = LoadImage(2, "euroum.bmp")

If OpenWindow(#Window1 ,200,150,320,350,#Window1Flags, "Euro-Kalkulator")
If CreateGadgetList(WindowID())
ButtonGadget(#berechneDM,200,60,90,20,"Berechne DM")
ButtonGadget(#ende,200,280,90,20,"ENDE")
ButtonGadget(#W1Btn3,200,305 ,89,25,"about")

ImageGadget(#W1Image2,4,7 ,100,62, Picture2)

StringGadget(#euro,20,60,60,20,"")
TextGadget (#text0, 90, 60, 100, 24, "Eingabe Euro")

StringGadget(#dm,20,90,60,20,"1.95",#PB_String_ReadOnly )
TextGadget (#text, 90, 90, 150, 24, "Umtauschwert Euro in DM")

TextGadget (#wertdm, 20, 120, 250, 24, "")

ButtonGadget(#berechneEURO,200,145,90,20,"Berechne EURO")

StringGadget(#dm1,20,145,60,20,"")
TextGadget (#text2, 90, 145, 100, 24, "Eingabe DM")

StringGadget(#euro1,20,175,60,20,"0.51",#PB_String_ReadOnly )
TextGadget (#text1, 90,175, 150, 24, "Umtauschwert DM in EURO")

TextGadget (#werteuro, 20, 205, 250, 24, "")
ImageGadget(#W1Image1,63,230 ,100,62, Picture1)
TextGadget(#W1Text3,32,300 ,161,17,"c) Robert Böhler 2003", #PB_Text_CENTER)

EndIf

Repeat
;StartDrawing(WindowOutput())
;DrawingMode(0) ;TextBackground deckend= 0 Transparent =1


;DrawingFont(UseFont(1)) ; Use the Arial font
;BackColor(123, 156, 191)
;FrontColor(211, 19, 223)
;Locate(3, 7) ; Set x,y position
;DrawText(" Euro-Umrechner ") ; Print our text

;StopDrawing() ; This is absolutely needed when the drawing operations are
; finished !!! Never forget it !
;EndIf
;Repeat
EventID = WaitWindowEvent()
If EventID = #PB_Event_CloseWindow
Quit = 1
EndIf

If EventID = #PB_Event_Gadget
If EventGadgetID()=#berechneDM

SetGadgetText(#dm1, ""+StrF(ValF(GetGadgetText(#euro))*ValF(GetGadgetText(#dm)))+"" )

EndIf
If EventGadgetID()=#berechneEuro
SetGadgetText(#euro, ""+StrF(ValF(GetGadgetText(#dm1))*ValF(GetGadgetText(#euro1)))+"" )
EndIf
If EventGadgetID()=#ende
End
EndIf
Select EventID;we check which window event are we receiving

Case #PB_EventGadget

Select EventGadgetID();in case its the event from our gadgets

Case #W1Btn3 ;----------Code; the user click the button
; FakeEndSelect

EndSelect

Select EventID

Case #PB_EventGadget

Select EventGadgetID()
Case #W1Btn3 ;----------Code zurück
; the user click the button
If OpenLibrary(0, "aboutrb.dll")
CallFunction(0, "about")
CloseLibrary(0)
EndIf
; MessageRequester("INFO ","made with Purebasic 3.92"+Chr(13)+"von ' Robert Böhler '"+Chr(13)+" Leibbrandstr.8"+Chr(13)+"D 78713 Schramberg"+Chr(13)+"Tel.:07422/23668"+Chr(13)+"E-Mail: roboehler@gmx.de"+Chr(13)+" roboehler@web.de"+Chr(13)+Chr(13)+"This is Freeware!",0)


EndSelect

EndSelect
EndSelect


EndIf
Until Quit=1
EndIf
End
IncludePath ""
IncludeBinary "Rprodu.bmp"
IncludeBinary "euroum.bmp"

Ich hoffe ihr könnt mir helfen!

roboehler- noch pureb.anfänger

Verfasst: 08.01.2005 22:03
von crossroads
Statt LoadImage() mußt Du CatchImage() verwenden:

Code: Alles auswählen

Global Picture1 
Picture1 = CatchImage(1, ?pic1)
Global Picture2 
Picture2 = CatchImage(2, ?pic2)


....

DataSection
pic1:IncludeBinary "Rprodu.bmp" 
pic2:IncludeBinary "euroum.bmp" 
EndDataSection

Verfasst: 08.01.2005 22:08
von roboehler
Danke an crossroads für die schnelle Antwort. Werds gleich mal ausprobieren!