01-18-2024 08:36 AM
How to change the icon of the software executable file dynamically/programmatically through Labview
E.g.: When it's Christmas time the software searches the files for the Christmas icon, when the Christmas period passes the software goes back to using the original icon.
01-18-2024 08:45 AM - edited 01-18-2024 08:48 AM
Hi leandro,
@leandrofeder wrote:
How to change the icon of the software executable file dynamically/programmatically through Labview
E.g.: When it's Christmas time the software searches the files for the Christmas icon, when the Christmas period passes the software goes back to using the original icon.
The icon is usually embedded into the executable file. This file is locked as long as the executable is running, so the executable cannot change its own file on disk…
When it comes to taskbar items in Windows: there are functions in Windows to manipulate those taskbar items!
Why do you need this? It provides a very bad UX when the icon of an exe changes on its own…
01-19-2024 09:37 PM
Are you asking "Can I use LabVIEW to design "malware"? That's really not the purpose of a Laboratory Virtual Instrument Engineering Workbench.
Bob Schor
01-21-2024 02:02 AM - edited 01-21-2024 02:07 AM
In Windows you can do this with the Win32 function SendMessage and send a WM_SETICON message to the window. See attached example (it doesn't look like my code, but it shows the details). Edit: note that this changes the icon of a window, not all the windows in a process. I don't know if there's a way to do that dynamically.
As for reasons to do this, it can occasionally be useful. For instance, I have a background process running in LV which changes the icons of the windows, so that FP and BD windows look different and each project gets a different border color. That way, if I have multiple projects opened in parallel, it's easier to see which project each VI is loaded in.
For illustration, here's what it looks like right now with 3 projects open:
01-21-2024 09:57 AM
Changing icons can also be useful to alert the user to a change, like hard drive or network activity.
01-21-2024 07:44 PM
@billko wrote:
Changing icons can also be useful to alert the user to a change, like hard drive or network activity.
Forgive me, but I don't really see (or possibly don't understand) the "use case". When running an Executable, the PC screen normally displays the Top Level VI's Front Panel, to which the User is paying attention, and is an excellent place to show a Boolean control (flashing, perhaps) for hard drive or network activity. You might want to know about these things before you run your Main routine, but, again, it seems much simpler to have a little VI that runs "stand-alone" and monitors whatever you need before you run your Main routine to report the PC's status.
Bob Schor
P.S. -- I'm not sure I completely understood the example that @tst posted. Is he running several iterations of LabVIEW, each working with a different VI or Project? [I do recall running two LabVIEW versions simultaneously many years ago, but I've recently turned to dual-monitors and running a VM (on Monitor 2) when I needed to "see" and "work with" two LabVIEW's at the same time.]
01-21-2024 08:53 PM
@Bob_Schor wrote:
@billko wrote:
Changing icons can also be useful to alert the user to a change, like hard drive or network activity.
Forgive me, but I don't really see (or possibly don't understand) the "use case". When running an Executable, the PC screen normally displays the Top Level VI's Front Panel, to which the User is paying attention, and is an excellent place to show a Boolean control (flashing, perhaps) for hard drive or network activity. You might want to know about these things before you run your Main routine, but, again, it seems much simpler to have a little VI that runs "stand-alone" and monitors whatever you need before you run your Main routine to report the PC's status.
Bob Schor
P.S. -- I'm not sure I completely understood the example that @tst posted. Is he running several iterations of LabVIEW, each working with a different VI or Project? [I do recall running two LabVIEW versions simultaneously many years ago, but I've recently turned to dual-monitors and running a VM (on Monitor 2) when I needed to "see" and "work with" two LabVIEW's at the same time.]
For some reason or other, I was thinking about task bar icons.
01-22-2024 04:54 AM - edited 01-22-2024 05:00 AM
@Bob_Schor wrote:
P.S. -- I'm not sure I completely understood the example that @tst posted. Is he running several iterations of LabVIEW, each working with a different VI or Project?
It's one copy of LV (I just showed the list of open windows by hovering over the taskbar), but it often happens that I open multiple projects in parallel (for example, if there are different projects which go together or if I need to help a client with another project), so I have a daemon (launched automatically when LV loads) which modifies the window icons to look different for FP and BD windows and to have a different border for VIs which are open in different projects.
Even if I had a separate VM for each project (which I don't, in my case they're generally separate by LV version, hardware, etc.), this would still be useful for the cases where there are multiple projects which go together and even if I didn't have that, it's useful just for seeing which windows are for FPs and which for BDs.
Edit: maybe this will help:
Note the two last windows, which have a black border, because they're opened in project 2. This can help avoid confusion, especially if there are VIs with similar names.
01-22-2024 01:48 PM
It's not malware kkkkkkk
I just wonder if there was any way to dynamically change it to commemorative dates (Christmas, Easter, etc)
Thanks for the comments