🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #10734

VC to BCB

#10734
From: Greg Stantin
Date: Tue, 23 Mar 2004 00:44
72 lines
2629 bytes
By looking at this function, can someone advise me on how
to use this in bcb?

The *lpUnk is



void CCEditView::SetBgColor( COLORREF color )
{

 IUnknown* lpUnk = m_pSite->GetObjectUnknown();

 if ( lpUnk != NULL )
 {
     HRESULT         hr;

  // Then, request the "document" object from the object
  IHTMLDocument2* pHTMLDocument2;
  hr = lpUnk->QueryInterface(IID_IHTMLDocument2, (void
**)&pHTMLDocument2);
  if ( SUCCEEDED( hr ) )
  {

   // translate the hex color into a string without using the CRT
   int idx;
   WCHAR   buff[8]=L"#000000";
   WCHAR           HEX[17]=L"0123456789ABCDEF";

   for (int i=0;i<3;i++)
   {
    idx = color&0xF;
    buff[2*i+2] = HEX[idx];
    color >>= 4;
    idx = color&0xF;
    buff[2*i+1] = HEX[idx];
    color >>= 4;
   }

   BSTR bstrColor = SysAllocString( buff );

   // Now, set the background color of the body to be equal to
something
   VARIANT varColor;
   varColor.vt = VT_BSTR;
   varColor.bstrVal = bstrColor;
   hr = pHTMLDocument2->put_bgColor( varColor );
   pHTMLDocument2->Release();
  }
 }
}


This is my measly interpretation of it, but i am missing quite a bit.
Its supposed
to change the background color of a DHTML control.  I cant even tell
what
headers it needs too.

        TComInterface<IHTMLDocument2> HTMLDoc;

     // Now, set the background color of the body to be equal to
something
  VARIANT varColor;
        VariantInit(&varColor);

  varColor.vt = VT_BSTR;
        TColorRef rgbV = ColorToRGB(clInfoBk);
        varColor.lVal =
RGB(GetBValue(rgbV),GetGValue(rgbV),GetRValue(rgbV));

        HTMLDoc->put_bgColor(varColor);
        VariantClear(&varColor);
Technical Details
Message-ID: <405f8871$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,2141ad895f4e297f,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-03-22 17:09:41 PST
Reply-To: "Greg Stantin" <gstantin@stantonassoc.com>
From: "Greg Stantin" <gstantin@stantonassoc.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: VC to BCB
Date: Mon, 22 Mar 2004 18:44:55 -0600
Lines: 74
Organization: Stantin Assoc.
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 64.219.221.3
Message-ID: <405f8871$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1080002673 64.219.221.3 (22 Mar 2004 16:44:33 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail