View previous topic :: View next topic |
Author |
Message |
Anonymous Guest
|
Posted: Tue Feb 15, 2005 1:52 pm Post subject: How do assign a custom icon to my exe file? |
|
|
Hi, how do I assign a custom icon to my exe file in Salford Plato3. With other compliers such as C++ builder there are options to do this. Can someone tell me code I need to do this. Thanks in advance |
|
Back to top |
|
|
Andrew
Joined: 09 Sep 2004 Posts: 232 Location: Frankfurt, Germany
|
Posted: Wed Feb 16, 2005 3:34 am Post subject: How do assign a custom icon to my exe file? |
|
|
There are two issues here - assigning an icon to the exe itself, so it can be seen in explorer, and the other is if you wanted to produce a window icon. The first of these issues is very simple to sort out, the following code will embed an icon as a resource in your exe for both Win32 and .NET:
Code: |
PROGRAM icontest
PRINT *,"This program has an icon"
END
RESOURCES
myIcon ICON c:myicon.ico
|
If you want to have a window icon too for Clearwin+ apps, look into the Clearwin+ code for %mi. |
|
Back to top |
|
|
Anonymous Guest
|
Posted: Wed Feb 16, 2005 10:07 am Post subject: How do assign a custom icon to my exe file? |
|
|
Thanks for the reply. Sorry to be annoying but I am having problems with the code above. I didn't make it clear in my first post that the code needs to be in C. I am a newcomer to C programing and am not sure what functions are in what libaries yet. If you could tell me the exact code and what .h file i need to include that would be a great help. I am not meant to use Clearwin+ for my project. I just need the code that changes the default blue and white box on the compiled .exe to my own personalised icon which is stored in the same folder. Thanks |
|
Back to top |
|
|
Andrew
Joined: 09 Sep 2004 Posts: 232 Location: Frankfurt, Germany
|
Posted: Wed Feb 16, 2005 3:49 pm Post subject: How do assign a custom icon to my exe file? |
|
|
Plato 3 is really designed for Fortran and as far as I know there is no direct way to do this from within Plato - it is all possible, but you will have to use the command line. Say you have a C program like:
Code: |
#include <stdio.h>
int main() {
printf("my program now has an icon!n");
}
|
compile this using scc, but do not link anything, so use the command:
This will produce an object file main.obj. You then need to create a res file called say res.rc and in this file you should define an icon resource like:
Code: |
myicon ICON myicon.ico
|
You should then compile this with the resource compiler using the command:
This will produce a object file called res.obj. These files then need to be linked together, you should use the linker, slink.exe for this with a command like
Code: | slink -out:main.exe main.obj res.obj |
This will link your object files to produce an executable that will have the icon defined in the resource file as its icon. |
|
Back to top |
|
|
Anonymous Guest
|
Posted: Wed Feb 16, 2005 6:39 pm Post subject: How do assign a custom icon to my exe file? |
|
|
Thanks! got it working a treat, your a legend. Can't wait to hand my hello world program in with it's own icon! (maybe a bit more advanced than hello world, only just though lol). |
|
Back to top |
|
|
|