Linking and Embedding icon for a non-executable file

BoQsc 1 Reputation point
2020-12-10T17:09:37.993+00:00

I want to embed an Icon inside .c file, move it to another computer and see the icon on a .c file, without the modifications to the system files, user files or operating system itself.

Example of not very useful solution: I'm aware of desktop.ini method. It is not viable, desktop.ini method requires manual editing of an external user-system file.

There is an interpreter that can run ANSI .c script files called Tiny C Compiler.
I'd like to have custom icons for some of these files. Similar to .exe resources.

I see that .lnk link files and website link files are capable to change the icons.

![46929-image.png]2

46966-image.png

If you have any input on this idea, any explanation or a link - that might be helpful - please share.

Would it be possible to embed and use icons in a similar way on .c files I mentioned before. Not for filetype, but for every specific .c file.

Related idea (for the executables):
https://en.wikipedia.org/wiki/Resource\_(Windows)
https://learn.microsoft.com/en-us/dotnet/framework/tools/winres-exe-windows-forms-resource-editor
https://learn.microsoft.com/en-us/windows/win32/menurc/resources-overviews

Windows development | Windows API - Win32
Developer technologies | C++
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. WhTurner 1,611 Reputation points
    2020-12-10T18:08:40.843+00:00

    As this is not a question about the Small Basic language, you shoukd remove the small-basic-featured-program tag from this topic.
    l

    1 person found this answer helpful.

  2. Castorix31 90,681 Reputation points
    2020-12-10T18:20:50.557+00:00

    A .c file is a Text file : you cannot embed an icon inside
    A .lnk file is a Binary file and the icon location is embedded in a structure (StringData)

    1 person found this answer helpful.

  3. Drake Wu - MSFT 996 Reputation points
    2020-12-14T05:59:11.793+00:00

    Hi, @BoQsc You cannot embed an icon inside in side the .c file.
    For the .lnk link files, the properties page usually use SetIconLocation to change icon, the link file does not own the icon itself but refers to the icon whose index is iIcon in the pszIconPath file. Can you share the reason that you want to embed the icon in the C file?


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.