Why I love Windows programming
-
Yesterday I was putting finishing touches on updating my System Scanner (a little advertisment will never hurt :p) app and added a new icon resource to it. Suddenly my app icon has changed to this newly added resource. I haven't changed a thing except using Insert resouce in Resource editor. ID was IDR_ICON1. I tried looking everywhere with no result. App icon was still the one in IDR_ICON1, not IDR_MAINFRAME. I added a new icon resource (IDR_ICON2) and nothing changed. App icon was still IDR_ICON1. So I deleted IDR_ICON2 and closed VS in frustration. I decided to try and figure what the problem was today, opened VS and found out...that my app icon was IDR_MAINFRAME. I've deleted debug dir, rebuilt the project and it still was IDR_MAINFRAME ! Now could somebody explain me the paranormal nature of this self-appearing and self-dissapearing bug ? NOTE: Not a single line of code, not even a comma was changed manually during icon addition and removal. -------------------------------- Human stupidity is infinite.
-
Yesterday I was putting finishing touches on updating my System Scanner (a little advertisment will never hurt :p) app and added a new icon resource to it. Suddenly my app icon has changed to this newly added resource. I haven't changed a thing except using Insert resouce in Resource editor. ID was IDR_ICON1. I tried looking everywhere with no result. App icon was still the one in IDR_ICON1, not IDR_MAINFRAME. I added a new icon resource (IDR_ICON2) and nothing changed. App icon was still IDR_ICON1. So I deleted IDR_ICON2 and closed VS in frustration. I decided to try and figure what the problem was today, opened VS and found out...that my app icon was IDR_MAINFRAME. I've deleted debug dir, rebuilt the project and it still was IDR_MAINFRAME ! Now could somebody explain me the paranormal nature of this self-appearing and self-dissapearing bug ? NOTE: Not a single line of code, not even a comma was changed manually during icon addition and removal. -------------------------------- Human stupidity is infinite.
If you don't explicitly do a SetIcon, I believe that the first icon resource in the app will be used as its icon. In your case, perhaps what happened is that, when you added IDR_ICON1, VS made that the first icon, and later when you added and deleted IDR_ICON2, it rebuilt the resource section putting IDR_MAINFRAME as the first icon.
-
Yesterday I was putting finishing touches on updating my System Scanner (a little advertisment will never hurt :p) app and added a new icon resource to it. Suddenly my app icon has changed to this newly added resource. I haven't changed a thing except using Insert resouce in Resource editor. ID was IDR_ICON1. I tried looking everywhere with no result. App icon was still the one in IDR_ICON1, not IDR_MAINFRAME. I added a new icon resource (IDR_ICON2) and nothing changed. App icon was still IDR_ICON1. So I deleted IDR_ICON2 and closed VS in frustration. I decided to try and figure what the problem was today, opened VS and found out...that my app icon was IDR_MAINFRAME. I've deleted debug dir, rebuilt the project and it still was IDR_MAINFRAME ! Now could somebody explain me the paranormal nature of this self-appearing and self-dissapearing bug ? NOTE: Not a single line of code, not even a comma was changed manually during icon addition and removal. -------------------------------- Human stupidity is infinite.
Always be careful when you add icon resources to a Windows executable, as by default the one with the lowest ID will be used for the app icon. Also remember that resource.h is marked as having "NO DEPENDENCIES". As a result, changing resources will not necessarily cause dependent files to be rebuilt, which can leave your build in an unpredictable state if you've been moving IDs around. For safety, always do a full rebuild after mucking about with resources. :rose: Anna :rose: Currently working mostly on: Visual Lint :cool: Anna's Place | Tears and Laughter "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work.
-
If you don't explicitly do a SetIcon, I believe that the first icon resource in the app will be used as its icon. In your case, perhaps what happened is that, when you added IDR_ICON1, VS made that the first icon, and later when you added and deleted IDR_ICON2, it rebuilt the resource section putting IDR_MAINFRAME as the first icon.
IDR_MAINFRAME is defined as 5 and I don't remember anything defined as 1-4 -------------------------------- Human stupidity is infinite.
-
Yesterday I was putting finishing touches on updating my System Scanner (a little advertisment will never hurt :p) app and added a new icon resource to it. Suddenly my app icon has changed to this newly added resource. I haven't changed a thing except using Insert resouce in Resource editor. ID was IDR_ICON1. I tried looking everywhere with no result. App icon was still the one in IDR_ICON1, not IDR_MAINFRAME. I added a new icon resource (IDR_ICON2) and nothing changed. App icon was still IDR_ICON1. So I deleted IDR_ICON2 and closed VS in frustration. I decided to try and figure what the problem was today, opened VS and found out...that my app icon was IDR_MAINFRAME. I've deleted debug dir, rebuilt the project and it still was IDR_MAINFRAME ! Now could somebody explain me the paranormal nature of this self-appearing and self-dissapearing bug ? NOTE: Not a single line of code, not even a comma was changed manually during icon addition and removal. -------------------------------- Human stupidity is infinite.
What is the app icon? the one displayed on the main window? or the first icon which is displayed in Explorer and Start Menu? If you are talking about the Explorer icon, I'm not sure I think that the first icon specified in the resource file is the one taken by Explorer (first index.) So you might want to check the order of the icons in the .RC file. -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
-
Always be careful when you add icon resources to a Windows executable, as by default the one with the lowest ID will be used for the app icon. Also remember that resource.h is marked as having "NO DEPENDENCIES". As a result, changing resources will not necessarily cause dependent files to be rebuilt, which can leave your build in an unpredictable state if you've been moving IDs around. For safety, always do a full rebuild after mucking about with resources. :rose: Anna :rose: Currently working mostly on: Visual Lint :cool: Anna's Place | Tears and Laughter "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work.
Anna-Jayne Metcalfe wrote:
Also remember that resource.h is marked as having "NO DEPENDENCIES". As a result, changing resources will not necessarily cause dependent files to be rebuilt, which can leave your build in an unpredictable state if you've been moving IDs around.
so that's the freaking reason why I always have to rebuild everything when modifying the resource.h file ! Is here a way ( in vs.net 2003 ) to change that behaviour ?
Maximilien Lincourt Your Head A Splode - Strong Bad
-
What is the app icon? the one displayed on the main window? or the first icon which is displayed in Explorer and Start Menu? If you are talking about the Explorer icon, I'm not sure I think that the first icon specified in the resource file is the one taken by Explorer (first index.) So you might want to check the order of the icons in the .RC file. -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
The one in the Explorer. And as I said IDR_MAINFRAME = 5 and I really don't remember anything defining itself as 1,2,3 or 4. But thank's for the heads up anyway. I didn't know that app icon should be the first one in resources. -------------------------------- Human stupidity is infinite.
-
IDR_MAINFRAME is defined as 5 and I don't remember anything defined as 1-4 -------------------------------- Human stupidity is infinite.
I thought it was 128... ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
-
Always be careful when you add icon resources to a Windows executable, as by default the one with the lowest ID will be used for the app icon. Also remember that resource.h is marked as having "NO DEPENDENCIES". As a result, changing resources will not necessarily cause dependent files to be rebuilt, which can leave your build in an unpredictable state if you've been moving IDs around. For safety, always do a full rebuild after mucking about with resources. :rose: Anna :rose: Currently working mostly on: Visual Lint :cool: Anna's Place | Tears and Laughter "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work.
Anna-Jayne Metcalfe wrote:
Also remember that resource.h is marked as having "NO DEPENDENCIES".
Are you quite sure about that, as this has never given me a problem in the past, and I certainly never perform a full rebuild after changing resource.h. If I did, I would be wasting a great deal of time indeed - some of my projects take a long time to build! I just opened my most recent project (which is very resource heavy) in Visual Studio 2003 and resource.h is not marked with any special compiler flags. Hence, if it changes, then surely everything should build correctly?
The Rob Blog
Google Talk: robert.caldecott -
Anna-Jayne Metcalfe wrote:
Also remember that resource.h is marked as having "NO DEPENDENCIES".
Are you quite sure about that, as this has never given me a problem in the past, and I certainly never perform a full rebuild after changing resource.h. If I did, I would be wasting a great deal of time indeed - some of my projects take a long time to build! I just opened my most recent project (which is very resource heavy) in Visual Studio 2003 and resource.h is not marked with any special compiler flags. Hence, if it changes, then surely everything should build correctly?
The Rob Blog
Google Talk: robert.caldecottYes, that fact is quite true. Try compiling a project, than change something in resource.h and compile again. It won't actually start compiling but execute already compiled app. I hope all above made any sense :P -------------------------------- Human stupidity is infinite.
-
Yes, that fact is quite true. Try compiling a project, than change something in resource.h and compile again. It won't actually start compiling but execute already compiled app. I hope all above made any sense :P -------------------------------- Human stupidity is infinite.
Woah. So it does. I stand corrected! That's mad... I am amazed this has never bitten me on the backside before. So what does the resource editor to differently, as if you add/edit resources using the visual editor, then the project builds correctly...
The Rob Blog
Google Talk: robert.caldecott -
Anna-Jayne Metcalfe wrote:
Also remember that resource.h is marked as having "NO DEPENDENCIES". As a result, changing resources will not necessarily cause dependent files to be rebuilt, which can leave your build in an unpredictable state if you've been moving IDs around.
so that's the freaking reason why I always have to rebuild everything when modifying the resource.h file ! Is here a way ( in vs.net 2003 ) to change that behaviour ?
Maximilien Lincourt Your Head A Splode - Strong Bad
I have just been looking at this, and the MSDN says: "Visual C++ always adds the //{{NO_DEPENDENCIES}} comment line to a .RC file when it saves the file. In some cases, circumventing of the build dependency on RESOURCE.H may lead to run-time errors undetected at link time. For example, if you use the Symbol Browser to change the numeric value assigned to a symbol for a resource, the resource will not be correctly found and loaded at application run-time if the .CPP file referring to the resource is not recompiled. In such cases, you should explicitly recompile any .CPP files that you know are affected by the symbol changes in RESOURCE.H or select Rebuild All. If you have the need to frequently change symbol values for a certain group of resources, you will probably find it more convenient and safer to break out these symbols into a separate read-only header file, as described in the above section Including Additional Header Files."
The Rob Blog
Google Talk: robert.caldecott -
Yesterday I was putting finishing touches on updating my System Scanner (a little advertisment will never hurt :p) app and added a new icon resource to it. Suddenly my app icon has changed to this newly added resource. I haven't changed a thing except using Insert resouce in Resource editor. ID was IDR_ICON1. I tried looking everywhere with no result. App icon was still the one in IDR_ICON1, not IDR_MAINFRAME. I added a new icon resource (IDR_ICON2) and nothing changed. App icon was still IDR_ICON1. So I deleted IDR_ICON2 and closed VS in frustration. I decided to try and figure what the problem was today, opened VS and found out...that my app icon was IDR_MAINFRAME. I've deleted debug dir, rebuilt the project and it still was IDR_MAINFRAME ! Now could somebody explain me the paranormal nature of this self-appearing and self-dissapearing bug ? NOTE: Not a single line of code, not even a comma was changed manually during icon addition and removal. -------------------------------- Human stupidity is infinite.
What version of VS were you using? I know VS6 stores resources in a database (*.ncb/ *.aps/*.opt or one of those) Sometimes the version in the database will replace the resource file... (i've had that happen many a time) If you delete your ncb and others, as well as delete your debug folder, then it will have to rebuild the db and will load the info from the referenced files... ~Nitron.
ññòòïðïðB A
start -
I thought it was 128... ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
I've set it to 5 for some reason some time ago. Probably something else was defined as 5 and I wanted my icon on top of the list :) -------------------------------- Human stupidity is infinite.
-
What version of VS were you using? I know VS6 stores resources in a database (*.ncb/ *.aps/*.opt or one of those) Sometimes the version in the database will replace the resource file... (i've had that happen many a time) If you delete your ncb and others, as well as delete your debug folder, then it will have to rebuild the db and will load the info from the referenced files... ~Nitron.
ññòòïðïðB A
startI'm using 7.1 I'm guessing this was some wild bug which probably involved redefining my resources. -------------------------------- Human stupidity is infinite.
-
Woah. So it does. I stand corrected! That's mad... I am amazed this has never bitten me on the backside before. So what does the resource editor to differently, as if you add/edit resources using the visual editor, then the project builds correctly...
The Rob Blog
Google Talk: robert.caldecottCrazy isn't it? I think they've done it that way because AppWizard generated apps effectively include resource.h in every file - so every time you added a control to a dialog (for example) it would spark a full rebuild. The resource editor gets away with it only because most of the time when editing resources you are also working on the corresponding code. That code gets recompiled because its been modified, not because of the resource ID change. For instant fun (not!), swap around the IDs of the dialog templates in your app and do an incremental build. Then run it.... Anna :rose: Currently working mostly on: Visual Lint :cool: Anna's Place | Tears and Laughter "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work.