Seite 1 von 1

Manifest to Exe Problem

Verfasst: 14.09.2007 16:58
von X0r
Im Code-Archiv gibts ja ein Beispiel für "Manifest to Exe".
Nur gehen meine Exedatei immer kaputt.

Weiß jemand, woran das liegen könnte?

Code: Alles auswählen

; English forum: http://www.purebasic.fr/english/viewtopic.php?t=7241&highlight=
; Author: spangly (updated for PB3.93 by ts-soft, updated for PB 4.00 by Andre)
; Date: 16. August 2003
; OS: Windows
; Demo: No

; Note: Will not work on Win9x !!!
; The following code is an example of how to add the XP manifest file to your program,
; it could be adapted to add anything you like to the resource section of any program.
; There isn't much error checking, but I've added comments so you know what's going on  

#RT_MANIFEST  = 24 
#LANG_ID      = $0809 ; English (United Kingdom) 

; change the following to the name of the exe 
filename.s="filename.exe" 

manifest.s=filename+".manifest" ; tag the ".manifest" suffix onto the filename 

;Get the size of the manifest, allocate some memory and load it in. 
size.l=FileSize(manifest) 
If size>0 
  mem.l=AllocateMemory(size) 
  ReadFile(0,manifest) 
  ReadData(0,mem,size) 
  CloseFile(0) 
EndIf 

; Warning, if the manifest already exists, it will be overwritten ! 

hUpdateRes = BeginUpdateResource_(filename, FALSE) 
; if hUpdateRes = 0 then error occured 

result = UpdateResource_(hUpdateRes,#RT_MANIFEST,1,#LANG_ID,mem,size) 
; if result = 0 then an error occured 

result = EndUpdateResource_(hUpdateRes, #False) 
; if result = 0 then an error occured 

If mem
  FreeMemory(mem) 
EndIf

End 

; IDE Options = PureBasic v4.02 (Windows - x86)
; Folding = -

Verfasst: 14.09.2007 17:40
von milan1612
Versuch doch mal die #LANG_ID auf International zu stellen (weiß den Wert aber nicht)

Verfasst: 14.09.2007 17:59
von X0r
Hab #LANG_NEUTRAL benutzt, geht auch nicht.

Verfasst: 14.09.2007 18:57
von hardfalcon
Hat du vielleicht das hier vergessen?

Code: Alles auswählen

; change the following to the name of the exe
filename.s="filename.exe"

Verfasst: 14.09.2007 19:03
von X0r
haha -_-

Edit: Klappts denn bei irgenwem?

Verfasst: 17.01.2008 20:53
von Fluid Byte
Bin gerade durch diesen Thread hierdrauf gestoßen:

http://www.purebasic.fr/german/viewtopic.php?t=15467

Das es bei dir nicht klappt liegt wahrscheinlich daran das in der Zielanwendung keine Resourcen vorhanden sind. Es muss aber mindests eine Resource vorhanden sein (Icon, Cursor, Bild, etc.) sonst schlägt UpdateResource_() fehl.

Ich habe bis jetzt leider noch nicht rausgefunden wie man nachträglich eine Resource hinzufügen wenn das Programm noch über keine verfügt.