News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

A strange thing happened.

Started by Siekmanski, July 26, 2020, 08:18:07 PM

Previous topic - Next topic

Siekmanski

Setting up a framework and loading a PNG icon and changing it into a CURSOR. ( getting a smaller executable size )
A strange thing happened.

In filemanager and taskmanager the Hand cursor shows up as the file icon???
It should be the Palette icon.

What am I doing wrong here?
Can't figure it out.  :undecided:
Creative coders use backward thinking techniques as a strategy.

daydreamer

I checked many resource files and everything is numbered over 100,so maybe
IDI_APPLICATION constant =100 or some other windows constant already is 100,so second line redefines IDI_APPLICATION to hand icon
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

hutch--

Nah, its just handy but note that some OS functions use resource ID numbers below 100. From memory you can go up to 64k.

Siekmanski

Tried higher resource ID numbers, it didn't solve it.
Creative coders use backward thinking techniques as a strategy.

jj2007

Quote from: Siekmanski on July 26, 2020, 08:18:07 PMIt should be the Palette icon

Your original exe, Win7-64

The mouse pointer is a hand, indeed.

Siekmanski

Yes, it shows up correctly with the Palette icon on the taskbar.
But if you look into file manager or task manager it shows the Hand image as the file icon.
Very strange....
Creative coders use backward thinking techniques as a strategy.

hutch--

Its probably the case that Windows expects the first icon to be an ICO icon and it may just treat a PNG file as another resource rather than the main icon.

daydreamer

What about use loadicon after cursor code part?
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

JK

AFAIK not the first icon in the resource file but the icon with the lowest id in alpha order is shown as an exe´s icon. So in terms of alpha order "100" comes before "IDI_APPLICATION". I would try to rename "100" to maybe "Hand" (HAND ICON "Res\handpointer64.ico")


JK

Siekmanski

Thanks JK.

That did the trick.
Lowest resource ID number is the main Icon.  :thumbsup:
Creative coders use backward thinking techniques as a strategy.

daydreamer

Quote from: Siekmanski on July 27, 2020, 02:52:28 AM
Thanks JK.

That did the trick.
Lowest resource ID number is the main Icon.  :thumbsup:
Maybe that explains why I see vc uses one ID that's -1 to guarantee it's the lowest
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

jj2007

Quote from: Siekmanski on July 27, 2020, 02:52:28 AM
Lowest resource ID number is the main Icon.  :thumbsup:

I can't reproduce this behaviour - this code produces the "Eye" icon :sad:
  mov wc.hIcon, rv(LoadIcon, eax, IDI_APPLICATION)
  mov wc.hIconSm, eax

#include "resource.h"
100 ICON "\\Masm32\\MasmBasic\\icons\\Smiley.ico"
IDI_APPLICATION ICON "\\Masm32\\MasmBasic\\icons\\Eye.ico"
01 RT_MANIFEST "\\Masm32\\MasmBasic\\Res\\XpManifest.xml"

Siekmanski

Hi Magnus,

I tried -1 for the file icon but, that didn't work.
Now I have 1000 and 1001 ( the Hand cursor ) as the resource ID's and it works like a charm.  :eusa_dance:

Hi Jochen,

Set the eye.ico to 99 101 and it probably works.

EDIT: 99 has to be 101
Creative coders use backward thinking techniques as a strategy.

Siekmanski

Another thing,
I created the icons with PNG images.
If I create a PNG cursor, the resource compiler chokes on it. ( only 1 byte is changed -> cursor ID )
That's why I load it as an icon and change it into a cursor in the source code.
Creative coders use backward thinking techniques as a strategy.

jj2007

Quote from: Siekmanski on July 27, 2020, 08:35:00 AMSet the eye.ico to 99 101 and it probably works.

Try putting #include "resource.h" on top of the rc file :cool:

I've tried some varieties with my icons, but IDI_APPLICATION always wins:
#include <\masm32\INCLUDE\RESOURCE.H>
; #include "resource.h"
101 ICON "\\Masm32\\MasmBasic\\icons\\Smiley.ico"
IDI_APPLICATION ICON "\\Masm32\\MasmBasic\\icons\\plot.ico"


Note that the resource compiler does not throw errors if it encounters undefined constants such as IDI_APPLICATION :cool:

Besides, Windows is sometimes confused: If the exe has the smiley in Explorer, when running it may still have the previous icon.