|
Ummm - use ATL? That'll do the IDispatch implementation for you if you ask it nicely, as well as loads of other interfaces - I just created an ATL Control class in VS2003 and it looks like it'll implement these interfaces for you:
IDispatch, IPersistStreamInit, IOleControl, IOleObject, IOleInPlaceActiveObject, IViewObjectEx, IOleInPlaceObjectWindowless, IPersistStorage, ISpecifyPropertyPages, IQuickActivate, IDataObject, IProvideClassInfo2<br />
|
|
|
|
|
Thanks for the responses guys
I agree with your do it your self attitude but this interface has literally hundreds of events, methods and properties and I start to go a bit nuts after a while of doing that much repetitive work.
Unfortunately, I've failed at failed at finding any assistance from VC2005. so I've decided I'd rather write a parser myself than manually go through it all. Is there a document that lists the complete spec for IDL files? and would anyone be interested in me publishing the resulting app?
Thanks again
Tom
It will always be the bane of the civilised as to what to do with the barbarian
|
|
|
|
|
Would it be less work to use the type library instead of the IDL ?
Steve S
Developer for hire
|
|
|
|
|
Hi Steve
Hmmm... I'm not sure.
The control has to have all the functionality of the old contol but certain of the methods, events and properties require modification. It also has to fit into alot of legacy JavaScript functions and I can only change the GUID which luckily I put into a resource file but modifying the JavaScript is out of the question. The reason I say this is that I am unaware of how to achieve this effect using a type library. A nifty alternative would be great but I haven't thought of one.
Thanks
tom
|
|
|
|
|
OK - I think I've got an automated solution for you. Note - this was done with VS2003...
- Create an ATL DLL project.
- Add an 'ATL Control' class. Use some throwaway name for the control interface (because you *will* be throwing it away ), but make sure the class names are ones you're happy with.
- Copy'n'paste your IDL interface into the new projects IDL file
- In the Class View, right click the ATL Control class and select Add->Implement Interface... The interface you want to implement should be in the dialog that appears. Select it and click Finish. This should create bare method definitions.
Note that I've not determined what happens to event definitions.
|
|
|
|
|
Fantastic solution
Worked like a treat! Events too!
Thanks loads
Tom
It will always be the bane of the civilised as to what to do with the barbarian
|
|
|
|
|
Ah. That's how you get to it. I knew it was around here somewhere
Steve S
Developer for hire
|
|
|
|
|
Hi all,
I am a beginner in ATL programming . How I can use IHTMLDocument2 or IWebBrowser2 Objects in my ATL programme made by using "Simple Object"
Please Help me,
Thanks in Advance
George K Jolly
-- modified at 2:16 Tuesday 3rd October, 2006
|
|
|
|
|
Typically you use the standard COM connection point mechanism to receive events.
Steve
|
|
|
|
|
Hi Steve,
Thanks for reply,
I am a beginner in ATL programming. I Just want to know ,How to implement any COM Object for eg: IWebBrowser2 or IHtmldocument etc. in My ATL Programme. So that I can catch any event from my webbrowser or Html Document. Is there any example codes available.
Thanks
George K Jolly
|
|
|
|
|
while compiling my first WTL prog I got lots of errors saying
C:\VISUALSTUDIO_6.0\WTL71\INCLUDE\atlapp.h(396) : error C2872: 'ATL' : ambiguous symbol
i read lots of articles on the net n readme file as well but not able to get rid of this.
it seems a common error generated due to bug in atlbase.h but how to come out of it.
please help me
thanx in advance
|
|
|
|
|
Google is your friend...that would point you to this[^], which recognises the problem and describes a workaround:
It's a bug in ATL that affects WTL. The readme.html file included with
WTL7.5 (the latest WTL version, available at
http://sourceforge.net/projects/wtl) describes the workaround:
... Surround atlbase.h include declaration with following statements:
#define ATL ATLFIX
#include <atlapp.h>
#undef ATL
namespace ATL = ::ATLFIX;
It also describes the nature of the bug and the reason for the error
message.
|
|
|
|
|
a class inherited from 2 or more class can i cast the pointer of this new class to a pointer of 1st parent and call a function and then cast it again to a pointer of the 2nd parent and call its function. and if it is allowed what is the rules and limitation to do this?
|
|
|
|
|
The example below shows two base classes (A and B ) and a class that derives from them both (C ). Now, you can cast a C* pointer to A* or B* with static_cast . This will call non-virtual methods on A or B respectively. However, for virtual methods, you need to explicitly ask for the parent classes version, as shown in the comments.
So...to get what you want, you don't actually need a cast at all - just specify that you want to call the parent classes method using the class-name:: notation.
#include <iostream>
class A
{
public:
void M() { std::cout << "A::M - this = " << (int)this << "\n"; }
virtual void X() { std::cout << "A::X - this = " << (int)this << "\n"; }
};
class B
{
public:
void N() { std::cout << "B::N - this = " << (int)this << "\n"; }
virtual void Y() { std::cout << "B::X - this = " << (int)this << "\n"; }
};
class C : public A, public B
{
public:
void M() { std::cout << "C::M - this = " << (int)this << "\n"; }
void N() { std::cout << "C::N - this = " << (int)this << "\n"; }
virtual void X() { std::cout << "C::X - this = " << (int)this << "\n"; }
virtual void Y() { std::cout << "C::Y - this = " << (int)this << "\n"; }
};
int main(int, char**)
{
C c;
c.X();
c.A::X();
static_cast<A*>(&c)->X();
static_cast<A*>(&c)->A::X();
c.M();
c.A::M();
static_cast<A*>(&c)->M();
static_cast<A*>(&c)->A::M();
c.Y();
c.B::Y();
static_cast<B*>(&c)->Y();
static_cast<B*>(&c)->B::Y();
}
|
|
|
|
|
|
Demian Panello wrote: I have added the WM_DRAWITEM function but the program never reach that function.
Did you set the owner draw style?
"Alot of the people on this forum are incredibly stupid, thinking that the internet is real" Score: 1.0 in the Soap Box
led mike
|
|
|
|
|
Hi.
The control class has the WM_DRAWITEM handle. It's a composite control and there is a template dialog where I put the controls, (but no dialog class), so, I want to paint with a bitmap resource the background.
Is WM_DRAWITEM the appropriate handle ?? I don't think so, because is it subclassed of what??.
WM_ERASEBKGND maybe??
I think I have a feature here, a mixed feature inside my head with all this painting stuff.
Thank you.
Demian.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
Which class has the WM_DRAWITEM-handler? If it's the combobox itself, you need to reflect the WM_DRAWITEM message back to the combobox class. That is easily done with REFLECT_NOTIFICATIONS() inside the message map in the containing class/window.
If not, I bet led mike is onto something.
--
80 percent entertainment by volume
|
|
|
|
|
Hi.
The control class has the WM_DRAWITEM handle. It's a composite control and there is a template dialog where I put the controls, (but no dialog class), so, I want to paint with a bitmap resource the background.
Is WM_DRAWITEM the appropriate handle ?? I don't think so, because is it subclassed of what??.
I think I have a feature here, a mixed feature inside my head with all this painting stuff.
Thank you.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
I've created an ATL DLL that contains TCP connections inside. I use it with the Internet Explorer(HTML <object> tag+JavaScript). It runs fine. The problem arises when I open multiple instances of IE. It disturbs the previous connection. I dont know why. But when the same DLL is used with an .exe application, It doesn't care about multiple instances.It runs fine independently. How can I achieve the same with IE? btw, why is it distrubing the other instance? is it not supposed to run on its own space? Please help. I'm tired refering for this issue for long. Today I dont wanna disturb Google because he's celebrating his b'day. .
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
Link2006 wrote:Let's take it outside of CP
Jeremy : Please don't.I would love to see this.I'm making the popcorn already.
|
|
|
|
|
VuNic wrote: It disturbs the previous connection
VuNic wrote: Today I dont wanna disturb Google today
Yeah well I don't think you will find anything looking for "disturb connection" anyway. Please link to the reference that you learned that phrase from.
VuNic wrote: is it not supposed to run on its own space?
I don't know, did you develop IE to run each instance in an isolated process?
Perhaps you should have considered the "threading" model for your ATL project.
"Alot of the people on this forum are incredibly stupid, thinking that the internet is real" Score: 1.0 in the Soap Box
led mike
|
|
|
|
|
Disturb connection: It breaks the TCP stream. The point why I used "disturb" is that I've programmed the clients to reconnect automatically. but I really dont understand the picture when to web pages are running with the dll.
For example,I try to run another when a similar page(that loads the dll and uses it with JS) is already running,
1. Disconnects the previous connection (client1 in page1)
-------- but client1 reconnects to server again.
2. Starts a new connection (client2 in page2)
3. Now I close any one these connection.
----This closes the other connection.
But this never happens when I use the Dll with a windows application. The exes run separately without *disturbing* eachother.
led mike wrote: Perhaps you should have considered the "threading" model for your ATL project.
Can you point me to some resources that actually deals with this?
It's an appartment threaded model and I've done everything to make sure it's thread safe. Inside every worker thread I've used CoInitializeEx(NULL, COINIT_MULTITHREADED); & CoUninitialize();
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
Link2006 wrote:Let's take it outside of CP
Jeremy : Please don't.I would love to see this.I'm making the popcorn already.
|
|
|
|
|
VuNic wrote: Can you point me to some resources that actually deals with this?
With threading issues? I always liked Richter's "Advanced Windows" book.
VuNic wrote: But this never happens when I use the Dll with a windows application.
Try changing the application to use the control from two different threads, you will likely see the same behavior.
VuNic wrote: It's an appartment threaded model
That just forces the entry from the same thread.
VuNic wrote: I've done everything to make sure it's thread safe.
That does not appear to be the case.
led mike
|
|
|
|
|
Thanks mike. I'd make these changes & check it again. Btw I need to learn a lot in this department. But the time contstraint drives me to look for a magical solution immediately. I think it won't work this time until I open the book again
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
Link2006 wrote:Let's take it outside of CP
Jeremy : Please don't.I would love to see this.I'm making the popcorn already.
|
|
|
|
|
Led, I solved that one. It's not a threading issue but a design issue. I have a separate tcp class for the tcp operation and I created a global object of it for my class's use."gobal" is the culprit & me too . Now I removed it and inherited my class from the tcp class. Now the problem doesn't happen again.
|
|
|
|