|
Hi,
I have a BHO which can open urls in the current instance of IE or a new instance of IE. However, if I open a url in a new instance and then close the new window, and then try to browse to any other url from the original BHO, nothing happens! Below is my code:
VARIANT vFlags = {0};
vFlags.vt = VT_I4;
vFlags.lVal = navOpenInNewWindow;
CComVariant vtEmpty;
if(bInNewWindow)
m_spBrowser->Navigate(_bstr_t(sUrl), &vFlags, &vtEmpty, &vtEmpty, &vtEmpty);
else
m_spBrowser->Navigate(_bstr_t(sUrl), &vtEmpty, &vtEmpty, &vtEmpty, &vtEmpty);
VariantClear(&vFlags);
Any ideas why this is happening, and a solution?
Thanks!
Chris
|
|
|
|
|
What is a BHO? I often open a new instance of the users default internet browser by using this..
ShellExecute(NULL, NULL, _T("url:http://www.yahoo.com"), NULL, _T("C:\\WINNT"),SW_SHOW);
I know its probably not the answer you were looking for but maybe it's another option.
Rob
|
|
|
|
|
Hi,
A BHO is a Browser Helper Object, like an Explorer Bar. I usually do the ShellExecute() also, but if I use that, it opens the url in the current instance of IE instead of in a new browser window.
I've also noticed that when opening links in email and such, sometimes a new browser window is opened for a link and other times, the last browser window opened is used... ???
Chris
|
|
|
|
|
Say you have a dialog with 2 member controls,
a listview and a listbox and both handles WM_LEFTBUTTONDOWN.
Then you think you could set up something like this
BEGIN_MSG_MAP(CMainDlg)
CHAIN_MSG_MAP_MEMBER(moList)
CHAIN_MSG_MAP_MEMBER(moListBox)
END_MSG_MAP()
but offcourse that will not work since moList will always get to handle
the message since it is first in the list.
The next thing you think of then is to check the HWND in each
off the classes WM_LBUTTONDOWN handlers and set bHandled to FALSE and
skip processing if it does not match.
(which is a soultion that is asking for problems when you start reusing the
classes since you will often forget to do that)
And that does not work either since the HWND is not passed on to the message
handler.
Is there some good standard soultion to this?
Or do i have to dig out the HWND some way?
Or (horrible tought) have to write a BEGIN_MSG_MAP macro that passes on the HWND?
/Magnus
|
|
|
|
|
I don't think that is doing what you expect.
Take a look at contained windows and the ALT message maps if you want to handle messages sent to the controls in your dialog's message map.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
You dont have to say t dont do what i expect.
Anyway, what i am trying is to create some standard custom controls.
And then i would like to use them by subclassing the controls on the dialog.
So i want the controls to be what they are and not some CContainedWindow members.
Surely you must be able to do that someway or WTL looses *BIG* to MFC in that respect.
/Magnus
|
|
|
|
|
If you are trying to create standard custom controls then why are you trying to process the button down messages in dialog's main message map?
Either you use contained windows or you subclass CEdit for example and have the message map in the subclass.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
I am processing the messages there because thats where they are sent.
I have subclassed the control and i have the messagemap in the subclass, but
WIN32 send messages to childwindows to the parent window.
So either i am missing a big part of the picture here or there is
not possible to create custom controls in WTL that can be reused easily.
/Magnus
|
|
|
|
|
????
You mentioned WM_LBUTTONDOWN which shouldn't be redirected to the parent. But if you are talking about notification message, then look at the reflect macros. This will allow you to reflect the messages back to the control.
MFC does handle this a bit better. But ATL/WTL gives the the macros to do the what you need to do.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Yes i got the messages mixed up with notifications there, but
in this case even the WM_LBUTTONUP is sent to the parent and not to my
subclassed window.
It's a static control, maybe they are a special?
I remember someting (but not what) about them being special if you use the default id for them. (which i dont do in this case)
/Magnus
|
|
|
|
|
Ok, then at this point you are getting into specifics I know nothing about.
So I can't honestly contribute.
But if you want me to, I can try to make up crap that sounds good.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Tim Smith wrote:
But if you want me to, I can try to make up crap that sounds good
Please do, can't be worse than the crap i written alreaday.
Thanks for the help anyway.
I think i leave this now, drown my sorrows in huge amounts of booze, and try again tomorrow.
/Magnus
|
|
|
|
|
Tim Smith wrote:
But if you want me to, I can try to make up crap that sounds good.
Your Dark side of Marketing that comes from selling your own product
(OK ! OK ! I admit , it was a nasty one )
Cheers,
Joao Vaz
A person who is nice to you, but rude to the waiter, is not a nice person - Natalie Portman (Padme/Amidala of Star Wars)
|
|
|
|
|
You need to use Contained Windows and Alternate Message Maps.
The "CContainedWindow" documentation sums this up pretty good
1) Add a member CContainedWindow m_wnd1, m_wnd2 to your class
(could also be CContainedWindow<mybaseclass>)
2) in your dlg CTor, call the CContainedWindow's CTor with
1) Window Class String for the window to create
2) this
3) a dialog-unique number, e.g. 1 and 2
3) add a message map like this:
BEGIN_MSG_MAP(CMyDialog)
...
MESSAGE_HANDLER(WM_CREATE, OnCreate)
...
ALT_MSG_MAP(1)
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLBDown_FirstControl)
ALT_MSG_MAP(2)
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLBDown_SecondControl)
END_MSG_MAP()
that's it, pretty much.
The earth is not dying. It is being killed.
|
|
|
|
|
I dont want to use CContainedWindows, they are good if
you would like to do some special processing for controls without
creating a subclass class yourself, but for a control
you intend to reuse they are no good.
You cannot resue the code based on them. (not in any good way anyway)
Anyway i found out what the problem was, very easy just as long
as you look in the right place.
The statics have to have the SS_NOTIFY style set to recive the message.
/Magnus
|
|
|
|
|
ahhh... ok (I missed that it's just two statics)
If a parent window shall handle messages that go to a child window only, you need CContainedWindow (or some similar technique)
The earth is not dying. It is being killed.
|
|
|
|
|
http://www.codeproject.com/script/comments/forums.asp?forumid=1647&app=50&select=188698#xx188698xx
plese enlighten me!
Thanks
|
|
|
|
|
Huh? What is the question. Your link just points back to the forum.
Good Luck,
Bill
|
|
|
|
|
Hi, i need to change the colour arrangement for an edit ctrl, i have managed to change the outlines but cannot change the background colour (the white bit) can someone help me plz.
Thanks.
==================================================
When Your Mind Wonders...Where Does It Go???
|
|
|
|
|
The Eclypse wrote:
When Your Mind Wonders...
Did you mean "wanders"?
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
no i meant wonders....is wanders an actual word??
==================================================
When Your Mind Wonders...Where Does It Go???
|
|
|
|
|
I think the original quote is "When your mind wanders, where does it go?". "wander" means "to go about from place to place usually without a plan or definite purpose".
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
i never knew that there was actually a saying.
==================================================
When Your Mind Wonders...Where Does It Go???
|
|
|
|
|
Ok,
In the OnCtlColor you also need
to set the BkColor of the Text.
ex for blue
pDC->SetBkColor(RGB(0,0,255)) ;
|
|
|
|
|
i did that but its still not working.
nb: This is a seperate class for the edit control.
==================================================
When Your Mind Wonders...Where Does It Go???
|
|
|
|