|
Are you including afxmt.h ? Have you read this?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I recently encountered this ambiguous symbol issue and found a solution. Posting here in this old thread for reference.
I had the same issue in a project where I needed to include both <afxmt.h> and <atlsync.h>. They each have a similar set of concurrency classes with the same names -- but for a given class some of the member functions are distinct.
In Visual Studio 2022 build 17.4.3 with the latest Windows 10 SDK (and perhaps in older IDEs and SDKs), you can reference classes from both of these headers without ambiguity, so long as you:
1) Include afxmt.h BEFORE including atlsync.h , e.g.
#include <afxmt.h>
#include <atlsync.h>
2) Do NOT specify using namespace ATL
3) To reference a class in atlsync.h , preface the class name with ATL:: , e.g. ATL::CEvent or ATL::CSemaphore . If you do not add this ATL:: namespace preface, the class will be referenced from afxmt.h .
|
|
|
|
|
|
I get a lot of Compile time errors (C2872)
CCriticalSection Ambiguous Symbol.
I can not remove CCriticalSection Class.
|
|
|
|
|
My English not well, please take care of.
thanks you!!!!!!
|
|
|
|
|
I'll take care of that and you're free to go now. THANKS.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Welcome again in the CP's Memorable Quotes list. [^]
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
I have downloaded an app from the below link and using it, it works fine.
Neat Tooltip for ComboBox[^]
I create a new MFC dialog based application in VS2008, and add 2 files from the prev project to this new project, the tool tip functionality does not work.
I guess the issue is with the target OS for compilation.
In VS2008, the target compilation is Vista, 0x0600. - the tool tips dont work.
In the prev project the target compilation is 0x0500. - the tool tips work here.
In my new project, if i change explicitly the target OS to 0x0500, the tool tips work.
I dont know what is the problem.
Any help will be great. I am using IE 7.
Thanks,
Saleem
modified on Monday, May 25, 2009 9:06 AM
|
|
|
|
|
There is a bug in the source code of the article. The author is incorrectly retrieving the NONCLIENTMETRICS Structure[^] lfStatusFont member.
The code in the constructor:
CTTComboBox::CTTComboBox()
{
NONCLIENTMETRICS ncm;
ncm.cbSize = sizeof(NONCLIENTMETRICS);
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
if (m_font.m_hObject == NULL)
m_font.CreateFontIndirect(&ncm.lfStatusFont);
.....
}
should be changed to be changed to:
CTTComboBox::CTTComboBox()
{
NONCLIENTMETRICS ncm = {0};
ncm.cbSize = sizeof(NONCLIENTMETRICS);
SystemParametersInfo(SPI_GETNONCLIENTMETRICS,sizeof(NONCLIENTMETRICS), &ncm, 0);
if (m_font.m_hObject == NULL)
m_font.CreateFontIndirect(&ncm.lfStatusFont);
or perhaps...
CTTComboBox::CTTComboBox()
{
NONCLIENTMETRICS ncm = {0};
ncm.cbSize = sizeof(NONCLIENTMETRICS);
SystemParametersInfo(SPI_GETICONTITLELOGFONT,0,&ncm.lfStatusFont,0);
if (m_font.m_hObject == NULL)
m_font.CreateFontIndirect(&ncm.lfStatusFont);
...
Best Wishes,
-David Delaune
modified on Monday, May 25, 2009 4:55 PM
|
|
|
|
|
Hi David,
Thanks for the inputs, this works.
On secound thoughts I was wondering, can we do this ?
ncm.cbSize = sizeof(LOGFONT);
Will this be more correct?
Also, why was the previous code working in the XP targetted OS, but not in Vista targetted OS?
Thanks,
Saleem
|
|
|
|
|
Md Saleem Navalur wrote:
Will this be more correct?
You failed to mention which of my recommendations you decided to use.
If you are using the SPI_GETNONCLIENTMETRICS action then set both the cbSize member and the uiParam function parameter to sizeof(NONCLIENTMETRICS)
If you are using the SPI_GETICONTITLELOGFONT action uiParam function parameter specifies the size of a LOGFONT structure.
Md Saleem Navalur wrote:
Also, why was the previous code working in the XP targetted OS, but not in Vista targetted OS?
Apparently when WINVER is <= 0x0500 SystemParametersInfo does not check the size of the buffer you pass in the uiParam parameter.
Best Wishes,
-David Delaune
|
|
|
|
|
Hi, I need to know how can i select all rows in a list control .So can you help me ?
|
|
|
|
|
SetItemState( -1, LVIS_SELECTED , LVIS_SELECTED );
|
|
|
|
|
thank you for your help brother 
|
|
|
|
|
During long search operation in MFC applicaton how to add animation CWaitCursor
|
|
|
|
|
Everything is clearly explained (with an example and everything) in the documentation[^]. Basically, you just create an instance of the class at the begining of your lenghty function and it will be destroyed when the function exits.
|
|
|
|
|
Yes true, But I dont want the normal hour glass, but instead I need some other animation, so...
|
|
|
|
|
ptr_Electron wrote: Yes true, But I dont want the normal hour glass, but instead I need some other animation, so...
If you've globally set an animated wait cursor then I guess that will be displayed instead of the hour glass. Also you can try LoadCursorFromFile .
|
|
|
|
|
Can you respond to the WM_SETCURSOR message?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I wrote this code in the button click event, but no change in the run time
I get normal pointer cursor. please advice, I want to display animated cursor.
HCURSOR hcur;
hcur = ::LoadCursorFromFile((LPCWSTR)"C:\\eglobe.ani");
::SetSystemCursor(hcur,OCR_NORMAL);
when I add watch for "hcur" it is null and unused
modified on Tuesday, May 26, 2009 5:36 AM
|
|
|
|
|
Does hcur have global scope?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
after choosing and closing the Font Dialog in an SDI appliction, the last choosen Fon must be saved via WriteProfileString() and by the next call
it should be loaded sot that the Font is automatically selected via GetProfileString().
I have the following code:
CString strFaceName;
CString strFontSize;
CString strFontStyle;
CString strFontValue;
CFont *m_cfont = (CFont*) new CFont();
LOGFONTA *m_lf = new LOGFONTA();
int m_nFontSize = 0;
CWinApp* pApp = AfxGetApp();
m_cfdlg.GetCurrentFont(m_lf);
strFaceName = m_cfdlg.GetFaceName();
m_nFontSize = m_cfdlg.GetSize() ;
m_cfont->CreateFont(m_nFontSize, m_lf->lfWidth,m_lf->lfEscapement,m_lf->lfOrientation,
m_lf->lfWeight,m_lf->lfItalic,false,0,1,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH | FF_SWISS,strFaceName);
itoa(m_nFontSize,(char*)strFontSize.GetString (),10);
pApp->WriteProfileString(strFaceName, strFontSize, strFontStyle);
strFontValue = pApp->GetProfileString(strFaceName, strFontSize, strFontStyle);
as i know WriteProfileString, write in the registry, but this code needs something more to work properly?
|
|
|
|
|
you could look at this - Im sure he has a save method in his CFontHelper class ...
CFontHelper[^]
'g'
|
|
|
|
|
how to save any file
Trioum
modified on Friday, June 12, 2009 2:26 AM
|
|
|
|
|
Please elaborate.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|