MS RC.exe handles one or more include folders to be set.
You could ask to use the main file's folder one of these folders.
If that case you could also use subfolders like:
ICON1 ICON "images\\icon1.ico"
Several icons in an EXE
-
- Addict
- Posts: 1073
- Joined: Fri Apr 25, 2003 11:13 pm
- Location: Netherlands
- Contact:
Re: Several icons in an EXE
PORC.exe (comes with PB) supports the same, but the PB-IDE doesn't set a path.Edwin Knoppert wrote:MS RC.exe handles one or more include folders to be set.
You could ask to use the main file's folder one of these folders.
If that case you could also use subfolders like:
ICON1 ICON "images\\icon1.ico"
Pelles C - Help wrote: /I option (PORC)
Syntax:
/I path
Description:
The /I option adds a new path where the resource compiler should look for #include files, or files specified in ANICURSOR, ANIICON, BITMAP, CURSOR, HTML, ICON, MANIFEST, MESSAGETABLE, PLUGPLAY or VXD statements.
- Michael Vogel
- Addict
- Posts: 2808
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
Re: Several icons in an EXE
Hey, the best one, thanks!ts-soft wrote:create a "myresource.res" with porc from your script and import this!
And porc accepts all types of paths, relative and absolute

So I'm wondering if porc is not used by PB or the IDE makes something wrong - why else you need absolute pathes here

Michael
PS another (tiny) issue concerning resource files within the IDE: if add a new rc file via file selector and choose the file by a double click, the compiler options get closed

PSS wrote a small tool which "automatically" generates the RES file:
[-] you still need to write the RC file and add the Import "File.Res" into the source
[+] you don't have to use the command line, search for the porc.exe etc.
Code: Select all
; • "Tool PorcMeUp.exe" is located in directory "...\Purbasic\Catalogs\
;
; • Configuration of the Tool
; %COMPILEFILE\..\Catalogs\Tool PorcMeUp.exe
; "%TEMPFILE" "%PATH"
; %COMPILEFILE\..
;
; Auto &Indent
; Menu Or Shortcut
;
; - Wait until tool quits
; - Reload Source after tool has quit
; - into the current source
; • written by Michael Vogel...
Procedure Init()
; Dateinamen holen...
If CountProgramParameters()<>2
MessageBox_(0,"'Porc Me Up' needs two parameters!"+#CR$+"Add %TEMPFILE and %PATH to configuration","Error",#MB_ICONERROR|#MB_OK)
End
EndIf
Global SourceFile.s=ProgramParameter()
Global SourcePath.s=ProgramParameter()
Global FileRC.s=""
Global FileRES.s=""
EndProcedure
Procedure Doit()
Protected z.s
Protected l.s
Protected n
Protected m
Init()
ReadFile(1,SourceFile)
While Not(Eof(1))
z=ReadString(1)
l=LCase(z)
n=FindString(l,"import ",1)
If n
z=Trim(z)
z=Trim(z,#TAB$)
l=LCase(z)
If FindString(l,"import ",1)=1
n=FindString(l,".res",1)
If n
m=FindString(l,#DQUOTE$,1)
FileRES=Mid(z,m+1,n-m+3)
Break
EndIf
EndIf
EndIf
Wend
CloseFile(1)
If Len(FileRes)=0
MessageBox_(0,"'Porc Me Up' has nothing to do..."+#CR$+"Import ''Resource.Res'' missing!","Error",#MB_ICONERROR|#MB_OK)
Else
FileRC=Left(FileRES,Len(FileRES)-2)+"c"
n=RunProgram(#PB_Compiler_Home+"Compilers\porc.exe",#DQUOTE$+FileRC+#DQUOTE$,SourcePath,#PB_Program_Hide)
MessageBox_(0,"'Porc Me Up' has generated '"+FileRES+"'..."+#CR$+"Porc's Return Value = "+Str(n),"Information",#MB_ICONINFORMATION|#MB_OK)
EndIf
EndProcedure
Doit()
- Michael Vogel
- Addict
- Posts: 2808
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
Re: Several icons in an EXE
Actually, including multiple icons (resources) into a compiled purebasic program is not perfect -- using a 'rc' file don't work with relative path names.
Feature Request: please think about allowing an alternative method (adding multiple file names into the icon field, parsing the 'rc' file to correct the path names, modifying the linker etc.) to support relative path names...
Feature Request: please think about allowing an alternative method (adding multiple file names into the icon field, parsing the 'rc' file to correct the path names, modifying the linker etc.) to support relative path names...
-
- Addict
- Posts: 1064
- Joined: Sun Jul 25, 2004 4:21 pm
- Location: USoA
Re: Several icons in an EXE
First create your windows in the normal fashion. Then use WM_SETICON to apply any icon to any window:
Err, uhhhh... maybe I didn't understand the intent of this tip. What was the question? 
Code: Select all
Enumeration ; Whatever you want to call your windows :)
#Main_Window
#Sub_Window_1
#Sub_Window_2
#Sub_Window_3
EndEnumeration
; << Create your windows here, and afterward, apply icons as indicated below:
If FileSize("C:\aaaa\bbbb\image1.ico") > 0
image1hndl = LoadImage(#Sub_Window_1, "C:\aaaa\bbbb\image1.ico")
SendMessage_(WindowID(#Sub_Window_1), #WM_SETICON, 1, image1hndl)
EndIf
If FileSize("C:\aaaa\bbbb\image2.ico") > 0
image2hndl = LoadImage(#Sub_Window_2, "C:\aaaa\bbbb\image2.ico")
SendMessage_(WindowID(#Sub_Window_2), #WM_SETICON, 1, image2hndl)
EndIf
If FileSize("C:\aaaa\bbbb\image3.ico") > 0
image3hndl = LoadImage(#Sub_Window_3, "C:\aaaa\bbbb\image3.ico")
SendMessage_(WindowID(#Sub_Window_3), #WM_SETICON, 1, image3hndl)
EndIf
; etc,etc,etc...

- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Randy
I *never* claimed to be a programmer.
Re: Several icons in an EXE
I do what Randy does, but use IncludeBinary...
Code: Select all
DataSection
ImageList: Data.i ?Image_1, ?Image_2, ?Image_3
Image_1: IncludeBinary "C:\icon\my1.ico"
Image_2: IncludeBinary "C:\icon\my2.ico"
Image_3: IncludeBinary "C:\icon\my3.ico"
EndDataSection
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum