|
Hi
In which scenarios would COM connection points be preferred to Windows Messaging (like regsisterwindowsmessage,postmessage) ?
Thanks
Rose81
|
|
|
|
|
Rose81 wrote: In which scenarios
Perhaps if you provide the list of "scenarios" we can filter it for you.
|
|
|
|
|
Rose81 wrote: In which scenarios would COM connection points be preferred to Windows Messaging (like regsisterwindowsmessage,postmessage) ?
In general:
Whenever you want a COM server to notify its client you should use connection points or preferably your own source interface.
More detailed explanation:
When you design COM servers you should always design with distribution in mind, i.e. your server may be used remotely from a different machine using DCOM. In this case you cannot send/post windows messages to the client.
Furthermore your server may be created in a UI-thread that may not necessarily have a window.
Tip of the day:
Regarding the concept of connection points even the COM authority Don Box recommends not to use connection points in his book "Effective COM"[^], but rather your own source interface.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
I'm having the problem in an application I made in VC6 and Windows2003.
In Windows2003 works fine, but when I put the app in the WindowsXP where it has to be, it doesn't work.
I installed all the VStudio6 with the SP6 as I have it in Window2003, and still not working.
Something I noticed in the XP machine;
When I make a new project in VC6 and select a Windows Application -> Hello World Example, works ok.
BUT, I open the Example About Dialog it generates, and add a ProgressBar or a ListControl; when I run it, it runs, but the About Dialog si not load.
In my original App, I'm using a ListControl and a ProgressBar, so thats the problem......
Is there anybody that can help me ?
Guillermo.
-- modified at 14:47 Tuesday 26th June, 2007
I just tried in another XP and another Windows2003
and the same.
In XP doesn't work and in W2003 yes. :'( ¡Strange!
|
|
|
|
|
Are you calling InitCommonControls() (or InitCommonControlsEx()) somewhere BEFORE using any
controls?
Mark
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
I didn't explicitly add the InitCommonControls, it's necesary? cause in W2003 works. shouldn't be needed in W2003 also??
Where should I add it in the code ?
I read in MSDN something about it; it said the that problem with initcommoncontrols was in VC5 and that in VC6 was solved, so, if I need to add it; where should I put it?
in WinMain? or just before the DialogBox Call ?
Thnx!
|
|
|
|
|
2003 may have a DLL that pulls in the common control DLL automatically.
It doesn't hurt to call InitCommonControls() though
WinMain is fine. Give it a try!
Mark
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
Great!!!
The InitCommonControls() did the job!!!
Another thing that makes me think is why in w2003 works, if the
#include "commctrl.h" nor the link to comctl32.lib where added previously.
But well...
Adding the link to comctl32.lib and the include commctrl.h and the InitCommonControls Call, works!!!!
Thanx a lot.
Guillermo.
|
|
|
|
|
anselmo wrote: Another thing that makes me think is why in w2003 works, if the
#include "commctrl.h" nor the link to comctl32.lib where added previously.
Those need to be there for your project to compile and link.
At runtime, however, ComCtl32.dll needs to be loaded. That's all InitCommonControls does - makes
a call into the DLL which forces it to be loaded if it isn't already. That's why I think if
it worked on 2003, that a system DLL causes the ComCtl32.dll to be loaded so it's already there
when you create your controls.
Glad it worked!
Mark
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
Hi,
I have placed a static Text Common control, can i set the alignment of text present in that text box, I have found right align text option but couldn't find center alignment option, does any one know about it.
Warm Regards,
Mushq
|
|
|
|
|
If you placed it on a dialog in the resource editor, then select the control, press F4 to get the
properties window for the control. Find the Align Text property - you should be able to set it
to left, center, or right.
For a programmatically-placed control, add the SS_LEFT, SS_CENTER, or SS_RIGHT style when creating
the control.
Mark
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
Mark Thanx a lot
|
|
|
|
|
Dude you broke the forum again
|
|
|
|
|
It was broken when I got here
Nobody saw it - you can't prove anything!
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
Reply posted to your message[^] below.
Iain.
|
|
|
|
|
Is there any STL container for array?
|
|
|
|
|
the std::vector is a dynamic array.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
If you are looking for a static size array, there is also boost::array[^].
Extra note: boost::array is in TR1[^], so if VC++ supported it, you could have used std::tr1::array by including "tr1/array" (this works in gcc), but until then, if you decide to use boost, you can include "boost/tr1/array.hpp" and use std::tr1::array (instead of boost::array).
Orhun Birsoy
|
|
|
|
|
How can I ensure that the memory allocated by new gets deleted even if if do not give a delete operator.
|
|
|
|
|
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
They'll manage deletion of the memory for you. But use it only when you need them, not putting them everywhere just because you are lazy
|
|
|
|
|
tom groezer wrote: even if if do not give a delete operator.
what does "give a delete operator" mean? "give" is not a standard term used in software development. Here is a tip, don't make up your own terms when posting messages as it will be difficult to understand what you are saying.
Here is what you can do with a delete operator:
* overload
* call
Which one are you speaking about?
|
|
|
|
|
u call delete as in delete p;
|
|
|
|
|
Ok
tom groezer wrote: How can I ensure that the memory allocated by new gets deleted even if if do not call a delete operator.
Then Cedric has given you the correct lead to the smart pointer[^]. However there are different models of smart pointers. There is one in STL called "auto_ptr" and there are others in the Boost library[^] that have different use models.
I recommend that you feel confident in your understanding of the different models before attempting to use them. Misuse of smart pointers can be worse than leaking memory.
|
|
|
|
|
If a base class has private functions how does the derived class call it without use of friends. is there some idiom where u can acess the private function of base class. Also is there a difference between a function and a method.
|
|
|
|