Click here to Skip to main content
15,909,539 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralC++ Datatypes and OS Datatypes :: C++ Pin
valikac7-Dec-02 8:40
valikac7-Dec-02 8:40 
GeneralRe: C++ Datatypes and OS Datatypes :: C++ Pin
Alvaro Mendez7-Dec-02 10:23
Alvaro Mendez7-Dec-02 10:23 
GeneralRe: C++ Datatypes and OS Datatypes :: C++ Pin
Maximilien7-Dec-02 10:41
Maximilien7-Dec-02 10:41 
GeneralRe: C++ Datatypes and OS Datatypes :: C++ Pin
Michael Dunn7-Dec-02 14:23
sitebuilderMichael Dunn7-Dec-02 14:23 
GeneralRe: C++ Datatypes and OS Datatypes :: C++ Pin
Nemanja Trifunovic7-Dec-02 16:53
Nemanja Trifunovic7-Dec-02 16:53 
GeneralRe: C++ Datatypes and OS Datatypes :: C++ Pin
Gary R. Wheeler8-Dec-02 2:33
Gary R. Wheeler8-Dec-02 2:33 
GeneralPrinting HTML progmatically Pin
Darroll Walsh7-Dec-02 1:13
Darroll Walsh7-Dec-02 1:13 
GeneralRe: Printing HTML progmatically Pin
Gary Wheeler7-Dec-02 4:58
Gary Wheeler7-Dec-02 4:58 
I've got a control derived from the browser. My printing code looks like this -
HRESULT hr;

BSTR        header_BSTR = ::SysAllocString(L"&w&b&b&p");
VARIANT     header_variant;

VariantInit(&header_variant);
V_VT(&header_variant)   = VT_BSTR;
V_BSTR(&header_variant) = header_BSTR;

BSTR        footer_BSTR = ::SysAllocString(L"&d &t");
VARIANT     footer_variant;

VariantInit(&footer_variant);
V_VT(&footer_variant)   = VT_BSTR;
V_BSTR(&footer_variant) = footer_BSTR;

long index;

SAFEARRAYBOUND  parameter_array_bound[1];
SAFEARRAY       *parameter_array = NULL;

parameter_array_bound[0].cElements = 2;
parameter_array_bound[0].lLbound   = 0;

parameter_array = SafeArrayCreate(VT_VARIANT,1,parameter_array_bound);

index = 0;
hr = SafeArrayPutElement(parameter_array,&index,&header_variant);

index = 1;
hr = SafeArrayPutElement(parameter_array,&index,&footer_variant);

VARIANT parameter;
VariantInit(&parameter);
V_VT(&parameter)    = VT_ARRAY | VT_BYREF;
V_ARRAY(&parameter) = parameter_array;

hr = _Browser->ExecWB(OLECMDID_PRINT,OLECMDEXECOPT_DONTPROMPTUSER,&parameter,NULL);

if (!SUCCEEDED(hr)) {
    VariantClear(&header_variant);
    VariantClear(&footer_variant);
    if (parameter_array != NULL) {
        SafeArrayDestroy(parameter_array);
    }
}
This code sets the header and footer for the page and then prints it. The _Browser value points to the IWebBrowser2 interface for the control. If I remember correctly, I found this stuff in an example in the MSDN.


Software Zen: delete this;
GeneralCString Vs std::string Pin
Anonymous7-Dec-02 0:34
Anonymous7-Dec-02 0:34 
GeneralRe: CString Vs std::string Pin
Nitron7-Dec-02 4:37
Nitron7-Dec-02 4:37 
GeneralRe: CString Vs std::string Pin
Roman Fadeyev7-Dec-02 5:01
Roman Fadeyev7-Dec-02 5:01 
GeneralRe: CString Vs std::string Pin
Michael Dunn7-Dec-02 5:56
sitebuilderMichael Dunn7-Dec-02 5:56 
GeneralRe: CString Vs std::string Pin
Nemanja Trifunovic7-Dec-02 17:25
Nemanja Trifunovic7-Dec-02 17:25 
GeneralMIN/MAX values of Datatypes Pin
Anonymous7-Dec-02 0:30
Anonymous7-Dec-02 0:30 
GeneralRe: MIN/MAX values of Datatypes Pin
geo_m7-Dec-02 2:09
geo_m7-Dec-02 2:09 
GeneralFile Properties in Windows 2000 Pin
Bats7-Dec-02 0:15
Bats7-Dec-02 0:15 
GeneralRe: File Properties in Windows 2000 Pin
Anonymous7-Dec-02 1:29
Anonymous7-Dec-02 1:29 
GeneralRe: File Properties in Windows 2000 Pin
Anonymous7-Dec-02 1:40
Anonymous7-Dec-02 1:40 
GeneralRe: File Properties in Windows 2000 Pin
Anonymous7-Dec-02 1:52
Anonymous7-Dec-02 1:52 
General* versus ** Pin
verbatin6-Dec-02 23:28
verbatin6-Dec-02 23:28 
GeneralRe: * versus ** Pin
Christian Graus7-Dec-02 0:20
protectorChristian Graus7-Dec-02 0:20 
GeneralRe: * versus ** Pin
verbatin7-Dec-02 4:10
verbatin7-Dec-02 4:10 
GeneralRe: * versus ** Pin
Anonymous7-Dec-02 0:34
Anonymous7-Dec-02 0:34 
GeneralRe: * versus ** Pin
Nitron7-Dec-02 4:46
Nitron7-Dec-02 4:46 
GeneralRe: * versus ** Pin
Alvaro Mendez7-Dec-02 9:28
Alvaro Mendez7-Dec-02 9:28 

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.