|
While I disagree with your UI decision (it definitely goes against what users are accustomed to), you can do this by handling the OnCtlColor message. There's a few threads here about how to do that. Just search on that function name and you should find what you need.
Cheers,
Tom Archer
Author, Inside C#
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the affairs of others.
|
|
|
|
|
I believe the reference you will find helpful is by Chris Losinger, Colorizing Edit Control at CodeProject.com
This may or may not be exactly the one, but I have a ZIP that I downloaded named "ColorEdit_ColorStatic".
It tells how to change colors of foreground text and background for both edit controls and static controls (e.g. labels.)
Good luck. These helped me bring my dialogs to life!
Johnny
|
|
|
|
|
anybody have any sample c/c++/asm code to read sectors from a cd, or know where i can find an example ?
|
|
|
|
|
Try loading wnaspi32.dll and use that to send commands to the cd-rom. Or just look up documentation on the ASPI layer.
No School
No Job
No Problem
|
|
|
|
|
Hey everybody.
You know how in Windows Display Properties Appearance you can change the colors and fonts for many system items like menus, 3DObjects, etc. You can obtain the color settings using GetSysColor(), but I was just wondering if anybody out there knew how to obtain the font settings for the items? Particularly the Message Box.
I've searched through Code Project and MS Knowledge Base but didn't find anything (probably not using the right keywords or something).
Anyone?
Thanks
|
|
|
|
|
In MFC you shoul dbe able to get a handle to some fonts by using the AUX_DATA structure afxData . It has some fonts in it as HFONT objects. Nit sure if they are the ones you need.
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
I'd prefer a non-mfc approach (sdk). The only 2 fonts I find in that AUX_DATA structure are StatusFont and ToolTipsFont (at least in the version I have).
|
|
|
|
|
Try
SystemParametersInfo( )
Maxwell Chen
No code is good code.
|
|
|
|
|
I've looked at that already, but didn't find anything. Which action value?
|
|
|
|
|
Try this, I tried, and changed some values, and my Windows2K got strange...
void CTestMsgFontDlg::OnButton1()
{
NONCLIENTMETRICS ncmOld, ncmTest;
AfxMessageBox(_T("Test change of font for message boxes."), MB_OK);
ncmOld.cbSize = sizeof(NONCLIENTMETRICS);
if(SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncmOld, 0))
{
memcpy(&ncmTest, &ncmOld, sizeof(NONCLIENTMETRICS));
ncmTest.lfMessageFont.lfUnderline = 1;
AfxMessageBox(_T("Before change of font for message boxes."), MB_OK);
if(SystemParametersInfo(SPI_SETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncmTest, 0))
{
AfxMessageBox(_T("Message box font changed."), MB_OK);
ncmOld.lfMessageFont.lfUnderline = 0;
SystemParametersInfo(SPI_SETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncmOld, 0);
AfxMessageBox(_T("Message box font restored."), MB_OK);
}
}
}
Maxwell Chen
No code is good code.
|
|
|
|
|
Too cool. Thanks. The name of that item is mis-leading. NONCLIENT. I thought it would be the font used for the maximize, minimize, close buttons.
|
|
|
|
|
hi,
i have a dialog based app. i use a context menu when i right click and choose an item for my special purpose. i could not put a check when i choose that item on my context menu even though i have got the ON_UPDATE_COMMAND_UI message handler to update my item state.
What should i do?
isn't it possible to update the state of a context menu item without using a SDI of MDI application(a menu is a must?)
Thanks for ur help,
Atilla Selem
just listening to you...
|
|
|
|
|
For dialog boxes, I dont think the OnCommandUI handler work. Try mapping the WM_INITMENUPOPUP message and enabling/disabling the menu items there.
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
As Roger states you need to handle the WM_INITMENUPOPUP message without the doc/view architecture there to help you. Here's the code to do that (it will also make sure that your commandui handlers are called before the menu appears).
BEGIN_MESSAGE_MAP(CDialogContextMenuDlg, CDialog)
...
ON_WM_INITMENUPOPUP()
END_MESSAGE_MAP()
...
void CYourDlg::OnInitMenuPopup( CMenu* pMenu, UINT index, BOOL )
{
CCmdUI CmdUI;
CmdUI.m_nID = pMenu->GetMenuItemID(index);
CmdUI.m_nIndex = index;
CmdUI.m_nIndexMax = pMenu->GetMenuItemCount();
CmdUI.m_pMenu = pMenu;
CmdUI.DoUpdate(this,FALSE);
}
Cheers,
Tom Archer
Author, Inside C#
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the affairs of others.
|
|
|
|
|
Cool Tom,
I would have done it a slightly different way. Namely handled the calls to enable/check etc myself in the handler. I will have to remember this.
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
No problem. I definitely like this way because it then allows you to use the same command and updateui code that you would use in a normal doc/view class. This handler (InitMenuPopup) then simply routes everything the way it should be.
Cheers,
Tom Archer
Author, Inside C#
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the affairs of others.
|
|
|
|
|
typedef struct _ID3Info
{
char Title[33];
char Artist[33];
char Album[33];
char Year[5];
char Genre;
char Comment[33];
} ID3Info, *pID3Info;
when i define it that way Visual C++ compiler says: "error C2011: '_ID3Info' : 'struct' type redefinition"
what am i doing wrong?
Thanks
|
|
|
|
|
Delete the struct name in the first line :
typedef struct
{
.
.
So far ... RockNix///
------------------------------------
www.klangwerker.de
Need some articles about Threading,
Subclassing, Double Buffering ?
Go for it ...
Look out for free Win32
Serial Communication Module
for VC++ or Borland C++ Builder
Visit us on www.klangwerker.de
------------------------------------
|
|
|
|
|
The name after the struct is a "tag". The posters problem is elsewhere.
Cheers,
Tom Archer
Author, Inside C#
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the affairs of others.
|
|
|
|
|
I think what you wrote is correct. I used to code NI's drivers with many of such struct typedefs.
And 3 minutes ago I copied your struct and pasted onto a console project and a MFC project, both of them compiled without an error!
Maybe you post the entire build log, and we could find out what happened.....
Maxwell Chen
No code is good code.
|
|
|
|
|
Where is the entire build log located?
|
|
|
|
|
You may rebuild all again, and copy the content in the Build tab of the Output window.
Or you may copy what in the .plg file....
Maxwell Chen
No code is good code.
|
|
|
|
|
Anonymous wrote:
when i define it that way Visual C++ compiler says: "error C2011: '_ID3Info' : 'struct' type redefinition"
From the looks of it, it seems that _ID3Info is somehow aready defined. It could be that:
1. You have a struct of that name defined somewhere else
2. Perhaps you don't have "include guards" in the header file that defines the struct, and it is getting pulled in twice. I always do something like this to ensure that #2 does not happen:
#ifndef _whatever_your_h_file_name_happens_to_be_
#define _whatever_your_h_file_name_happens_to_be_
(code of the include file goes here)
#endif
No generalization is 100% true.
Not even this one.
|
|
|
|
|
Navin wrote:
#ifndef _whatever_your_h_file_name_happens_to_be_
#define _whatever_your_h_file_name_happens_to_be_
(code of the include file goes here)
#endif
You could also use:
#pragma once
instead of the above ... however the above woudl be the more standard way of doing things
(-_-)
|
|
|
|
|
Brian Delahunty wrote:
#pragma once
Yes, my way would be more "standard", but yours is prettier.
No generalization is 100% true.
Not even this one.
|
|
|
|