|
Mil's suggestion is sound but you'd have to take care the object is destroyed properly. He's the code he posted:
CComObject<CAddin>* pCAddin;<br />
CComObject<CAddin>::CreateInstance(&pCAddin);<br />
pCAddin->Add();
There's a trap here - the object is created with a reference count of zero. Since objects destroy themselves when the reference count is descremented to zero calling Release doesn't destory the object (since it decrements the reference count to -1). Using this code you would have to destroy the object as follows:
pCAddin->AddRef();
pCAddin->Release();
He's how I'd do it however:
CComObject<CAddin>* pCAddin;<br />
CComObject<CAddin>::CreateInstance(&pCAddin);<br />
pCAddin->AddRef();<br />
pCAddin->Add();<br />
pCAddin->Release();
Steve
|
|
|
|
|
Perfect Steve. I forgot the fact that CComObject instances are zero reference counted.
rgds..milton.
|
|
|
|
|
I have ATL COm dll, Now I want to convert it to ATL EXE, But when I removed the DLL main stuff to Winmain... It still assumes, its dll. When I try to execute it on cmd-shell, it gives me error messsage, " Not valid Win32 application"
Any Soultion.
cheers
Balkrishna Talele
|
|
|
|
|
You'll also need to change the project output settings on the link page from DLL to EXE ...
Why not create a new EXE project and cut/paste your code if you cannot figure it out?
:..::. Douglas H. Troy ::..
Bad Astronomy |Development Blogging|Viksoe.dk's Site
|
|
|
|
|
Mr Douglas H. Troy
Its not that simple, after all stunt, I have posted this question. Simply copy/cut/paste and changing the o/p to EXE dosent work. The entry point is itself dllmain. AND I WANT TO EXECUTE THAT EXE. do you understand
cheers
Balkrishna
|
|
|
|
|
The Exe project will give you a valid entry point (e.g. main()). Douglas did probably not mean to copy DllMain verbatim to your Exe project.
|
|
|
|
|
it gave me exe as per ur discussion, but during execution it said not vaild win 32, and my project is not of 2 or 3 files its massive project
|
|
|
|
|
Per my original recommendation, I did not mean for you to outright copy the centire contents of your DLL into a new executable project; there are obviously DLL specific implementations in a DLL ... you would need to make the determination yourself as to what can go/stay. However ... based off your following remark:
Balkrishna Talele wrote: and my project is not of 2 or 3 files its massive project
... why not just create a "stub" EXE that calls your DLL and that EXE becomes your primary application executable?
Balkrishna Talele wrote: AND I WANT TO EXECUTE THAT EXE. do you understand
Another thing: I'm trying to help/suggest things you may/not have tried to resolve your problem. Do not "yell" (aka All caps) at people who are trying to help you, or you'll find you get a big fat nothing back.
:..::. Douglas H. Troy ::..
Bad Astronomy |Development Blogging|Viksoe.dk's Site
-- modified at 13:01 Friday 17th February, 2006
|
|
|
|
|
Good day,
Suppose that I have completely developed a MFC dialog base application. At design time, I didn't want it to support Automation and I didn't check Automation support in AppWizard.
So now, how can I make it support Automation? What changes must be made to my current application?
Thank you in advance,
Have a good time!
KEMI
|
|
|
|
|
The easiest way to make this determination is to just create a new Dialog based MFC project and check the Automation support check box, then compare the source files to see what's been added ... basically, there are a couple of additional calls: CoInitialize() and CoUninitalize() are two that come to mind ...
If you're project is too big already, just create two new dialog projects; one with automation support and one without, then do a diff.
-done-
:..::. Douglas H. Troy ::..
Bad Astronomy |Development Blogging|Viksoe.dk's Site
|
|
|
|
|
Anybody knows how can I dynamically insert memory images into HTML document through mshtml interface?
|
|
|
|
|
Don't know about inserting "memory images" directly into the HTML, but you could take the following approach:
1. Get instance of the DOMDocument
2. create temp files of your "memory images" to disk
3. Insert image tags into DOMDocument pointing to said images
when you're done, clean-up your temp files; you could just maintain a 'list' of the temp images files created, so you can easily clean them off the disk when done.
:..::. Douglas H. Troy ::..
Bad Astronomy |Development Blogging|Viksoe.dk's Site
|
|
|
|
|
This is not a simple question. There are a number of way you can do it that I know of:
- Use an ActiveX control.
- Use a Rendering Behavior.
I have done both and they both work. You have to be at home with COM and do a little reading.
Steve
|
|
|
|
|
It's sounds interesting. May I have some examples or more detailed idea?
|
|
|
|
|
Hello, friends. I develope COM Add-in for MS Outlook. Anyone know how to get all accounts information in Outlook? Are necessary e-mail all accounts.
|
|
|
|
|
|
Thanks, I have already made.
|
|
|
|
|
Hi,
I have a class template that I want to derrive another class template from - could anyone help with the syntax?
My base class is declared as:
template <class type, long size> class xyz
{
};
What would I need to derrive a templace class abc from the above?
TIA
-- modified at 8:31 Thursday 2nd February, 2006
|
|
|
|
|
please come back to your post, click on the little [Modify] link at the bottom right, and there, check the "Ignore HTML tags in this message (good for code snippets)" check Box to let use see the whole template declaration.
note that i ask you to modify your post, not to repost it !
now i imagine you have this :
template<class T>
class xyz {
};
then you can do this (i think) :
template<class T>
class child : public xyz<T> {
};
thanks in advance...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
-- modified at 8:22 Thursday 2nd February, 2006
|
|
|
|
|
Thanks for this. That is pretty much how I have it but the compliler is unhappy. I will have to double check.
Ta
|
|
|
|
|
softwaremonkey wrote: That is pretty much how I have it but the compliler is unhappy
what do you doi exactly, and what does the compiler say ?
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
|
|
|
|
|
My base class (which is OK) is declared as:
template <class type, long size> class xyz
{
};
My derrived class is declared as:
template <class type, long size> class abc : public xyz<class type, long size>
{
};
The compiler throws out a lot of errors, the first being:
Error C2146 syntax error : missing ',' before identifier 'size'
The next error is
Error C2977 : 'xyz' too many template arguments - see declaration of 'xyz'
TIA
-- modified at 8:49 Thursday 2nd February, 2006
|
|
|
|
|
softwaremonkey wrote: template <class type,="" long="" size=""> class abc : public xyz<class type, long size>
{
};
change it into :
template <class type, long size>
class abc : public xyz<type, size> {
};
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
-- modified at 9:17 Thursday 2nd February, 2006
|
|
|
|
|
Hi,
Fantastic, it now compiles. I just couldnt see the wood for the trees.
Thanks a million
|
|
|
|
|
Hi,
i've included various projects(60) in my workspace and
i've used objectspace-STL within these, since now. I don't know if i have installed
software that damaged this old good state or i done something else, but from now i have to set the linker switch "ignore all standard lib.", that it would work - compile and link.
I get following fault, if I don't set it:
: error LNK2001: Nichtaufgeloestes externes Symbol "__declspec(dllimport) public: __thiscall std::_Winit::~_Winit(void)" (__imp_??1_Winit@std@@QAE@XZ)
So I looked for _Winit and find out that my DLL needs msvcp60.dll to work. I know this dll, it's for
MS C++ Runtime Library. But the question is:
How can i use objectspace-stl again and how can i ban this dll ?
Is there a switch within VS, with that i can get my old good state ?
Anyone who has experience how could i solve the problem ?
Thanks in advance
Eddy
|
|
|
|