Hi there,

I have a WTL app with a dialog that contains the MS Web browser control
in the center of it. The dialog is borderless and is being placed as a
child onto my main form.

The dialog appears where I expect it to, but the Web browser control
appears at the top left of the screen, as if it is not parented to the
dialog. I don't seem to be able to move it back, even after explicitly
setting it's parent to the dialog.

Any ideas what I could be doing wrong?

TIA.

Nick.

RE: Web Browser Control by changliw

changliw
Thu Jan 10 01:40:15 CST 2008

Hi Nick,
I understand that your Microsoft Web Browser control was not displayed in
the center of the parent dialog, instead at the top left of the screen.
Your application was an WTL application.
If I have misunderstood, please let me know.

Currently Windows Template Library (WTL) is not supported by Microsoft MSDN
Managed Newsgroup. However you may find peer support at WTL Support List
Web Site:
http://tech.groups.yahoo.com/group/wtl/

Per my test, this issue does not happin for Web Browser Control in MFC
dialogs. I searched some internet articles which talk about WTL and Web
Browser and post the links below for your reference:
Using WTL's Built-in Dialog Resizing Class
http://www.codeproject.com/KB/wtl/wtldlgresize.aspx?print=true
Automatic Layout of Resizable Dialogs
http://www.codeproject.com/KB/wtl/dialoglayout.aspx

Please feel free to let us know if you have any other questions or
concerns. Have a nice day!


Best regards,
Charles Wang
Microsoft Online Community Support
=====================================================
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
======================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================










Re: Web Browser Control by NickP

NickP
Thu Jan 10 04:44:13 CST 2008

Aahaaa!

Problem fixed!

//HRESULT hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
HRESULT hRes = ::CoInitialize(NULL);
ATLASSERT(SUCCEEDED(hRes));

In my application entry point I changed CoInitializeEx to CoInitialize and
now the browser appears where it should! Lucky for me this doesn't appear
to have effected anything else, but I'll have to keep my eye out. :)

Nick.

"NickP" <a@a.com> wrote in message
news:OnZmoIsUIHA.2000@TK2MSFTNGP05.phx.gbl...
> Hi there,
>
> I have a WTL app with a dialog that contains the MS Web browser control
> in the center of it. The dialog is borderless and is being placed as a
> child onto my main form.
>
> The dialog appears where I expect it to, but the Web browser control
> appears at the top left of the screen, as if it is not parented to the
> dialog. I don't seem to be able to move it back, even after explicitly
> setting it's parent to the dialog.
>
> Any ideas what I could be doing wrong?
>
> TIA.
>
> Nick.
>



Re: Web Browser Control by NickP

NickP
Thu Jan 10 04:52:19 CST 2008

Hi Charles,

Unfortunately I don't really consider that group as a viable option
considering the turn around times.

Anyways, problem resolved now, I have posted my solution.

Nick.

"Charles Wang[MSFT]" <changliw@online.microsoft.com> wrote in message
news:euhNQw1UIHA.360@TK2MSFTNGHUB02.phx.gbl...
> Hi Nick,
> I understand that your Microsoft Web Browser control was not displayed in
> the center of the parent dialog, instead at the top left of the screen.
> Your application was an WTL application.
> If I have misunderstood, please let me know.
>
> Currently Windows Template Library (WTL) is not supported by Microsoft
> MSDN
> Managed Newsgroup. However you may find peer support at WTL Support List
> Web Site:
> http://tech.groups.yahoo.com/group/wtl/
>
> Per my test, this issue does not happin for Web Browser Control in MFC
> dialogs. I searched some internet articles which talk about WTL and Web
> Browser and post the links below for your reference:
> Using WTL's Built-in Dialog Resizing Class
> http://www.codeproject.com/KB/wtl/wtldlgresize.aspx?print=true
> Automatic Layout of Resizable Dialogs
> http://www.codeproject.com/KB/wtl/dialoglayout.aspx
>
> Please feel free to let us know if you have any other questions or
> concerns. Have a nice day!
>
>
> Best regards,
> Charles Wang
> Microsoft Online Community Support
> =====================================================
> When responding to posts, please "Reply to Group" via
> your newsreader so that others may learn and benefit
> from this issue.
> ======================================================
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> ======================================================
>
>
>
>
>
>
>
>
>



Re: Web Browser Control by Alexander

Alexander
Thu Jan 10 18:33:27 CST 2008

Well, a container _must_ use STA after all. Did you expect it to
magically work after violating important aspects of your contract?
And sure nobody here could have helped you with that given the
details you had provided...

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@mvps.org
MVP VC FAQ: http://vcfaq.mvps.org
=====================================

"NickP" <a@a.com> wrote in message
news:%23qC08W3UIHA.2464@TK2MSFTNGP04.phx.gbl...
> Aahaaa!
>
> Problem fixed!
>
> //HRESULT hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
> HRESULT hRes = ::CoInitialize(NULL);
> ATLASSERT(SUCCEEDED(hRes));
>
> In my application entry point I changed CoInitializeEx to CoInitialize and
> now the browser appears where it should! Lucky for me this doesn't appear
> to have effected anything else, but I'll have to keep my eye out. :)
>
> Nick.
>
> "NickP" <a@a.com> wrote in message
> news:OnZmoIsUIHA.2000@TK2MSFTNGP05.phx.gbl...
>> Hi there,
>>
>> I have a WTL app with a dialog that contains the MS Web browser
>> control in the center of it. The dialog is borderless and is being
>> placed as a child onto my main form.
>>
>> The dialog appears where I expect it to, but the Web browser control
>> appears at the top left of the screen, as if it is not parented to the
>> dialog. I don't seem to be able to move it back, even after explicitly
>> setting it's parent to the dialog.
>>
>> Any ideas what I could be doing wrong?
>>
>> TIA.
>>
>> Nick.
>>
>
>



Re: Web Browser Control by NickP

NickP
Wed Jan 16 08:32:21 CST 2008

?

And I'm sure there was any need for that wasn't there Alexander?

You obviously think you are so clever to pluck that little fact out of your
a$$ but obviously not clever enough to suggest it in the first place, only
after I had provided the solution to my problem.

Strangely enough there is no one stop shop to find the solution to any
problem and if I had known that this was the case I wouldn't have asked the
question in the first place. Nor am I in the position to be able to provide
masses of source code that I have no idea is relevant to the problem or not.

And I have no doubt what soever that other people *have* and *will*
experience this problem.

You, are an idiot.

"Alexander Nickolov" <agnickolov@mvps.org> wrote in message
news:u0Idjl%23UIHA.1480@TK2MSFTNGP06.phx.gbl...
> Well, a container _must_ use STA after all. Did you expect it to
> magically work after violating important aspects of your contract?
> And sure nobody here could have helped you with that given the
> details you had provided...
>
> --
> =====================================
> Alexander Nickolov
> Microsoft MVP [VC], MCSD
> email: agnickolov@mvps.org
> MVP VC FAQ: http://vcfaq.mvps.org
> =====================================
>
> "NickP" <a@a.com> wrote in message
> news:%23qC08W3UIHA.2464@TK2MSFTNGP04.phx.gbl...
>> Aahaaa!
>>
>> Problem fixed!
>>
>> //HRESULT hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
>> HRESULT hRes = ::CoInitialize(NULL);
>> ATLASSERT(SUCCEEDED(hRes));
>>
>> In my application entry point I changed CoInitializeEx to CoInitialize
>> and now the browser appears where it should! Lucky for me this doesn't
>> appear to have effected anything else, but I'll have to keep my eye out.
>> :)
>>
>> Nick.
>>
>> "NickP" <a@a.com> wrote in message
>> news:OnZmoIsUIHA.2000@TK2MSFTNGP05.phx.gbl...
>>> Hi there,
>>>
>>> I have a WTL app with a dialog that contains the MS Web browser
>>> control in the center of it. The dialog is borderless and is being
>>> placed as a child onto my main form.
>>>
>>> The dialog appears where I expect it to, but the Web browser control
>>> appears at the top left of the screen, as if it is not parented to the
>>> dialog. I don't seem to be able to move it back, even after explicitly
>>> setting it's parent to the dialog.
>>>
>>> Any ideas what I could be doing wrong?
>>>
>>> TIA.
>>>
>>> Nick.
>>>
>>
>>
>
>