Maintaining Icon Associations

  • Thread starter Thread starter Sam
  • Start date Start date
S

Sam

Guest
I have written an x86 Assembly language game which I now would like to
distribute online. I have made a custom icon for the game that I associate
with a shortcut to the game. I wish to distribute the game by zipping all of
its files in a folder and then providing the zip as a download.

My problem is that upon unzipping the folder on a new computer, the shortcut
no longer remains associated with the icon, even though the .ico file is in
the same directory. It is strange that the shortcuts themselves are able to
reestablish a correct path to their executables, but they are not able to
reestablish a correct path to their icons.

My game originally began as part of a class so I have very limited
real-world type programming experience, so I need a solution, if possible,
that is within Windows. Does anyone know a way to fix this short of me
writing an installer program?
 
Re: Maintaining Icon Associations

"Sam" <Sam@discussions.microsoft.com> сообщил/сообщила в новостях следующее: news:DD038930-7D91-4599-9C69-043E4DAFCAC7@microsoft.com...

>I have written an x86 Assembly language game which I now would like to
> distribute online. I have made a custom icon for the game that I associate
> with a shortcut to the game. I wish to distribute the game by zipping all of
> its files in a folder and then providing the zip as a download.
>
> My problem is that upon unzipping the folder on a new computer, the shortcut
> no longer remains associated with the icon, even though the .ico file is in
> the same directory. It is strange that the shortcuts themselves are able to
> reestablish a correct path to their executables, but they are not able to
> reestablish a correct path to their icons.
>


Why not just link the icon to executable itself?
 
Re: Maintaining Icon Associations

I may be wrong, I'm only trying to help, but I think your
problem is that you are declaring hard coded paths. Use
an environment variable instead.

%HomeDrive% - C:\
%SystemDrive% - C:\
%AllUsersProfile% - C:\Documents and Settings\All Users\
%HomePath% - C:\Documents and Settings\{username}\
%UserProfile% - C:\Documents and Settings\{username}\
%AppData% - C:\Documents and Settings\{username}\Application Data\
%TEMP% and %TMP% - C:\DOCUME~1\{username}\LOCALS~1\Temp\
%ProgramFiles% - C:\Program Files\
%CommonProgramFiles% - C:\Program Files\Common Files\
%SystemRoot% - C:\Windows\
%WinDir% - C:\Windows\
%CD% - \Current directory\

So, for a shortcut target path pointing to:
C:\Program Files\Some Game\game.ico
use:
%ProgramFiles%\Some Game\game.ico

If you had the icon embeded in the executable, you would have
a path string like this: %ProgramFiles%\Some Game\game.exe,0

(No quotes around an icon path!)


Where can I try your game?
What's it called?
What type or genre is it?
What format? Flash? DirectX?


ju.c


"Sam" <Sam@discussions.microsoft.com> wrote in message news:DD038930-7D91-4599-9C69-043E4DAFCAC7@microsoft.com...
> I have written an x86 Assembly language game which I now would like to
> distribute online. I have made a custom icon for the game that I associate
> with a shortcut to the game. I wish to distribute the game by zipping all of
> its files in a folder and then providing the zip as a download.
>
> My problem is that upon unzipping the folder on a new computer, the shortcut
> no longer remains associated with the icon, even though the .ico file is in
> the same directory. It is strange that the shortcuts themselves are able to
> reestablish a correct path to their executables, but they are not able to
> reestablish a correct path to their icons.
>
> My game originally began as part of a class so I have very limited
> real-world type programming experience, so I need a solution, if possible,
> that is within Windows. Does anyone know a way to fix this short of me
> writing an installer program?
 
Re: Maintaining Icon Associations

Well there is no installer for the game. The user can put it anywhere they
want. So I need the shortcuts to look in the same directory they are in to
find the icon, even though the actual path changes on each computer. You said
%CD% looks in the same directory, but I can't get that to seem to work.

The icon is not hardcoded into the .exe or the shortcuts. I just made an
icon myself separate from the program and went into the shortcut's properties
under "Change Icon" to associate it. I need it to maintain this association
if possible when put on other computers with different paths.

Also, about my game; as I mentioned it is written in x86 Assembly language.
It is a worm style game but with some new twists, high scores, and enemies.
It uses CGA graphics not anything very sophisticated. I'll post a link if you
want once I have gotten the shortcuts to keep their icons and I am ready for
people to download it.

"ju.c" wrote:

> I may be wrong, I'm only trying to help, but I think your
> problem is that you are declaring hard coded paths. Use
> an environment variable instead.
>
> %HomeDrive% - C:\
> %SystemDrive% - C:\
> %AllUsersProfile% - C:\Documents and Settings\All Users\
> %HomePath% - C:\Documents and Settings\{username}\
> %UserProfile% - C:\Documents and Settings\{username}\
> %AppData% - C:\Documents and Settings\{username}\Application Data\
> %TEMP% and %TMP% - C:\DOCUME~1\{username}\LOCALS~1\Temp\
> %ProgramFiles% - C:\Program Files\
> %CommonProgramFiles% - C:\Program Files\Common Files\
> %SystemRoot% - C:\Windows\
> %WinDir% - C:\Windows\
> %CD% - \Current directory\
>
> So, for a shortcut target path pointing to:
> C:\Program Files\Some Game\game.ico
> use:
> %ProgramFiles%\Some Game\game.ico
>
> If you had the icon embeded in the executable, you would have
> a path string like this: %ProgramFiles%\Some Game\game.exe,0
>
> (No quotes around an icon path!)
>
>
> Where can I try your game?
> What's it called?
> What type or genre is it?
> What format? Flash? DirectX?
>
>
> ju.c
>
>
> "Sam" <Sam@discussions.microsoft.com> wrote in message news:DD038930-7D91-4599-9C69-043E4DAFCAC7@microsoft.com...
> > I have written an x86 Assembly language game which I now would like to
> > distribute online. I have made a custom icon for the game that I associate
> > with a shortcut to the game. I wish to distribute the game by zipping all of
> > its files in a folder and then providing the zip as a download.
> >
> > My problem is that upon unzipping the folder on a new computer, the shortcut
> > no longer remains associated with the icon, even though the .ico file is in
> > the same directory. It is strange that the shortcuts themselves are able to
> > reestablish a correct path to their executables, but they are not able to
> > reestablish a correct path to their icons.
> >
> > My game originally began as part of a class so I have very limited
> > real-world type programming experience, so I need a solution, if possible,
> > that is within Windows. Does anyone know a way to fix this short of me
> > writing an installer program?

>
 
Re: Maintaining Icon Associations

Sam wrote:

> The icon is not hardcoded into the .exe or the shortcuts. I just made
> an icon myself separate from the program and went into the shortcut's
> properties under "Change Icon" to associate it.


When you did that you used Windows (on a specific machine) to change the
icon (on that specific machine) for a shortcut that links to the location
(on that specific machine) of your exe. See a pattern? :)
______________

> I need it to maintain
> this association if possible when put on other computers with
> different paths.


I see no way to do that automagically without an installer. You could
include a routine in your program that runs only once (first time it is
executed) to determine the disk path to your program, create a shortcut with
that path and hook the icon to the shortcut. Once done, your program (in
memory) would open the disc location of itself and write a value to a byte
which was originally zero. Each time the program runs it would check that
byte (in memory) - if not zero, it would continue; if zero, it would do the
shortcut/icon routine.

Personally, I'd just include a readme in the zip telling the user how to
make a shortcut and change that shortcut's icon to yours. Easier.

--

dadiOH
____________________________

dadiOH's dandies v3.06...
....a help file of info about MP3s, recording from
LP/cassette and tips & tricks on this and that.
Get it at http://mysite.verizon.net/xico
 
Re: Maintaining Icon Associations

%CD% means "Current Directory"

Therefore, if called from a Shortcut, the Shortcut's location would be
where it looks for the icon. A sort of catch-22.

You cannot create a Shortcut to an unknown path. Period.

You will have to create an installer. It would be very small and would
be very easy to do.

Or, you could just tell your downloader's to create the shortcut themselves.
Again, very easy. Anyone can do it.


ju.c


"Sam" <Sam@discussions.microsoft.com> wrote in message news:779E7DDD-246E-455F-A9E4-B6997107BCC7@microsoft.com...
> Well there is no installer for the game. The user can put it anywhere they
> want. So I need the shortcuts to look in the same directory they are in to
> find the icon, even though the actual path changes on each computer. You said
> %CD% looks in the same directory, but I can't get that to seem to work.
>
> The icon is not hardcoded into the .exe or the shortcuts. I just made an
> icon myself separate from the program and went into the shortcut's properties
> under "Change Icon" to associate it. I need it to maintain this association
> if possible when put on other computers with different paths.
>
> Also, about my game; as I mentioned it is written in x86 Assembly language.
> It is a worm style game but with some new twists, high scores, and enemies.
> It uses CGA graphics not anything very sophisticated. I'll post a link if you
> want once I have gotten the shortcuts to keep their icons and I am ready for
> people to download it.
>
> "ju.c" wrote:
>
>> I may be wrong, I'm only trying to help, but I think your
>> problem is that you are declaring hard coded paths. Use
>> an environment variable instead.
>>
>> %HomeDrive% - C:\
>> %SystemDrive% - C:\
>> %AllUsersProfile% - C:\Documents and Settings\All Users\
>> %HomePath% - C:\Documents and Settings\{username}\
>> %UserProfile% - C:\Documents and Settings\{username}\
>> %AppData% - C:\Documents and Settings\{username}\Application Data\
>> %TEMP% and %TMP% - C:\DOCUME~1\{username}\LOCALS~1\Temp\
>> %ProgramFiles% - C:\Program Files\
>> %CommonProgramFiles% - C:\Program Files\Common Files\
>> %SystemRoot% - C:\Windows\
>> %WinDir% - C:\Windows\
>> %CD% - \Current directory\
>>
>> So, for a shortcut target path pointing to:
>> C:\Program Files\Some Game\game.ico
>> use:
>> %ProgramFiles%\Some Game\game.ico
>>
>> If you had the icon embeded in the executable, you would have
>> a path string like this: %ProgramFiles%\Some Game\game.exe,0
>>
>> (No quotes around an icon path!)
>>
>>
>> Where can I try your game?
>> What's it called?
>> What type or genre is it?
>> What format? Flash? DirectX?
>>
>>
>> ju.c
>>
>>
>> "Sam" <Sam@discussions.microsoft.com> wrote in message news:DD038930-7D91-4599-9C69-043E4DAFCAC7@microsoft.com...
>> > I have written an x86 Assembly language game which I now would like to
>> > distribute online. I have made a custom icon for the game that I associate
>> > with a shortcut to the game. I wish to distribute the game by zipping all of
>> > its files in a folder and then providing the zip as a download.
>> >
>> > My problem is that upon unzipping the folder on a new computer, the shortcut
>> > no longer remains associated with the icon, even though the .ico file is in
>> > the same directory. It is strange that the shortcuts themselves are able to
>> > reestablish a correct path to their executables, but they are not able to
>> > reestablish a correct path to their icons.
>> >
>> > My game originally began as part of a class so I have very limited
>> > real-world type programming experience, so I need a solution, if possible,
>> > that is within Windows. Does anyone know a way to fix this short of me
>> > writing an installer program?

>>
 
Re: Maintaining Icon Associations

Sam wrote:
> Well there is no installer for the game. The user can put it anywhere they
> want. So I need the shortcuts to look in the same directory they are in to
> find the icon, even though the actual path changes on each computer. You said
> %CD% looks in the same directory, but I can't get that to seem to work.
>
> The icon is not hardcoded into the .exe or the shortcuts. I just made an
> icon myself separate from the program and went into the shortcut's properties
> under "Change Icon" to associate it. I need it to maintain this association
> if possible when put on other computers with different paths.
>
> Also, about my game; as I mentioned it is written in x86 Assembly language.
> It is a worm style game but with some new twists, high scores, and enemies.
> It uses CGA graphics not anything very sophisticated. I'll post a link if you
> want once I have gotten the shortcuts to keep their icons and I am ready for
> people to download it.
>
> "ju.c" wrote:
>
>> I may be wrong, I'm only trying to help, but I think your
>> problem is that you are declaring hard coded paths. Use
>> an environment variable instead.
>>
>> %HomeDrive% - C:\
>> %SystemDrive% - C:\
>> %AllUsersProfile% - C:\Documents and Settings\All Users\
>> %HomePath% - C:\Documents and Settings\{username}\
>> %UserProfile% - C:\Documents and Settings\{username}\
>> %AppData% - C:\Documents and Settings\{username}\Application Data\
>> %TEMP% and %TMP% - C:\DOCUME~1\{username}\LOCALS~1\Temp\
>> %ProgramFiles% - C:\Program Files\
>> %CommonProgramFiles% - C:\Program Files\Common Files\
>> %SystemRoot% - C:\Windows\
>> %WinDir% - C:\Windows\
>> %CD% - \Current directory\
>>
>> So, for a shortcut target path pointing to:
>> C:\Program Files\Some Game\game.ico
>> use:
>> %ProgramFiles%\Some Game\game.ico
>>
>> If you had the icon embeded in the executable, you would have
>> a path string like this: %ProgramFiles%\Some Game\game.exe,0
>>
>> (No quotes around an icon path!)
>>
>>
>> Where can I try your game?
>> What's it called?
>> What type or genre is it?
>> What format? Flash? DirectX?
>>
>>
>> ju.c
>>
>>
>> "Sam" <Sam@discussions.microsoft.com> wrote in message news:DD038930-7D91-4599-9C69-043E4DAFCAC7@microsoft.com...
>>> I have written an x86 Assembly language game which I now would like to
>>> distribute online. I have made a custom icon for the game that I associate
>>> with a shortcut to the game. I wish to distribute the game by zipping all of
>>> its files in a folder and then providing the zip as a download.
>>>
>>> My problem is that upon unzipping the folder on a new computer, the shortcut
>>> no longer remains associated with the icon, even though the .ico file is in
>>> the same directory. It is strange that the shortcuts themselves are able to
>>> reestablish a correct path to their executables, but they are not able to
>>> reestablish a correct path to their icons.
>>>
>>> My game originally began as part of a class so I have very limited
>>> real-world type programming experience, so I need a solution, if possible,
>>> that is within Windows. Does anyone know a way to fix this short of me
>>> writing an installer program?


You are responding to the question but I'm not sure you are answering it
Or maybe it should be answered differently:

The icon is not compiled as part of the EXE, can you compile it into the
EXE? That would solve the icon issue.
 
Back
Top