|
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.
|
|
|
|
|
Navin wrote:
Yes, my way would be more "standard", but yours is prettier.
Thanks
(-_-)
|
|
|
|
|
Like Navin, your struct compiles fine in my code. I think if you follow his advice you'll find the source of your problem.
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.
|
|
|
|
|
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
(-_-)
|
|
|
|
|
Again some newbie-problems
I want to use the AVIFile API in my c++ project. Including the "Vfw.h" header file is not a problem, the various datatypes such as PAVIFILE can be used.
But when the project tries to link to the windows dll (mswfv32.dll), the linker says:
Linking...
AviKaka.obj : error LNK2001: unresolved external symbol _AVIFileInit@0
AviKaka.obj : error LNK2001: unresolved external symbol _AVIFileExit@0
Debug/MultiKaka.exe : fatal error LNK1120: 2 unresolved externals
I've already tried to add the dll manualy in project->settings->debug->additional_dlls
So, I guess this is probably a how-to-call-a-dll-topic
Inluding the headerfile is not enough
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
Are you sure that the definition and prototype of _AVIFileInit is the same?
|
|
|
|
|
Yep, source found on msdn library.
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
There are two ways to use a DLL:
1) static use
You need a header-file and a lib-file added to your project. Than you can directly call the functions declared in the header file.
(Due to the linker errors it seems the lib-file is missing in your project, adding only the dll won`t work)
2) dynamic use
You only need the dll-file. From your source you load the dll by calling LoadLibrary() and get the function pointers by calling GetProcAdress().
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
------------------------------------
|
|
|
|