LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Can you specify an icon for a CVI panel contained in a DLL?

I have a CVI DLL that loads and displays panels from a UIR file at runtime.

Currently, when the DLL is called from a VB program, the panel's icon in the
window title bat defaults to the Visual Basic application icon.

Is there a way to specify a particular icon for the panel so the panel
doesn't use the default icon? I know how to assign an icon to an EXE in
CVI, but I can't find out how to specify an icon for a panel.

Thanks,

Bob Rafuse
Etec, Inc.
0 Kudos
Message 1 of 3
(3,394 Views)
Hi Bob,

I went to http:msdn.microsoft.com to look for an answer to your question since I have not found a way to accomplish what you want using only CVI.

By searching for "icon" "window" "sdk" I was able to find an article about Class Icons. At the end is this quote:
"You can override the large or small class icon for a particular window by using the WM_SETICON message. You can retrieve the current large or small class icon by using the WM_GETICON message."

Unless we can find a way to set the icon using CVI, you will need to use Windows SDK calls to accomplish the change.

I hope the WM_SETICON reference works for you.

Regards,

John N
Applications Engineer
National Instruments
0 Kudos
Message 2 of 3
(3,394 Views)
I programmatically change the window icon using this function:

void Change_program_icon(char* icon_path)
{
int window;
HANDLE handle_icon;

handle_icon = LoadImage(0, icon_path, IMAGE_ICON, 0, 0, LR_LOADFROMFILE);
GetPanelAttribute (panelHandle, ATTR_SYSTEM_WINDOW_HANDLE, &window);
SendMessage((HWND)window, WM_SETICON, ICON_SMALL, (LPARAM)handle_icon);
}

and passing to it a string containing the full path of the icon ("C:\\images\\icon.ico" for example)
0 Kudos
Message 3 of 3
(3,394 Views)