Bitte um Hilfe zu includefile u. includebinary

Für allgemeine Fragen zur Programmierung mit PureBasic.
roboehler
Beiträge: 12
Registriert: 03.01.2005 22:32
Wohnort: 78713 Schramberg

Bitte um Hilfe zu includefile u. includebinary

Beitrag 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!
GPI
Beiträge: 1511
Registriert: 29.08.2004 13:18
Kontaktdaten:

Beitrag von GPI »

Code: Alles auswählen

Global Picture1
Picture1 = LoadImage(1, "Rprodu.bmp")
Global Picture2
Picture2 = LoadImage(2, "euroum.bmp")

...

End
IncludePath ""
IncludeBinary "Rprodu.bmp" 
IncludeBinary "euroum.bmp" 
ist falsch.

richtig ist:

Code: Alles auswählen

Global Picture1
Picture1 = catchImage(1, ?Rprodubmp)
Global Picture2
Picture2 = catchImage(2, ?euroumbmp)

...

End
datasection
rprodubmp:
IncludeBinary "Rprodu.bmp" 
euroumbmp:
IncludeBinary "euroum.bmp" 
enddatasection
und verringere mal die Farbtiefe der Bitmaps, dann ists kleiner
CodeArchiv Rebirth: Deutsches Forum Github Hilfe ist immer gern gesehen!
roboehler
Beiträge: 12
Registriert: 03.01.2005 22:32
Wohnort: 78713 Schramberg

Beitrag von roboehler »

Danke natürlich auch an dich GPI für deine Mühe!
Benutzeravatar
NicTheQuick
Ein Admin
Beiträge: 8812
Registriert: 29.08.2004 20:20
Computerausstattung: Ryzen 7 5800X, 64 GB DDR4-3200
Ubuntu 24.04.2 LTS
GeForce RTX 3080 Ti
Wohnort: Saarbrücken

Beitrag von NicTheQuick »

Was soll diese doppelt-Post-erei?

Welchen dieser Posts soll ich löschen?
Antworten