|
Varghese Paul M wrote: Why COM when every thing is possible using DLLs which exports C++ classes.
That statement is incorrect, as Stuart said. You might want to keep reading, have you seen this?[^]
led mike
|
|
|
|
|
When you write an office addin for say MS Word using ATL after you've performed all the basic steps such as implementing IDExtensibility2 and including the proper typelibs all that's left in order to handle events is to implement IDispEventSimpleImpl using the dispinterface ApplicationEvents2. Then of course you fill in the sink maps with the appropriate values for the events you wish to capture.
This is of course a gross over simplification, but my point is when you have a dispinterface such as ApplicationEvents2 at your disposal your events have ID's associated with them (e.g. 0x00000006 = DocumentBeforeClose)
There is no such convenience when working with PowerPoint. EApplication contains the events you want to handle. However EApplication inherits directly from IDISPATCH. The events do not have id's associated with them (at least not obviously).
Does anyone know how to implement a powerpoint addin using ATL that handles events?
NOTE: Before you include links from Microsofts knowledgebase make sure that the sample actually is about a powerpoint addin using ATL. I've been through many of the links, they come close but do not answer my question. I'm not using c# and I'm not writing any dialog based projects.
|
|
|
|
|
Hi,
I have a structure, i am keeping the structure in vector to store multiple elements,
my structure looks like
struct mystruct
{
id = 1;
pid= 2;
}
i used vector to store like vector<mystruct> vectStruct;
like this i have 100 elements, i need to find the elements whose pid = 2
How can i search structures in vector, how to iterate through result.
Thanks in advance
----------------------------
KRISHNA KUMAR T M
|
|
|
|
|
Use a functor for that:
struct find_pid
{
find_pid ( int pid ) : m_pid_to_find(pid) { }
bool operator() ( const mystruct& s ) const { return m_pid_to_find == s.pid; }
protected:
int m_pid_to_find;
};
vector<mystruct>::iterator i = std::find_if ( vectStruct.begin(), vectStruct.end(), find_pid(2) );
|
|
|
|
|
Hi,
Thanks for your replay,
i tried what you explained in ur replay but when i pass integer to find_pid(4)
but it is giving error like cannot convert from int to mystruct&
----------------------------
KRISHNA KUMAR T M
|
|
|
|
|
i all,
I want to create an item in the "text-selection" context menu (context = 0x10) of MS IE. I want the title of this new item to include the text selected: "MySearch <selected text...="">"
Standard menu extension procedure for MS IE:
http://msdn.microsoft.com/en-us/library/aa753589(VS.85).aspx
doesn't allow this. I have tried to find a working sample, but googling/searching through the forums for a whole day didn't help. Can you please provide me with an advice/sample?
Thank you very much in advance.
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Dmitry Khudorozhkov wrote: Can you please provide me with an advice/sample?
Do you have some reason to believe IE supports this? Do you have a link or something?
led mike
|
|
|
|
|
Hi all,
I've got an ATL ActiveX control which only starts correctly the second time it's loaded. The first time it's loaded the DC in the parameter of the OnDraw method cannot be used to get the window it is supposed to be associated with ie a cal to GetWindowFrom DC fails. When checked in spy++ it is clear that this is no error, there is no window being created with the control.
Does anyone have an idea why this might be the case and how to resolve it?
I'm using
XP SP2
VS2005
ATL 8.0
Thanks loads for any help
Cheers
Tom
Philosophy: The art of never getting beyond the concept of life.
Religion: Morality taking credit for the work of luck.
|
|
|
|
|
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++
|
|
|
|