AfxGetApp()->m_pMainWnd in a DLL? [Edit]
-
Hello, I am currently writing a wrapper DLL in VC++ 6 so that I can use specific SDK functions from VB .Net. (VB .Net can access the function through "Private Declare Function GetDuration Lib "Path\Wrapper.dll" (parameters)") In my C++ DLL I need to pass an "HWND" value to an SDK function; however, when I use "AfxGetApp()->m_pMainWnd" the compiler returns two errors:
'AfxGetApp' undeclared identifier left of '->m_pMainWnd' must point to struct/class/union
Am I trying to retrieve my DLL's "HWND" correctly or is there a better function than "AfxGetApp()" to use in a DLL? [Edit] If I use "AfxGetMainWnd()" instead, I only get one error:'AfxGetMainWnd' undeclared identifier
I am unsure why it says that "AfxGetMainWnd" is an undeclared identifier. [/Edit] Any help would be greatly appreciated, Mitch My sig: "And it is a professional faux pas to pay someone else to destroy your computer when you are perfectly capable of destroying it yourself." - Roger Wright Get Perpendicular! (Hitachi Storage) My CodeProject Blog Most recent blog post: April 11 -
Hello, I am currently writing a wrapper DLL in VC++ 6 so that I can use specific SDK functions from VB .Net. (VB .Net can access the function through "Private Declare Function GetDuration Lib "Path\Wrapper.dll" (parameters)") In my C++ DLL I need to pass an "HWND" value to an SDK function; however, when I use "AfxGetApp()->m_pMainWnd" the compiler returns two errors:
'AfxGetApp' undeclared identifier left of '->m_pMainWnd' must point to struct/class/union
Am I trying to retrieve my DLL's "HWND" correctly or is there a better function than "AfxGetApp()" to use in a DLL? [Edit] If I use "AfxGetMainWnd()" instead, I only get one error:'AfxGetMainWnd' undeclared identifier
I am unsure why it says that "AfxGetMainWnd" is an undeclared identifier. [/Edit] Any help would be greatly appreciated, Mitch My sig: "And it is a professional faux pas to pay someone else to destroy your computer when you are perfectly capable of destroying it yourself." - Roger Wright Get Perpendicular! (Hitachi Storage) My CodeProject Blog Most recent blog post: April 11Afx... functions are MFC functions. Add MFC support to your dll and they should work.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!
Honoured as one of The Most Helpful Members of 2004
-
Hello, I am currently writing a wrapper DLL in VC++ 6 so that I can use specific SDK functions from VB .Net. (VB .Net can access the function through "Private Declare Function GetDuration Lib "Path\Wrapper.dll" (parameters)") In my C++ DLL I need to pass an "HWND" value to an SDK function; however, when I use "AfxGetApp()->m_pMainWnd" the compiler returns two errors:
'AfxGetApp' undeclared identifier left of '->m_pMainWnd' must point to struct/class/union
Am I trying to retrieve my DLL's "HWND" correctly or is there a better function than "AfxGetApp()" to use in a DLL? [Edit] If I use "AfxGetMainWnd()" instead, I only get one error:'AfxGetMainWnd' undeclared identifier
I am unsure why it says that "AfxGetMainWnd" is an undeclared identifier. [/Edit] Any help would be greatly appreciated, Mitch My sig: "And it is a professional faux pas to pay someone else to destroy your computer when you are perfectly capable of destroying it yourself." - Roger Wright Get Perpendicular! (Hitachi Storage) My CodeProject Blog Most recent blog post: April 11Mitch (Programmer2k4) wrote: In my C++ DLL I need to pass an "HWND" value to an SDK function; however, when I use "AfxGetApp()->m_pMainWnd" the compiler returns two errors: In Continuation With Mr Arend, you need a window in DLL too, as there by default no window present in DLL, So AfxGetApp() function is of no use!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta