C language > Beginner questions

Button style

(1/1)

jcarr:
Hey...

This is really beginning to fustrate me. I am using WinXP's silver theme...
How do i get my button which looks like this:
http://sigma.ulmb.com/TEMP/BTN_OK_NORMAL.jpg
to look like this:
http://sigma.ulmb.com/TEMP/BTN_OK_XP.jpg

Thanks in advance for any help..

jcarr

jcarr:
Never mind.... I got it now.
If you want to know, add a new manifest to ur rc file and insert this code:

--- Code: ---<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="CompanyName.ProductName.YourApplication"
type="win32"
/>
<description>Program Description here</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
--- End code ---

However I am now having trouble with adding an icon to a dialog made through my rc file.
It just takes on the regular default icon and i want it something different. Thanks ;D

jcarr

JohnF:
Is the dialog the apps main window ?

John

jcarr:
No.. they are a popup of the main app window. i noticed that blank app icon is only there when i use the WS_EX_LAYERED extended style. Then using conventional API to change the dialog does nothing. Is there a way to specify an icon using the *.rc file, as that is what the dialog is created from.

Thanks heaps

jcarr

JohnF:
If the dialog has been created with a class you can specify the icon when the class is registered.

example.

--- Code: ---wc.hIcon = LoadIcon( hinst, MAKEINTRESOURCE( ID_ICON ) );
wc.hbrBackground = (HBRUSH) ( COLOR_BTNFACE + 1 );
wc.lpszClassName = "nameofclass";
RegisterClass( &wc );

--- End code ---

If the dialog has not been created with a class you will have to set the icon manually like so. The best place would be in WM_INITDIALOG in the Dialog Func.


--- Code: ---HICON hIcon = LoadIcon(gInst, MAKEINTRESOURCE(1));
SendMessage(hwndDlg, WM_SETICON, (WPARAM)ICON_SMALL, (LPARAM)hIcon);

--- End code ---

John

Navigation

[0] Message Index

Go to full version