From: Franz Bachler on
Hello,

I've created a program with OpenCV which show a JPG-Image in a Window:

strcpy(szTemp, TEXT("Name of the Window"));
(IplImage*) img = cvLoadImage(szTemp, 1);
cvNamedWindow(szText, 0);
cvShowImage(szText, img);
cvWaitKey(0);
cvDestroyWindow(szText);

The Window has only a standard "Empty Window Icon" in the upper left corner.
How can I put my own icon there?

Greetings,
Franz

--
Franz Bachler, A-3250 Wieselburg
E-Mail: fraba (at) gmx.at
Homepage: http://members.aon.at/fraba
oder http://home.pages.at/fraba


From: Snorik on
On 5 Nov., 17:35, "Franz Bachler" <fraba.nos...(a)gmx.at> wrote:
> Hello,
>
> I've created a program with OpenCV which show a JPG-Image in a Window:
>
> strcpy(szTemp, TEXT("Name of the Window"));
> (IplImage*) img = cvLoadImage(szTemp, 1);
> cvNamedWindow(szText, 0);
> cvShowImage(szText, img);
> cvWaitKey(0);
> cvDestroyWindow(szText);
>
> The Window has only a standard "Empty Window Icon" in the upper left corner.
> How can I put my own icon there?
>

Dont you need an actual icon in 16x16 px for that?
From: Franz Bachler on
>> The Window has only a standard "Empty Window Icon" in the upper left
>> corner.
>> How can I put my own icon there?
> Dont you need an actual icon in 16x16 px for that?

Yes. To add an icon in a dialogbox this works
- but not with the OpenCV-Window

SetClassLong( hWnd, GCL_HICON,
(LONG) LoadIcon( GetModuleHandle(NULL),
MAKEINTRESOURCE(ICO_NAMEICON) ) );

The HWND-Handle from the OpenCV-Window is from

hWnd=(HWND) cvGetWindowHandle(szNameofWindow);

Greetings,
Franz


From: Leslie Milburn on

"Franz Bachler" <fraba.nospam(a)gmx.at> wrote in message
news:4af326d4$0$1550$91cee783(a)newsreader03.highway.telekom.at...
>>> The Window has only a standard "Empty Window Icon" in the upper left
>>> corner.
>>> How can I put my own icon there?
>> Dont you need an actual icon in 16x16 px for that?
>
> Yes. To add an icon in a dialogbox this works
> - but not with the OpenCV-Window
>
> SetClassLong( hWnd, GCL_HICON,
> (LONG) LoadIcon( GetModuleHandle(NULL),
> MAKEINTRESOURCE(ICO_NAMEICON) ) );
>
> The HWND-Handle from the OpenCV-Window is from
>
> hWnd=(HWND) cvGetWindowHandle(szNameofWindow);
>
> Greetings,
> Franz


Use WM_SETICON message
hth
Leslie.


From: Franz Bachler on
>> SetClassLong( hWnd, GCL_HICON,
>> (LONG) LoadIcon( GetModuleHandle(NULL),
>> MAKEINTRESOURCE(ICO_NAMEICON) ) );
>>
>> The HWND-Handle from the OpenCV-Window is from
>>
>> hWnd=(HWND) cvGetWindowHandle(szNameofWindow);
>
> Use WM_SETICON message
> hth
> Leslie.

Hello,
sorry but

SendMessage(hWnd, WM_SETICON, (WPARAM) FALSE,
(LONG) LoadIcon(GetModuleHandle(NULL),
MAKEINTRESOURCE(ICO_NAME)));

doesn't work.

Greetings,
Franz