🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.web
11 messages
11 total messages Started by Albert Wiersch Wed, 23 Feb 2005 00:35
Show Find dialog in TCppWebBrowser
#1338
Author: Albert Wiersch
Date: Wed, 23 Feb 2005 00:35
12 lines
1184 bytes
How do I show the find dialog in TCppWebBrowser (displayed when Edit->Find 
(on This Page)) is selected in IE)?

This doesn't work:
WB->ExecWB(Shdocvw_tlb::OLECMDID_FIND,Shdocvw_tlb::OLECMDEXECOPT_PROMPTUSER);

Thank you.

-- 
Albert Wiersch
http://www.htmlvalidator.com/
Re: Show Find dialog in TCppWebBrowser
#1339
Author: Remy Lebeau (TeamB)
Date: Wed, 23 Feb 2005 01:07
17 lines
1392 bytes
"Albert Wiersch" <mrinternetnewsborland@wiersch.com> wrote in message
news:421bcfa2$1@newsgroups.borland.com...

> This doesn't work:
>
WB->ExecWB(Shdocvw_tlb::OLECMDID_FIND,Shdocvw_tlb::OLECMDEXECOPT_PROMPTUSER)
;

Just saying it doesn't work says nothing at all about the actual problem you
are having.  You need to provide specific details.

What is the actual return value of ExecWB()?  According to MSDN,
OLECMDID_FIND is not supported by ExecWB() to begin with.


Gambit
Re: Show Find dialog in TCppWebBrowser
#1340
Author: Albert Wiersch
Date: Wed, 23 Feb 2005 01:52
31 lines
1791 bytes
Just found this. If I can translate it to CPP I think it should work:
http://members.shaw.ca/iedelphi/webbrowser.htm#advanced2

-- 
Albert Wiersch
http://www.htmlvalidator.com/


"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message 
news:421bd738$1@newsgroups.borland.com...
>
> "Albert Wiersch" <mrinternetnewsborland@wiersch.com> wrote in message
> news:421bcfa2$1@newsgroups.borland.com...
>
>> This doesn't work:
>>
> WB->ExecWB(Shdocvw_tlb::OLECMDID_FIND,Shdocvw_tlb::OLECMDEXECOPT_PROMPTUSER)
> ;
>
> Just saying it doesn't work says nothing at all about the actual problem 
> you
> are having.  You need to provide specific details.
>
> What is the actual return value of ExecWB()?  According to MSDN,
> OLECMDID_FIND is not supported by ExecWB() to begin with.
>
>
> Gambit
>
> 
Re: Show Find dialog in TCppWebBrowser
#1341
Author: Albert Wiersch
Date: Wed, 23 Feb 2005 02:14
27 lines
1751 bytes
Looks like I need more help. :-(

Remy, you're right that OLECMDID_FIND is not supported in the manner that I 
was hoping it would be. Do you know the proper C++ code to show the Find 
dialog using TCppWebBrowser?

This wasn't much help to me, but maybe it would be more help to someone 
else:
http://members.shaw.ca/iedelphi/webbrowser.htm#advanced2

Thank you.

-- 
Albert Wiersch
http://www.htmlvalidator.com/


"Albert Wiersch" <mrinternetnewsborland@wiersch.com> wrote in message 
news:421be1c2$1@newsgroups.borland.com...
>
> Just found this. If I can translate it to CPP I think it should work:
> http://members.shaw.ca/iedelphi/webbrowser.htm#advanced2
>
> -- 
> Albert Wiersch
> http://www.htmlvalidator.com/
Re: Show Find dialog in TCppWebBrowser
#1342
Author: Mark Finkle
Date: Wed, 23 Feb 2005 08:02
64 lines
3057 bytes
A couple things:

1. Use IOleCommandTarget->Exec(...)
QueryInterface your IHTMLDocument2 for it.

2. Create a GUID using the value found on the web page you found. This is 
the command group and is used as a namespace for the command ids. The 
OLECMDXxx and IDM_Xxx command ids are for different namespaces (sometimes). 
In this case you want the WebBrowser namespace.

3. Use the constant from the web page you found. The original author used 
HTMLID_FIND = 1, do the same.

4. The last 2 parameters of the Exec function are VARIANT's. In this case 
they can be "empty". Use TNoParam (I think).

Should look something like (off the top of my head):

GUID iidWebBrowser;
IIDFromString(L"{ED016940-BD5B-11cf-BA4E-00C04FD70816}", &iidWebBrowser);

IOleCommandTarget* pCmdTarget = 0;
pMyHTMLDoc2->QueryInterface(IID_IOleCommandTarget, (void**)&pCmdTarget);
if (pCmdTarget) {
    int HTMLID_FIND = 1;
    pCmdTarget->Exec(&iidWebBrowser, HTMLID_FIND, 0, TNoParam(), 
TNoParam());
    pCmdTarget->Release();
}

HTH,
Mark Finkle

"Albert Wiersch" <mrinternetnewsborland@wiersch.com> wrote in message 
news:421be6ee$1@newsgroups.borland.com...
>
> Looks like I need more help. :-(
>
> Remy, you're right that OLECMDID_FIND is not supported in the manner that 
> I was hoping it would be. Do you know the proper C++ code to show the Find 
> dialog using TCppWebBrowser?
>
> This wasn't much help to me, but maybe it would be more help to someone 
> else:
> http://members.shaw.ca/iedelphi/webbrowser.htm#advanced2
>
> Thank you.
>
> -- 
> Albert Wiersch
> http://www.htmlvalidator.com/
>
>
> "Albert Wiersch" <mrinternetnewsborland@wiersch.com> wrote in message 
> news:421be1c2$1@newsgroups.borland.com...
>>
>> Just found this. If I can translate it to CPP I think it should work:
>> http://members.shaw.ca/iedelphi/webbrowser.htm#advanced2
>>
>> -- 
>> Albert Wiersch
>> http://www.htmlvalidator.com/
>
> 
Re: Show Find dialog in TCppWebBrowser
#1343
Author: Remy Lebeau (TeamB)
Date: Wed, 23 Feb 2005 09:46
29 lines
1848 bytes
"Albert Wiersch" <mrinternetnewsborland@wiersch.com> wrote in message
news:421be1c2$1@newsgroups.borland.com...

> Just found this. If I can translate it to CPP I think it should work:
> http://members.shaw.ca/iedelphi/webbrowser.htm#advanced2

    #include <utilcls.h>

    const DWORD HTMLID_FIND = 1;
    const GUID CGID_WebBrowser = {0xED016940, 0xBD5B, 0x11CF, {0xBA, 0x4E,
0x00, 0xC0, 0x4F, 0xD7, 0x08, 0x16}};

    void __fastcall TForm1::FindIE()
    {
        if( (WebBrowser1->Document) && (WebBrowser->ReadyState ==
READYSTATE_COMPLETE) )
        {
            TComInterface<IOleCommandTarget> CmdTarget;
            if(
SUCCEEDED(WebBrowser1->Document->QueryInterface(IID_IOleCommandTarget,
(LPVOID*)&CmdTarget)) )
                CmdTarget->Exec(&CGID_WebBrowser, HTMLID_FIND, 0, NULL,
NULL);
        }
    }


Gambit
Re: Show Find dialog in TCppWebBrowser
#1344
Author: Albert Wiersch
Date: Wed, 23 Feb 2005 16:07
57 lines
2612 bytes
Thank you all. I was able to construct something that actually works. :-)

Here it is:

#include <mshtmhst.h>

void __fastcall TCSEQEForm::WBOptionsFindClick(TObject *Sender) {
 if( (WB) && (WB->Document) && 
(WB->ReadyState==Shdocvw_tlb::READYSTATE_COMPLETE) ) {
  TComInterface<IOleCommandTarget> CmdTarget;
  if 
(SUCCEEDED(WB->Document->QueryInterface(IID_IOleCommandTarget,(LPVOID*)&CmdTarget)) 
 )
   CmdTarget->Exec(&CGID_WebBrowser, HTMLID_FIND, 0, NULL, NULL);
   CmdTarget->Release();
 }
}

-- 
Albert Wiersch
http://www.htmlvalidator.com/


"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message 
news:421c5106$1@newsgroups.borland.com...
>
> "Albert Wiersch" <mrinternetnewsborland@wiersch.com> wrote in message
> news:421be1c2$1@newsgroups.borland.com...
>
>> Just found this. If I can translate it to CPP I think it should work:
>> http://members.shaw.ca/iedelphi/webbrowser.htm#advanced2
>
>    #include <utilcls.h>
>
>    const DWORD HTMLID_FIND = 1;
>    const GUID CGID_WebBrowser = {0xED016940, 0xBD5B, 0x11CF, {0xBA, 0x4E,
> 0x00, 0xC0, 0x4F, 0xD7, 0x08, 0x16}};
>
>    void __fastcall TForm1::FindIE()
>    {
>        if( (WebBrowser1->Document) && (WebBrowser->ReadyState ==
> READYSTATE_COMPLETE) )
>        {
>            TComInterface<IOleCommandTarget> CmdTarget;
>            if(
> SUCCEEDED(WebBrowser1->Document->QueryInterface(IID_IOleCommandTarget,
> (LPVOID*)&CmdTarget)) )
>                CmdTarget->Exec(&CGID_WebBrowser, HTMLID_FIND, 0, NULL,
> NULL);
>        }
>    }
>
>
> Gambit
>
> 
Re: Show Find dialog in TCppWebBrowser
#1345
Author: Remy Lebeau (TeamB)
Date: Wed, 23 Feb 2005 18:36
18 lines
1850 bytes
"Albert Wiersch" <mrinternetnewsborland@wiersch.com> wrote in message
news:421caa1a$1@newsgroups.borland.com...

>    CmdTarget->Release();

Get rid of that.  You are releasing the interface too many times.  When
QueryInterface() returns, the interface has a reference count of 1, and
TComInterface is taking ownership of the interface pointer.  Then you are
calling Release() to manually decrement the count to 0, destroying the
interface object.  But TComInterface is then decrementing the reference
count again when it itself is freed, which will crash since the interface
object is no longer valid.  The whole point of using TComInterface is that
it handles the reference counting for you automatically so you don't have to
do it yourself manually.


Gambit
Re: Show Find dialog in TCppWebBrowser
#1349
Author: Albert Wiersch
Date: Wed, 23 Feb 2005 22:03
17 lines
1619 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message 
news:421ccd27$1@newsgroups.borland.com...
>
> "Albert Wiersch" <mrinternetnewsborland@wiersch.com> wrote in message
> news:421caa1a$1@newsgroups.borland.com...
>
>>    CmdTarget->Release();
>
> Get rid of that.  You are releasing the interface too many times.

Thank you. I'm not familiar with this stuff so I didn't know. Thanks for 
bringing it to my attention.

-- 
Albert Wiersch
http://www.htmlvalidator.com/ 
Re: Show Find dialog in TCppWebBrowser
#1367
Author: irina
Date: Thu, 24 Feb 2005 15:57
22 lines
1274 bytes
When user presses <Ctrl+F> in TCppWebBrowser
Edit->Find dialog will appear without need for special code.

Irina.

"Albert Wiersch" <mrinternetnewsborland@wiersch.com> wrote:
>
>How do I show the find dialog in TCppWebBrowser (displayed when Edit->Find 
>(on This Page)) is selected in IE)?
>
>This doesn't work:
>WB->ExecWB(Shdocvw_tlb::OLECMDID_FIND,Shdocvw_tlb::OLECMDEXECOPT_PROMPTUSER);
>
>Thank you.
>
>-- 
>Albert Wiersch
>http://www.htmlvalidator.com/
>
>
>
Re: Show Find dialog in TCppWebBrowser
#1373
Author: Albert Wiersch
Date: Thu, 24 Feb 2005 21:03
18 lines
1375 bytes
Yes, I knew that... but I also wanted to have the option there because some 
people may not know about Ctrl+F.

Thanks.

-- 
Albert Wiersch
http://www.htmlvalidator.com/


"irina" <iziegler@rgis.com> wrote in message 
news:421df97f$1@newsgroups.borland.com...
>
> When user presses <Ctrl+F> in TCppWebBrowser
> Edit->Find dialog will appear without need for special code.
>
> Irina.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads