LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Change the icon of the software executable file dynamically/programmatically through Labview

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.

0 Kudos
Message 1 of 9
(1,022 Views)

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…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(1,019 Views)

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

0 Kudos
Message 3 of 9
(952 Views)

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:

 

LV icons.png


___________________
Try to take over the world!
Message 4 of 9
(918 Views)

Changing icons can also be useful to alert the user to a change, like hard drive or network activity.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 9
(905 Views)

@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.]

0 Kudos
Message 6 of 9
(889 Views)

@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.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 9
(878 Views)

@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:

LV icons2.png

 

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.


___________________
Try to take over the world!
0 Kudos
Message 8 of 9
(857 Views)

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

0 Kudos
Message 9 of 9
(802 Views)