|
You can use CWnd::Attach(), but be sure not
to pass the CWnd between threads.
I would pass the HWND instead, shuffling around MFC
objects and they just end up biting you in the a** is my experience.
/Magnus
- I don't necessarily agree with everything I say
|
|
|
|
|
I second Magnus' response. In fact, it's probably the only way to accomplish what you are trying to do. CWindow and CWnd is pure C++ and cannot reliably be passed between COM objects unless you're using local interfaces only. And judging by the use of variants, I suspect there may be other clients in your system not written in C++.
--
Gott weiß ich will kein Engel sein.
|
|
|
|
|
I have a Browser Helper Object that contains code I want to execute after a user logs into my website and only after logging into my website. What is the best way to start the code execution?
I have thought of creating a hidden field named "start" on the web page and setting the field value to some unique string. Then searching for that field and testing the for the known value. Is there a cleaner solution.
Thank you in advance for your suggestions.
|
|
|
|
|
Well, you could just hook the browser events (onload,ondocumentcomplete,ect..) and then check the current document location before doing whatever you need to do.
|
|
|
|
|
Yes but if I did that my url would need to be hardcoded. I have a product that I will be marketing and as a result mey be host on a variety of web sites.
I guess I could create a hidden field and set the value to some string like: {2F94BC6A-9E91-4010-B991-EA0E22F9FED4}
and test for it. But I was hoping there would be a cleaner solution.
|
|
|
|
|
Hello everyone:
How to add a help file into a wtl dialog?
Thank you.
-Freehawk
|
|
|
|
|
I reinstalled Visual Studio. Now I am creating a ATL Dll using wizard. After compilation following error occurs.
<br />
fatal error C1083: Cannot open include file: 'ATLServer_i.c': No such file or directory
_i.c is not getting created. Is any settings required to do create _i.c.
|
|
|
|
|
Have you add a COM object to your server properly?
Then try "Build All"
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|
Hi all,
ATL question:
suppose I have two interfaces (IFirst, ISecond), and both
interfaces have a method Test(). Now I would like to implement
both IFirst and ISecond in a single object, but still have two
separate implementations of the Test() method.
Any pointers on how this can be done ?
Thanks,
Alwin
|
|
|
|
|
Use rename when importing the typelib?
Only way i can think of...
/Magnus
- I don't necessarily agree with everything I say
|
|
|
|
|
What you may have to do is what's sometimes called forwarding shims. The trick is to "prebind" the virtual methods. Observe:
class IFirstFwd : public IFirst {
public:
HRESULT Test() {
return IFirst_Test();
}
virtual HRESULT IFirst_Test() = 0;
};
class ISecondFwd : public ISecond {
public:
HRESULT Test() {
return ISecond_Test();
}
virtual HRESULT ISecond_Test() = 0;
};
class CYourComClass : public IFirstFwd, public ISecondFwd {
public:
HRESULT IFirst_Test() {
...
}
HRESULT ISecond_Test() {
...
}
}; I know it looks clumbsy, but since C++ does not have a feature for renaming inherited methods, this is the most type safe way to do it. Ok, so know that you know how it works, let's cut off those extra 8 bytes from the vtable (on wintel ia32) by adding templates:
template <typename T>
class IFirstFwd : public IFirst {
public:
HRESULT Test() {
return static_cast<T*>(this)->IFirst_Test();
}
};
template <typename T>
class ISecondFwd : public ISecond {
public:
HRESULT Test() {
return static_cast<T*>(this)->ISecond_Test();
}
};
class CYourComClass : public IFirstFwd<CYourComClass>, public ISecondFwd<CYourComClass> {
public:
HRESULT IFirst_Test() {
...
}
HRESULT ISecond_Test() {
...
}
}; There is another way - although not very pretty IMHO. It will only work well once the interfaces have finalized. I.e., this is very bad during development, because you lose all the help from the type system, and the bugs you may potentially have will be less than fun to figure out:
class ISecondFake {
virtual __stdcall HRESULT ISecond_Test() = 0;
};
class CYourComClass : public IFirst, public ISecondFake {
public:
HRESULT Test() {
...
}
HRESULT ISecond_Test() {
...
}
}; This'll work as long as your ISecondFake is vtable-compatible with ISecond. But should you change the vtable layout or method signature of ISecond in any way, don't forget to update ISecondFake or you'll be in for quite the ride..
--
Gott weiß ich will kein Engel sein.
|
|
|
|
|
Actually i am developing a class in which it will take any com object and will be able to set and get the properties. Now i have taken the clsid of the component. Now how can i get its properties as GetIdsofNames function of IDispatch takes names. Please Guide me briefly with a little example or tell me some article
Thanx in advance
Regards
minamkhan
Inam
|
|
|
|
|
|
Hello everyone
I have a wtl7.1 project and a mfc(VC6.0) dll.
Is there any way to use CString data to be transfered rightly between wtl project and mfc dll?
Thank you.
-Freehawk
|
|
|
|
|
freehawk wrote:
Is there any way to use CString data to be transfered rightly between wtl project and mfc dll?
Yes, if you pass LPCTSTR between them, then you have nothing to worry about.
I.e. in WTL project:
CString strYourString = "data";
Vc6Function(strYourString); in MFC project:
void Vc6Function(LPCTSTR lpszString) {
CString strLocalString = lpszString;
...
} This is one way to do it.
--
Gott weiß ich will kein Engel sein.
|
|
|
|
|
Hello everyone:
In a wtl project, there is a CListViewCtrl in a dialog.
After clicked one row of list, could you teach me how to get the double-click message?
Thank you
-Freehawk
|
|
|
|
|
You get a WM_COMMAND with LBN_DBLCLK.
/Magnus
- I don't necessarily agree with everything I say
|
|
|
|
|
Thank you for the reply
I have known how to get just as the following :
NOTIFY_HANDLER(IDC_LIST, NM_DBLCLK, OnDblClkList)
-Freehawk
|
|
|
|
|
That's the correct way to do it if you're using a list view control (CListCtrl in MFC and CListViewCtrl in WTL). Magnus gave you the solution for a list box (CListBox).
--
Gott weiß ich will kein Engel sein.
|
|
|
|
|
LBN_DBLCLK is for ListBoxes, not list view controls.
--
Gott weiß ich will kein Engel sein.
|
|
|
|
|
Thank you and Magnus very much.
You let me understand clearly.
-Freehawk
|
|
|
|
|
Ofcourse..
Mental note: *Dont answer even simple questions when yor brain is fried*
/Magnus
- I don't necessarily agree with everything I say
|
|
|
|
|
hello everyone:
How to change title text of dialog in a wtl project?
Thank you.
-Freehawk
|
|
|
|
|
SetWindowText() ?
/Magnus
- I don't necessarily agree with everything I say
|
|
|
|
|
Thank you for the reply
I tried it in a docking window, but nothing was changed.
Maybe there is other problem.
-Freehawk
|
|
|
|