|
Can anyone tell me the best way to get to the Parent window from the view (other than sending a windows message). This is a Framewindow from CFrameWindowImpl (not Mainframe for the app ) with a dialog based view. I need to call routines from the parent window & casting GetParent() to the parent frame class does not work (compiler says that it cannot cast a CWindow to the frame class).
Thanks
|
|
|
|
|
rajas wrote: I need to call routines from the parent window & casting GetParent() to the parent frame class does not work
A CWindow is just an HWND wrapper. Since you need the actual frame window object, you'll need to write your own accessor to get to it, similar to how MFC has AfxGetApp() that provides access to the one global CWinApp object. In simple projects, I just create a global CMainFrame* g_pMainWnd; and call it good.
|
|
|
|
|
Thanks.
I ended up doing something similiar - at the time I create the view, I pass the pointer to the parent framewindow which I store as a variable in the view & use that to call parent functions.
|
|
|
|
|
That'll work fine too. Much more OO than a global variable
|
|
|
|
|
Hi All,
I am compiling my ATL plugin for windows mail which is being blocked by Vista DEP.
As I am building the DLL in VC 6.0, (uses old ATL 3.1).
I read about the possible solutions, but I can't switch to VS 2005 or above, I have to use VC6.0 only.
So, I got to know that we can change ATL headers like atlbase.h and atlwin.h or some other relevant files. I tried making these changes in atlbase.h, I changed PAGE_READWRITE to
PAGE_EXECUTE_READWRITE in each VirtualAlloc function call.
But still the built DLL plugin is being blocked by Vista DEP.
I made this change in file atlbase.h residing in
C:\Program Files\Microsoft Visual Studio\VC98\ATL\Include
Kindly guide me how to make required changes in ATL header and/or src file(s) to make it Win Vista DEP compatible.
Thanks a lot,
Dolly
|
|
|
|
|
It's been a while since I did any work with ATL3. Didn't it have a runtime? ATL.dll (ATL.lib for static linking) or something like that. Perhaps you need to recompile them to get the desired effect.
--
Kein Mitleid Für Die Mehrheit
|
|
|
|
|
Hi, all:
There are some good oppotunity in Freeborders, we are search some Sr.C++ Engineer to join us, if you are interested in this position, please move your mouse to send me your CV to pandapam@126.com, maybe i can help you to get a good job!
Thank you for your attention, wish you a good luck.
BTW, the Location is China Shenzhen.
|
|
|
|
|
|
Hi, all..
I have developed BHO with ATL.
I want to make my BHO work only with Window Explorer.
however, my source code is not compiled.
help me.. what's problem in my code...
source codes are as followed..
extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
hInstance;
if (dwReason == DLL_PROCESS_ATTACH)
{
TCHAR Loader[MAX_PATH];
GetModuleFileName( NULL, Loader, MAX_PATH);
DisableThreadLibraryCalls(hInstance);
if ( lstrcmpi( PathFindFileName(Loader), _T("explore.exe"))) {
_AtlModule.DllMain(dwReason, lpReserved);
return FALSE;
}
}
return _AtlModule.DllMain(dwReason, lpReserved);
}
and error message is as followed.
Error 1 error PRJ0050: Failed to register output. Please ensure you have the appropriate permissions to modify the registry.
I cannot accept this error message because i am an administrator user on Windows XP machine.
modified on Thursday, November 20, 2008 7:44 PM
|
|
|
|
|
I often come across this problem, should be an vs bug
clean and close your project open and rebuild it.
good luck!
I like c++
|
|
|
|
|
Check this bho.dll post for your solution...
|
|
|
|
|
1. VS builds your DLL and tries to register it.
2. Registration happens by running regsvr32.
3. Your DllMain() sees that the process name is not explore.exe
4. DllMain() returns FALSE (error)
5. VS reports the error.
So it's doing exactly what you told it to do. You'll need to special-case registration as well. Don't forget to correct explore.exe to explorer.exe. Although that check won't work in IE versions before 7, because a file browser might be explorer.exe or iexplore.exe, and you have no control over it.
|
|
|
|
|
Hello,
I have a C# com object (.net framework 2.0) that I want to call from C++.
I tried to import the tlb and create the object using MyNamespace::IMyInterfacePtr pObj; but i got errors about not impelemting queryInterface, AddRef etc.
I found out that I should use CComObject (ref: http://support.microsoft.com/kb/181265[^]. So declaring the variable was a success using:
CComObject<mynamespace::mycomclass xmlns:mynamespace="#unknown">* pObj;</mynamespace::mycomclass>
Now I am trying to create an instance by using:
HRESULT hRes = (CComObject::CreateInstance(&pObj);
But I get the following error:
c:\program files\microsoft visual studio\vc98\atl\include\atlcom.h(2395) : error C2504: 'MyConClass' : base class undefined<br />
see reference to class template instantiation 'ATL::CComObject;' being compiled
Any ideas what I am doing wrong?
thanks!
|
|
|
|
|
MyConClass ? Looking at the rest of your code (using 'View Source' because all your angle brackets have been turned into tags), you've defined (and should have used) MyComClass ?
|
|
|
|
|
I changed the class name to simplify things, so this is not it.
|
|
|
|
|
Wow another mutant voter, well I weighed in to level things out.
led mike
|
|
|
|
|
Cheers, mate
Maybe I come over a little brusque to some people..but if I expressed my opinion on CP the way I do at work, I'd be getting negative votes
|
|
|
|
|
hi everybody!
I want to use a _int46 integer as the key of STL hash_map. it seems ok when i declare the map object. But when i insert some values in the map,i get the following error
"
Error C2064: term does not evaluate to a function
c:\program files\microsoft visual studio\vc98\include\stl_hashtable.h(537) : while compiling class-template member function 'unsigned int __thiscall std::hashtable<struct std::pair<__int64 const ,int>,__int64,struct std::hash<__int64>,struct
std::_Select1st<struct std::pair<__int64 const ,int> >,struct std::equal_to<__int64>,class std::__default_alloc_template<0,0> >::_M_bkt_num_key(const __int64 &,unsigned int) const'
Error executing cl.exe.
"
Blew is the code that generate this error.
#include "stdafx.h"
#include <hash_map>
#include <stdio>
using namespace std;
int main(int argc, char* argv[])
{
_int64 int64a=88888;
hash_map<_int64,int> amap;
hash_map<_int64,int>::iterator iter;
pair<const>apair;
amap.insert(apair(int64a,33));
return 0;
}
please suggest what is the cause of error and how to avoid it.
|
|
|
|
|
It's pretty difficult to tell what your code is, because the angle brackets (< and >) have been interpreted as HTML tag delimiters.
Anyway - this works and is equivalent to your code. I'm using VS2008, where hash_map has been moved from std to stdext , but that's a cosmetic difference really:
#include <hash_map>
typedef stdext::hash_map<__int64, int> Map;
int main(int, char**)
{
Map map;
map.insert(std::make_pair(88888LL, 33));
}
Interpreting your code, I think the problem is apair(int64a, 33) . apair is an object, but you're using it as a function - that matches the error message ("Term does not evaluate to a function "). If you want to set apair 's value, do it in the constructor.
|
|
|
|
|
|
I have developed COM add-in for microsoft word.I am handling events of microsoft word like DocumentOpen, DocumentBeforeSave. In Open / save events, I am getting the content of an active document. But I am getting only text or only image or only tables at a time.
How to retrieve byte array pointer to the word document entire content irrespective of data type (image, string, and table).
Vijit P
|
|
|
|
|
Hello~~
In my code, I sink it. but, I get a "First-chance exception at 0x77f87eeb in MyIE.exe: 0xC0000005: Access violation reading location 0x00000024."
I don't know, how do to solve it...I need some help...Thanks~~
I post my code...
<br />
<br />
<br />
#include <windows.h><br />
#include <atlbase.h><br />
#include <atlwin.h><br />
#include <ExDispID.h><br />
<br />
const UINT ID_WEBBROWSER = 100;<br />
<br />
class CMainWindow : public CWindowImpl<CMainWindow>,<br />
public IDispEventImpl< ID_WEBBROWSER, CMainWindow ><br />
{<br />
public:<br />
CMainWindow()<br />
{<br />
CWndClassInfo &wci = GetWndClassInfo();<br />
<br />
if( !wci.m_atom )<br />
{<br />
wci.m_bSystemCursor = TRUE;<br />
}<br />
<br />
m_AxWindow = NULL;<br />
m_pWebBrowser2 = NULL;<br />
}<br />
<br />
virtual ~CMainWindow(){}<br />
<br />
<br />
BEGIN_MSG_MAP(CMainWindow)<br />
MESSAGE_HANDLER( WM_DESTROY, OnDestroy )<br />
MESSAGE_HANDLER(WM_CREATE, OnCreate)<br />
END_MSG_MAP()<br />
<br />
BEGIN_SINK_MAP(CMainWindow)<br />
SINK_ENTRY( ID_WEBBROWSER, DISPID_DOCUMENTCOMPLETE, OnDocumentComplete )<br />
END_SINK_MAP()<br />
<br />
void __stdcall OnDocumentComplete( IDispatch *, VARIANT* )<br />
{<br />
<br />
}<br />
<br />
private:<br />
LRESULT OnCreate(UINT , WPARAM , LPARAM , BOOL& )<br />
{<br />
RECT rect;<br />
GetClientRect(&rect);<br />
HWND hWndContainer = m_AxWindow.Create( m_hWnd, rect, NULL, WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL, 0, ID_WEBBROWSER );<br />
<br />
if( !hWndContainer )<br />
return -1;<br />
<br />
HRESULT hr;<br />
hr = m_AxWindow.CreateControl( L"http://www.microsoft.com" );<br />
<br />
if( FAILED( hr ) )<br />
return -1;<br />
<br />
hr = m_AxWindow.QueryControl( IID_IWebBrowser2, (void**)&m_pWebBrowser2 );<br />
<br />
if( SUCCEEDED(hr) )<br />
{<br />
hr = AtlGetObjectSourceInterface( m_pWebBrowser2, &m_libid, <br />
&m_iid, &m_wMajorVerNum, &m_wMinorVerNum );<br />
<br />
if( FAILED(hr) )<br />
return -1;<br />
<br />
hr = DispEventAdvise(m_pWebBrowser2, &m_iid);<br />
<br />
<br />
if( FAILED(hr) )<br />
return -1;<br />
<br />
CComBSTR url = L"http://www.microsoft.com";<br />
<br />
hr = m_pWebBrowser2->Navigate( url,0,0,0,0 );<br />
<br />
if( FAILED(hr) )<br />
return -1;<br />
}<br />
<br />
return 0;<br />
}<br />
<br />
LRESULT OnDestroy(UINT , WPARAM , LPARAM , BOOL& )<br />
{<br />
if( m_dwEventCookie != 0xFEFEFEFE )<br />
DispEventUnadvise(m_pWebBrowser2, &m_iid);<br />
<br />
m_pWebBrowser2.Release();<br />
<br />
PostQuitMessage(0);<br />
return 0;<br />
}<br />
<br />
private:<br />
CAxWindow m_AxWindow;<br />
CComPtr<IWebBrowser2> m_pWebBrowser2;
};<br />
<br />
int APIENTRY _tWinMain(HINSTANCE hInstance,<br />
HINSTANCE hPrevInstance,<br />
LPTSTR lpCmdLine,<br />
int nCmdShow)<br />
{<br />
UNREFERENCED_PARAMETER(hPrevInstance);<br />
UNREFERENCED_PARAMETER(lpCmdLine);<br />
<br />
CMainWindow wnd;<br />
<br />
wnd.Create( NULL, NULL, NULL, WS_OVERLAPPEDWINDOW );<br />
<br />
if( !wnd )<br />
return FALSE;<br />
<br />
wnd.CenterWindow();<br />
wnd.ShowWindow( nCmdShow );<br />
wnd.UpdateWindow();<br />
<br />
MSG msg;<br />
<br />
while (GetMessage(&msg, NULL, 0, 0))<br />
{<br />
TranslateMessage(&msg);<br />
DispatchMessage(&msg);<br />
}<br />
<br />
return (int) msg.wParam;<br />
}<br />
compile code need to SET "Dynamic Link to ATL".
|
|
|
|
|
1) When does the exception occur.
2) Where does the exception occur (in the debugger, bereak on exceptions, get a call stack).
Difficult to advise without that information.
|
|
|
|
|
sorry...
when html download complete, exception occur.
code is set DOCUMENTCOMPLETE event, if set DISPID_BEFORENAVIGATE2, exception occur before open a url.
break in atlcore.h
HRESULT Lock() throw()
{
EnterCriticalSection(&m_sec); // here
return S_OK;
}
First-chance exception at 0x77f87eeb in 111.exe: 0xC0000005: Access violation reading location 0x00000024.
Unhandled exception at 0x77f87eeb in 111.exe: 0xC0000005: Access violation reading location 0x00000024.
Call Stack:
NTDLL.DLL!77f87eeb()
[Frames below may be incorrect and/or missing, no symbols loaded for NTDLL.DLL]
> 111.exe!ATL::CComCriticalSection::Lock() Line 87 + 0xc bytes C++
111.exe!ATL::CComCritSecLock<ATL::CComCriticalSection>::Lock() Line 336 + 0xa bytes C++
111.exe!ATL::CComTypeInfoHolder::GetTI(unsigned long lcid=0) Line 3757 + 0x8 bytes C++
111.exe!ATL::CComTypeInfoHolder::GetTI(unsigned long lcid=0, ITypeInfo * * ppInfo=0x0012f2cc) Line 3624 + 0xc bytes C++
111.exe!ATL::IDispEventImpl<100,CMainWindow,&GUID_NULL,&GUID_NULL,0,0,ATL::CComTypeInfoHolder>::GetFuncInfoFromId(const _GUID & iid={...}, long dispidMember=259, unsigned long lcid=0, ATL::_ATL_FUNC_INFO & info={...}) Line 4455 + 0x17 bytes C++
111.exe!ATL::IDispEventSimpleImpl<100,CMainWindow,&GUID_NULL>::Invoke(long dispidMember=259, const _GUID & __formal={...}, unsigned long lcid=0, const _GUID & __formal={...}, tagDISPPARAMS * pdispparams=0x0012f5c4, tagVARIANT * pvarResult=Empty, const _GUID & __formal={...}, const _GUID & __formal={...}) Line 4160 + 0x20 bytes C++
SHLWAPI.DLL!70ab88ba()
SHLWAPI.DLL!70ab883c()
SHLWAPI.DLL!70ab8935()
SHLWAPI.DLL!70ab89a7()
SHDOCVW.DLL!71752356()
SHDOCVW.DLL!7177deec()
SHLWAPI.DLL!70ab9669()
SHDOCVW.DLL!7177f819()
SHDOCVW.DLL!717a9f58()
SHDOCVW.DLL!7178b877()
OLE32.DLL!7cf15552()
SHDOCVW.DLL!71752ebe()
SHDOCVW.DLL!71722a2a()
SHDOCVW.DLL!71722bbb()
MSHTML.DLL!636a19cb()
MSHTML.DLL!63630901()
MSHTML.DLL!6367b7f1()
MSHTML.DLL!6362af7a()
MSHTML.DLL!63630e77()
MSHTML.DLL!6366fe64()
MSHTML.DLL!636f7c10()
MSHTML.DLL!636f7c10()
MSHTML.DLL!636f72a0()
MSHTML.DLL!636f85c3()
MSHTML.DLL!636f61ed()
MSHTML.DLL!636f7c10()
MSHTML.DLL!636aa379()
MSHTML.DLL!636f79b0()
MSHTML.DLL!63700394()
MSHTML.DLL!6370613c()
MSHTML.DLL!63706186()
MSHTML.DLL!637068c2()
MSHTML.DLL!637050db()
MSHTML.DLL!636fe9b0()
MSHTML.DLL!636f7c10()
MSHTML.DLL!636f64a8()
MSHTML.DLL!636f85c3()
MSHTML.DLL!636ff440()
MSHTML.DLL!636fe742()
MSHTML.DLL!63700fda()
MSHTML.DLL!63700fe2()
MSHTML.DLL!6361b66d()
MSHTML.DLL!6361b75b()
MSHTML.DLL!635f1b4c()
MSHTML.DLL!635f0b47()
MSHTML.DLL!6362af7a()
MSHTML.DLL!635f10cf()
MSHTML.DLL!635ee01b()
MSHTML.DLL!635f1df3()
MSHTML.DLL!6366f373()
MSHTML.DLL!636adff6()
MSHTML.DLL!636ae211()
MSHTML.DLL!636a8bf0()
MSHTML.DLL!636a8bf0()
MSHTML.DLL!636a8bf0()
MSHTML.DLL!636a8bcc()
MSHTML.DLL!636a8bd6()
MSHTML.DLL!636a8bcc()
MSHTML.DLL!636a8bd6()
MSHTML.DLL!63781cfa()
MSHTML.DLL!63780ae0()
MSHTML.DLL!6378109c()
MSHTML.DLL!637834be()
MSHTML.DLL!63783586()
MSHTML.DLL!63783588()
USER32.DLL!77e1a454()
USER32.DLL!77df4605()
USER32.DLL!77dfea4e()
USER32.DLL!77dfea5e()
NTDLL.DLL!77f91baf()
USER32.DLL!77dfa7f2()
111.exe!wWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, wchar_t * lpCmdLine=0x000208aa, int nCmdShow=1) Line 149 + 0xf bytes C++
111.exe!__tmainCRTStartup() Line 578 + 0x35 bytes C
111.exe!wWinMainCRTStartup() Line 403 C
KERNEL32.DLL!77e889d5()
NTDLL.DLL!77f85c09()
|
|
|
|
|
Are you running in debug mode or release mode - 'cause that looks like a null pointer that would be checked by an assertion in debug mode. The Access violation reading location 0x00000024 indicates attempting to reference a structure member through a null pointer.
Anyway - have you set a LIBID in your ATL _Module (or _AtlModule or whatever it's called). I think you might get an access violation at the point where you're getting one if you haven't. You'll have a NULL type holder pointer, I think.
|
|
|
|
|