barkhashah
asked on
C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
Hi All,
Can any one please tell me how to know after what inclusion of a file ( "#include ....") following error can come.
Also , how can i undef __windows__ . Actually i am using some apis and macros which need windows.h inclusion and the application is MFC based also. Really dont know how to solve this problem.
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\af xv_w32.h(1 8) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
Thanks
barkha
Can any one please tell me how to know after what inclusion of a file ( "#include ....") following error can come.
Also , how can i undef __windows__ . Actually i am using some apis and macros which need windows.h inclusion and the application is MFC based also. Really dont know how to solve this problem.
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\af
Thanks
barkha
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks santino
Always welcome
Dear All,
I am facing with the same problem that Barkha had (c:\program files\microsoft visual studio\vc98\mfc\include\af xv_w32.h(1 4) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>).
I tried the soln's. suggested by AlexFM and Santino. But no Luck.
I am using Visual C++6.0 (with ATL COM - for developing a COM Component) and XP Professional OS.
I would really appreciate your help.
Many Thanks in advance,
Mamtha.
I am facing with the same problem that Barkha had (c:\program files\microsoft visual studio\vc98\mfc\include\af
I tried the soln's. suggested by AlexFM and Santino. But no Luck.
I am using Visual C++6.0 (with ATL COM - for developing a COM Component) and XP Professional OS.
I would really appreciate your help.
Many Thanks in advance,
Mamtha.
Hi Mamtha,
Do you have support for MFC enabled iin your ATL project?
Do you have support for MFC enabled iin your ATL project?
Dear Santino,
Thanks a lot for your help. I guess my ATL COM project is NOT enabled with MFC Support.
Onceagain Thanks,
Mamtha
Thanks a lot for your help. I guess my ATL COM project is NOT enabled with MFC Support.
Onceagain Thanks,
Mamtha
Hi All,
I am newbie to COM, trying to learn & develop COM Components. May I know, is it possible to directly fire an event(or call Client Interface Method, that is actually implemented in the Client) from the COM Server Thread. [The thread has been created using the MFC CWinThread class].
For Example,
I have a Event/method( called Fire_ButtonPressed ) in my Client-side interface called IHeadSetEvents. I need to call this event
from thread (that resides in the COM Server).
The Problem is, if I fire/call this event ( Fire_ButtonPressed ) from my COM Server thread directly, it throws an error Fire_ButtonPressed "undeclared".
When I try to include the Header file of the ConnectionPoints ( IHeadSetCP.h - where the Fire_ButtonPressed has been defined by the ATLCOM Wizard ), it throws an odd error saying "IID__IHeadSetEvents undeclared"(pointing to the class shown below).
//---------------------> Class generated by the ATLCOM Wizard <---------------------
template <class T>
class CProxy_IHeadSetEvents : public IConnectionPointImpl<T, &IID__IHeadSetEvents, CComDynamicUnkArray>
{
//Warning this class may be recreated by the wizard.
public:
HRESULT Fire_ButtonPressed(INT ButtonID)
{
HRESULT ret;
T* pT = static_cast<T*>(this);
int nConnectionIndex;
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionInd ex);
pT->Unlock();
_IHeadSetEvents* p_IHeadSetEvents = reinterpret_cast<_IHeadSet Events*>(s p.p);
if (p_IHeadSetEvents != NULL)
ret = p_IHeadSetEvents->ButtonPr essed(Butt onID);
} return ret;
}
};
//---------------------> Firing an event from the function (that is a part of my Thread Class - derived from CWinThread class) <--
int HeadSetThread::MyThreadFun c()
{
.......................
.......................
// Button pressed ?? Fire an event to the Client //
.......................
.......................
CProxy_IHeadSetEvents::Fir e_ButtonPr essed(true );
}
How can I solve this problem? Please help. [ If you need my source code or any further info. for better understanding of my que, please let me know].
Thanks a lot in advance,
Mamtha
I am newbie to COM, trying to learn & develop COM Components. May I know, is it possible to directly fire an event(or call Client Interface Method, that is actually implemented in the Client) from the COM Server Thread. [The thread has been created using the MFC CWinThread class].
For Example,
I have a Event/method( called Fire_ButtonPressed ) in my Client-side interface called IHeadSetEvents. I need to call this event
from thread (that resides in the COM Server).
The Problem is, if I fire/call this event ( Fire_ButtonPressed ) from my COM Server thread directly, it throws an error Fire_ButtonPressed "undeclared".
When I try to include the Header file of the ConnectionPoints ( IHeadSetCP.h - where the Fire_ButtonPressed has been defined by the ATLCOM Wizard ), it throws an odd error saying "IID__IHeadSetEvents undeclared"(pointing to the class shown below).
//---------------------> Class generated by the ATLCOM Wizard <---------------------
template <class T>
class CProxy_IHeadSetEvents : public IConnectionPointImpl<T, &IID__IHeadSetEvents, CComDynamicUnkArray>
{
//Warning this class may be recreated by the wizard.
public:
HRESULT Fire_ButtonPressed(INT ButtonID)
{
HRESULT ret;
T* pT = static_cast<T*>(this);
int nConnectionIndex;
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionInd
pT->Unlock();
_IHeadSetEvents* p_IHeadSetEvents = reinterpret_cast<_IHeadSet
if (p_IHeadSetEvents != NULL)
ret = p_IHeadSetEvents->ButtonPr
} return ret;
}
};
//---------------------> Firing an event from the function (that is a part of my Thread Class - derived from CWinThread class) <--
int HeadSetThread::MyThreadFun
{
.......................
.......................
// Button pressed ?? Fire an event to the Client //
.......................
.......................
CProxy_IHeadSetEvents::Fir
}
How can I solve this problem? Please help. [ If you need my source code or any further info. for better understanding of my que, please let me know].
Thanks a lot in advance,
Mamtha
Now you have your #include problem solved, I am answering to your undef query (If you know the solution just ignore my post)
you can use following to undef any def s --
#ifdef __windows__
#undef __windows__
#endif
Have a nice day
Regards,
Santino