|
Hi,
We have written a ATL COM addin for MS word. We have found that events are called for 1st instance of word document. When we open another document then no event is called. If we close all word docs and open a new word document again, event is generated. We futher digging we found that,for first instance OnConnection() is called, for 2nd , 3rd instance it is not called.
Please help me out.
regards
RYK
|
|
|
|
|
VC_RYK wrote: Please help me out.
With what? You think we can make word fire the events when documents are opened? This is Code Project not the Magic Shop.
led mike
|
|
|
|
|
Hi
From This link u can get the code
http://support.microsoft.com/kb/230689
and this works only for a single document which open first but i want to work for every document.
With regards
RYK
|
|
|
|
|
I find that edit box has a caret but button doesn't.
What's the main differenct of them?
|
|
|
|
|
|
|
Thats easy,
the CBugsBunnyWnd
codito ergo sum
|
|
|
|
|
Isn't this kind of obvious? You'll have a caret only where there is a text-area (where you could possibly type and the letters appear). What possibly made you ask such a question?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
I bet he can almost smell your angry gas...
|
|
|
|
|
Probably yes.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
You can use the caret in any window you want to.
Since a caret is generally used to mark an insertion point, it only really makes sense to use
it where the user can insert something.
Carets[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Caret is for text and editbox is for enter the textes but I guess your intent is focus,right?
|
|
|
|
|
Hello,
Can anyone point me a smaple that shows me how to hook the WM_PRINTCLIENT event.
Thank you!
|
|
|
|
|
|
Thank you!
Can you tell me (I am not sure) if this event WM_PRINTCLIENT is related with the user pressing Print button?
I want to make sure that I get this event when the user want to print a page.
|
|
|
|
|
Hi,
Follwoing code is not working for shutting down a system.
if(ExitWindowsEx(EWX_REBOOT|EWX_FORCE,0))
AfxMessageBox(_T("Restart"));
else
{
if(InitiateSystemShutdownEx(NULL,NULL,NULL,FALSE,TRUE,NULL))
AfxMessageBox(_T("Restart1"));
}
|
|
|
|
|
Did you check the return value of ExitWindowsEx()?
See this secret link: How to shut down the system[^]
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
pther wrote: Follwoing code is not working for shutting down a system.
Ok. So what's it doing?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Hello everyone,
This is what mentioned in the book, ATL Internals about why Release function of CComPtr and CComQIPtr is needed for global and static variable.
--------------------
The destructor for global and static variable only executes after the main function exits, long after CoUninitialize runs, (That is, if it runs at all. You must link with the C++ runtime library for the constructors and destructors of global and static variable to run.) ATL itself doesn't use the C/C++ runtime library; thus, by default, ATL components don't link with the library.
--------------------
I do not quite understand what means "must link with the C++ runtime library for the constructors and destructors ... to run"? Could anyone help please?
thanks in advance,
George
|
|
|
|
|
Try this experiment and you will see.
Find or write some code like this
<br />
<br />
class CSomeclass<br />
{<br />
public:<br />
static int MyMember;<br />
};<br />
<br />
int CSomeclass::MyMember = 42;<br />
<br />
Place a breakpoint on the assignment and also one at the beggining of your code, in main or InitiInstance or whatever.
Run under Debug and you may be surprised at what happens. When the debugger stop take a look at the call stack and the order in which the breakpoints are hit.
Bootstrapping an MSVC C++ program is about 10,000x more complex than most people realize.
Nothing is exactly what it seems but everything with seems can be unpicked.
modified on Tuesday, April 8, 2008 6:40 AM
|
|
|
|
|
Thanks Matthew,
To my surprise, when set a break point to the assignment line, when execute the program, the break point will automatically moved to the beginning of main. Any ideas?
class CSomeclass
{
public:
static int MyMember;
};
int CSomeclass::MyMember = 42;
int main()
{
return 0;
}
regards,
George
|
|
|
|
|
Hmm, not sure, are you linking to the C Runtime, MSVCRT.dll or that static lib equivalent. You can find out by looking at the value of CSomeclass::MyMember when main() gets called if it's not 42 then static initialization is not being called hence it's reasonable it won't let you set a breakpoint on a line that's never called. Try changing from a CONSOLE subsystem app to a WINDOWS subsystem app as well as that makes a differenece to the entry point used. You'll need a WinMain function to get a raw windows app off the ground without MFC. If you have a look in your equivalent of
C:\Program Files\Microsoft Visual Studio 8\VC\crt\src\crtexe.c
, assuming you installed it, you'll see the code that actually runs when you application starts up. The call to _initterm( __xc_a, __xc_z ) at around Line 512 is where your static class members like CSomeclass::MyMember.
Please don't ask me to explain it. It's 'for reference only'.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Thanks Matthew,
I think C++ Runtime library is fundamental and ATL is also C++ code, I do not understand why ATL is not dependent on C++ Runtime library? What functions are provided by C++ Runtime library besides STL, which ATL is not dependent on?
regards,
George
|
|
|
|
|
You could try using the depends.exe tool that comes with Visual Studio. Use it to open MSVCRT.dll and look at the lower of the 2 panes on the right hand half of the upper window.
This will list all the stuff MSVCRT exports, a lot of functions. Many of these are defined by the C Language standard which describes a set of library functions which are to be available with the language. You can probably find a copy of the standard on the internet somewhere. Some of the others are widely implemented extensions to the standard, others are Microsoft specific additions and a few are wierd undocumented stuff for supporting the underpinnings of Windows and even integrating with .NET. It's a beastly big library and although Microsoft do provide the source, due to code injection they don't actually provide quite all of it and it certainly isn't open. The main alternative C Library which has all the standard functions in it and more is glibc the GNU C Library which is what GNU-Linux uses and which runs just about everywhere except on Windows
It would be lovely if someone produced a fully open source completely standards compliant C Library compatible with MSVCRT and with glib and that runs absolutely everywhere , sadly that would take many, many person years of work.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|