Ton Plomp Posted August 28, 2010 Report Share Posted August 28, 2010 Does anybody know if it's possible to change the icon (taskbar/titlebar) of a singel window? I'm looking for a solution that might be windows only! Win32 is accepted as well. Ton 1 Quote Link to comment
Black Pearl Posted August 29, 2010 Report Share Posted August 29, 2010 Just a 'hack' idea: make the window it's own exe with the icon1, then call this exe from the main (icon2). Felix Quote Link to comment
Ton Plomp Posted August 29, 2010 Author Report Share Posted August 29, 2010 Just a 'hack' idea: make the window it's own exe with the icon1, then call this exe from the main (icon2). Felix No i'm not really looking for a hack, I just want change the icon of one dialog window. Here's the code I currently have which doesn't work: It seems like the LoadImage works properly, but when I run it I can see that alt-tab the default labview icon is removed but not replace by the icon I want., but I cannot get it back. SetWindowIcon.vi (LabVIEW 2009), you should be able to run the code wit any bitmap file. Ton Quote Link to comment
ShaunR Posted August 30, 2010 Report Share Posted August 30, 2010 Change the "uType " to "1" (icon) instead of "0" (bitmap) and load an ".ico" file. 1 Quote Link to comment
Ton Plomp Posted August 30, 2010 Author Report Share Posted August 30, 2010 Change the "uType " to "1" (icon) instead of "0" (bitmap) and load an ".ico" file. Yes that definitly works! Thanks for correcting me. Now comes the bonus question: Mac Linux Ton Quote Link to comment
ShaunR Posted August 30, 2010 Report Share Posted August 30, 2010 (edited) Yes that definitly works! Thanks for correcting me. Now comes the bonus question: Mac Linux Ton Buy me a MAC and LabView for MAC and Linux and I'll tell you BTW. No problems changing the icon back again? Edited August 30, 2010 by ShaunR Quote Link to comment
Ton Plomp Posted August 30, 2010 Author Report Share Posted August 30, 2010 BTW. No problems changing the icon back again? No, the WM_Seticon returns a handle with the old icon. You can drop this VI: SetWindowIcon.vi To set or Reset the icon of a front panel vi! Here's some little demo code: That sets and resets the icon of a FP window. Note that if you don't reset the icon it will be in memory until the FP window is closed. Can anybody tell me how the code runs on: LabVIEW 32 on Windows64-bit LabVIEW 64 on Windows64-bit EDIT: Fixed VI to manage multiple windows Ton Quote Link to comment
ShaunR Posted August 30, 2010 Report Share Posted August 30, 2010 No, the WM_Seticon returns a handle with the old icon. You can drop this VI: To set or Reset the icon of a front panel vi! Here's some little demo code: That sets and resets the icon of a FP window. Note that if you don't reset the icon it will be in memory until the FP window is closed. Can anybody tell me how the code runs on: LabVIEW 32 on Windows64-bit LabVIEW 64 on Windows64-bit Ton Works fine on both x64 an x32 using Win7 and Vista ( once I'd replaced all the ogk stuff ) Quote Link to comment
Rolf Kalbermatter Posted September 7, 2010 Report Share Posted September 7, 2010 Yes that definitly works! Thanks for correcting me. Now comes the bonus question: Mac Linux Can't really help you with that (well I could theoretically but don't have enough time currently to spend on these things). But if you want to go multiplatform you definitely want to write external code in form of a shared library. Maintaining such platform specific code in the diagram is a major pita. So I guess DLL/shared library it is going to be . Also additional bonus points/troubles for making the that code NOT depend on platform specific icon resources . Quote Link to comment
CT2DAC Posted February 6, 2023 Report Share Posted February 6, 2023 Oooold thread, but maybe someone will answer. I'd like to change the icon but NOT from an .ico file, i'd prefer to have a LabView image constant. I tried to find some .net to create an image from an array instead of "from file" but I got lost and cannot find anything when selecting on LV .net constructor.... Quote Link to comment
hooovahh Posted February 6, 2023 Report Share Posted February 6, 2023 The problem with this idea, is that the ico file contains multiple images in it, at different resolutions. You could in theory, take the LabVIEW image constant, save it to a temporary PNG file, then use that path to set the icon. But I think you'd be better off with an ico file itself. You can embed the ico file in the VI as a string constant, and do the same thing, saving it to a temporary location as well. Quote Link to comment
ShaunR Posted February 6, 2023 Report Share Posted February 6, 2023 31 minutes ago, hooovahh said: The problem with this idea, is that the ico file contains multiple images in it, at different resolutions. You could in theory, take the LabVIEW image constant, save it to a temporary PNG file, then use that path to set the icon. But I think you'd be better off with an ico file itself. You can embed the ico file in the VI as a string constant, and do the same thing, saving it to a temporary location as well. You can create an icon on-the-fly using CreateIconIndirect. I have never found the need but, in theory, you could convert an image into the bitmap masks required for an icon. You could then use the WM_SetIcon as previously. Quote Link to comment
CT2DAC Posted February 8, 2023 Report Share Posted February 8, 2023 On 2/6/2023 at 3:00 PM, hooovahh said: You can embed the ico file in the VI as a string constant, and do the same thing, saving it to a temporary location as well. This is quick and easy, it is certainly worth a try. Thanks. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.