|
Added the following code and fixed the problem:
STDMETHOD(SetClientSite)(IOleClientSite *pClientSite)
{
if (pClientSite)
{
RECT rc = {0,0,0,0};
HWND hWnd = CreateControlWindow(::GetDesktopWindow(), rc);
_ASSERT (hWnd);
}
return IOleObjectImpl<cofficex>::SetClientSite (pClientSite);
}
HRESULT InPlaceActivate(LONG iVerb, const RECT* prcPosRect)
{
_ASSERT (m_spClientSite);
LPOLEINPLACESITE pInPlaceSite = NULL;
HRESULT hr = m_spClientSite->QueryInterface(IID_IOleInPlaceSite,
(void **)&pInPlaceSite);
_ASSERT (SUCCEEDED (hr) && pInPlaceSite);
HWND hParent = NULL;
hr = pInPlaceSite->GetWindow (&hParent);
_ASSERT (SUCCEEDED (hr) && hParent);
pInPlaceSite->Release ();
SetParent (hParent);
return CComControlBase::InPlaceActivate(iVerb, prcPosRect);
}
</cofficex>
Cheers
Tom
Philosophy: The art of never getting beyond the concept of life.
Religion: Morality taking credit for the work of luck.
|
|
|
|
|
what's win32 version of rand, srand ?
tnx
|
|
|
|
|
rand and srand are part of the CRT, you can call them in a Windows program with no problem (assuming you're using the CRT, of course).
If you can't use the CRT, one option is to use the WinCrypt library. Check out CryptGenRandom()
|
|
|
|
|
I have created an Aggregate COM.
How to use the Aggregate COM object in client application?
|
|
|
|
|
Hi i am new to ATL. I need to create a Acivetx control which does some arithmatic operation?. please help.
|
|
|
|
|
I'd suggest learning how to use ATL. There were lots of books available that would you could learn ATL programming from, not so many now that .NET is the popular option. However, Microsft's documentation is pretty good, and there's plenty of information on the internet.
Aside from that - there's no short-cut. You have to learn about the technology you're going to use.
|
|
|
|
|
i have created an ATL project with Composite control object.
Placed edit boxes and button controls to do arithmatic operations and written event handler for that. Implemented connection point interface. Everything is ok.
But when i tried to use that control in MFC application the event handler is not triggered.(not even in Test container) what could be the problem?.
|
|
|
|
|
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.
|
|
|
|