Click here to Skip to main content
16,004,924 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralWaiting for Data on Pipes Pin
Anonymous24-May-04 1:07
Anonymous24-May-04 1:07 
GeneralRe: Waiting for Data on Pipes Pin
cmk24-May-04 9:57
cmk24-May-04 9:57 
GeneralTitle bar Pin
TrungHuynh24-May-04 0:22
TrungHuynh24-May-04 0:22 
GeneralRe: Title bar Pin
Dennis Gourjii24-May-04 1:52
Dennis Gourjii24-May-04 1:52 
GeneralA site for mshtml interface Pin
Member 52815524-May-04 0:06
Member 52815524-May-04 0:06 
GeneralRe: A site for mshtml interface Pin
Andrew Quinn AUS24-May-04 0:15
Andrew Quinn AUS24-May-04 0:15 
GeneralRe: A site for mshtml interface Pin
Member 52815524-May-04 1:49
Member 52815524-May-04 1:49 
GeneralRe: A site for mshtml interface Pin
Andrew Quinn AUS24-May-04 3:31
Andrew Quinn AUS24-May-04 3:31 
Hi,

Are the HTML pages yours (or public sites)?

If they are yours then the easiest thing to do is the following:

In your pages include the <bgsound> tag (with the src attr empty) and an ID, e.g.

<html>
...
<bgsound src='' id='idSound1'>
...
</html>


Then in your OnDocumentComplete event in VC++ you can run the following code:

MSHTML::IHTMLDocument2Ptr spDoc(m_ctlWeb1.GetDocument());
if (spDoc)
{
    // Find the BGSOUND tag...
    MSHTML::IHTMLDocument3Ptr spDoc3 = spDoc;
    if (spDoc3)
    {
        // you could also use getElementByTagName but for simplicity...
        MSHTML::IHTMLElementPtr spElem2 = spDoc3->getElementById(_bstr_t("idSound1"));
        if (spElem2)
        {
            MSHTML::IHTMLBGsoundPtr spBG = spElem2;
            if (spBG)
            {
                CString strURL = _T("http://server/eg/alert.wav");
                spBG->put_src(_bstr_t(strURL));
            }
        }
    }
}


If they are public sites and you are trying to inject a <bgsound> into them - this will be a little bit more work...

Firstly, we need to get DOM to create us an <bgsound> element, and then insert it into the document. As before, we do this in the OnDocumentComplete event...

MSHTML::IHTMLElementPtr spElem = spDoc->createElement(_T("BGSOUND"));
if (spElem)
{
    MSHTML::IHTMLBGsoundPtr spBG = spElem;
    if (spBG)
    {
        CString strURL = _T("http://server/eg/alert.wav");
        spBG->put_src((bstr_t)strURL);

        // get the DOMNode interface for the BODY...
        MSHTML::IHTMLDOMNodePtr spBody = spDoc->body;
        // get the DOMNode interface for the element we wish to add...
        MSHTML::IHTMLDOMNodePtr spNode2Add = spBG;

        if (spBody != NULL && spNode2Add != NULL)
        {
            // append new element to BODY
            spBody->appendChild(spNode2Add);
        }
    }
}


And that's it Smile | :)

Hope this helps,
Andy
GeneralRe: A site for mshtml interface Pin
Member 52815524-May-04 19:50
Member 52815524-May-04 19:50 
GeneralRe: A site for mshtml interface Pin
Andrew Quinn AUS24-May-04 21:50
Andrew Quinn AUS24-May-04 21:50 
GeneralRe: A site for mshtml interface Pin
Member 52815524-May-04 23:38
Member 52815524-May-04 23:38 
GeneralRe: A site for mshtml interface Pin
Member 52815524-May-04 23:38
Member 52815524-May-04 23:38 
GeneralRe: A site for mshtml interface Pin
Andrew Quinn AUS25-May-04 3:28
Andrew Quinn AUS25-May-04 3:28 
GeneralRe: A site for mshtml interface Pin
Member 52815526-May-04 0:30
Member 52815526-May-04 0:30 
GeneralRe: A site for mshtml interface Pin
Member 52815526-May-04 0:45
Member 52815526-May-04 0:45 
GeneralRe: A site for mshtml interface Pin
Andrew Quinn AUS26-May-04 1:45
Andrew Quinn AUS26-May-04 1:45 
GeneralRe: A site for mshtml interface Pin
Member 52815526-May-04 2:38
Member 52815526-May-04 2:38 
GeneralObject shared with several application... Pin
Raphael Kindt23-May-04 23:59
Raphael Kindt23-May-04 23:59 
GeneralRe: Object shared with several application... Pin
Andrew Quinn AUS24-May-04 0:11
Andrew Quinn AUS24-May-04 0:11 
Generaltoolbar button bitmaps Pin
Member 63398323-May-04 23:32
Member 63398323-May-04 23:32 
Questionwhy compile occur error??? Pin
don7cry23-May-04 23:21
don7cry23-May-04 23:21 
AnswerRe: why compile occur error??? Pin
Colin Angus Mackay23-May-04 23:31
Colin Angus Mackay23-May-04 23:31 
GeneralRe: why compile occur error??? Pin
don7cry23-May-04 23:45
don7cry23-May-04 23:45 
GeneralRe: why compile occur error??? Pin
jmkhael24-May-04 7:15
jmkhael24-May-04 7:15 
GeneralRe: why compile occur error??? Pin
David Crow24-May-04 8:51
David Crow24-May-04 8:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.