NO

Author Topic: Button style  (Read 6015 times)

jcarr

  • Guest
Button style
« on: July 02, 2007, 02:30:31 AM »
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

  • Guest
Re: Button style
« Reply #1 on: July 02, 2007, 04:08:47 AM »
Never mind.... I got it now.
If you want to know, add a new manifest to ur rc file and insert this code:
Code: [Select]
<?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>

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

  • Guest
Re: Button style
« Reply #2 on: July 03, 2007, 07:24:29 AM »
Is the dialog the apps main window ?

John

jcarr

  • Guest
Re: Button style
« Reply #3 on: July 05, 2007, 11:10:51 AM »
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

  • Guest
Re: Button style
« Reply #4 on: July 05, 2007, 11:45:48 AM »
If the dialog has been created with a class you can specify the icon when the class is registered.

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

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: [Select]
HICON hIcon = LoadIcon(gInst, MAKEINTRESOURCE(1));
SendMessage(hwndDlg, WM_SETICON, (WPARAM)ICON_SMALL, (LPARAM)hIcon);

John