forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How do assign a custom icon to my exe file?

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
Anonymous
Guest





PostPosted: Tue Feb 15, 2005 1:52 pm    Post subject: How do assign a custom icon to my exe file? Reply with quote

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

PostPosted: Wed Feb 16, 2005 3:34 am    Post subject: How do assign a custom icon to my exe file? Reply with quote

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
View user's profile Send private message
Anonymous
Guest





PostPosted: Wed Feb 16, 2005 10:07 am    Post subject: How do assign a custom icon to my exe file? Reply with quote

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

PostPosted: Wed Feb 16, 2005 3:49 pm    Post subject: How do assign a custom icon to my exe file? Reply with quote

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:

Code:
scc main.c


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:

Code:
src res.rc


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
View user's profile Send private message
Anonymous
Guest





PostPosted: Wed Feb 16, 2005 6:39 pm    Post subject: How do assign a custom icon to my exe file? Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group