Click here to Skip to main content
15,921,169 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralNever mind... Pin
Ravi Bhavnani25-Jul-02 2:37
professionalRavi Bhavnani25-Jul-02 2:37 
QuestionCan you create two CDialogBars in a frame window? Pin
JohnnyG24-Jul-02 10:28
JohnnyG24-Jul-02 10:28 
GeneralQuestion Mark Handling in ADO Pin
newlogsign24-Jul-02 9:52
newlogsign24-Jul-02 9:52 
QuestionHow do I prevent my application showing a button on the taskbar? Pin
adara24-Jul-02 8:09
adara24-Jul-02 8:09 
AnswerRe: How do I prevent my application showing a button on the taskbar? Pin
Ravi Bhavnani24-Jul-02 10:54
professionalRavi Bhavnani24-Jul-02 10:54 
AnswerRe: How do I prevent my application showing a button on the taskbar? Pin
J Patel24-Jul-02 10:57
J Patel24-Jul-02 10:57 
AnswerRe: How do I prevent my application showing a button on the taskbar? Pin
Paul M Watt24-Jul-02 20:02
mentorPaul M Watt24-Jul-02 20:02 
Generalmethod executing too many times Pin
mgriffith24-Jul-02 8:08
mgriffith24-Jul-02 8:08 
i have 2 methods that are using IWebBrowser2 to execute a print method from a com object that is hosted on a webpage. here is the code for the methods:

---------------------------------

STDMETHODIMP CTemplatePrinter::IEPrintNoPrompt(VARIANT varTemplateURL)
{
CComPtr<iolecontainer> spContainer;
CComPtr<iserviceprovider> spSP;
CComPtr<iwebbrowser2> spWB;
CComPtr<idispatch> spDisp;
CComPtr<ihtmldocument2> spDoc;
CComPtr<iolecommandtarget> spCT;
CComVariant vPTPath = varTemplateURL;


m_spClientSite->GetContainer(&spContainer);
spContainer->QueryInterface(IID_IServiceProvider, (void**)&spSP);
spSP->QueryService(SID_SWebBrowserApp, IID_IWebBrowser, (void**)&spWB);
spWB->get_Document(&spDisp);
spDisp->QueryInterface(IID_IHTMLDocument2, (void**)&spDoc);
spDoc->QueryInterface(IID_IOleCommandTarget, (void**)&spCT);

// ******* THIS IS WHERE IT'S GOING CRAZY!!!! ******* //
spCT->Exec(&CGID_MSHTML, IDM_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, &vPTPath, NULL);

return S_OK;
}


---------------------------------------

STDMETHODIMP CTemplatePrinter::IEPrint(VARIANT varTemplateURL)
{
CComPtr<iolecontainer> spContainer;
CComPtr<iserviceprovider> spSP;
CComPtr<iwebbrowser2> spWB;
CComPtr<idispatch> spDisp;
CComPtr<ihtmldocument2> spDoc;
CComPtr<iolecommandtarget> spCT;
CComVariant vPTPath = varTemplateURL;


m_spClientSite->GetContainer(&spContainer);
spContainer->QueryInterface(IID_IServiceProvider, (void**)&spSP);
spSP->QueryService(SID_SWebBrowserApp, IID_IWebBrowser, (void**)&spWB);
spWB->get_Document(&spDisp);
spDisp->QueryInterface(IID_IHTMLDocument2, (void**)&spDoc);
spDoc->QueryInterface(IID_IOleCommandTarget, (void**)&spCT);

// ***** IT CALLS THIS 2 TIMES? ******** //
spCT->Exec(&CGID_MSHTML, IDM_PRINT, OLECMDEXECOPT_PROMPTUSER, &vPTPath, NULL);

return S_OK;
}
--------------------------

my question is: does anyone have any idea why the IOleCommandTarget::Exec method it going berzerk? when i call the method from a script, the first one keeps spooling pages into the printer, and the second one opens 2 print dialogs in a row...i also have another function for opening a print preview window that works fine....the only difference is my call to Exec is as follows:
spCT->Exec(&CGID_MSHTML, IDM_PRINTPREVIEW, OLECMDEXECOPT_PROMPTUSER, &vPTPath, NULL);

i've tried all that i can see...if i replace spCT->Exec(...) with
spWB->ExecWB(OLECMD_PRINT, OLECMDEXECOPY_PROMPTUSER, &vPTPath, NULL);
it still does the same thing...i've even tryied without passing in the &vPTPath (printing template path) argument

i also know that the method is only getting called once...i tested this by also using spDoc to write some stuff out to pop up a message box every time it got called, and the message box only came up once, but the printing kept going...

any suggestions?
Confused | :confused:


michael griffith
--------------------
mgriffith@lauren.com
mdg12@po.cwru.edu
GeneralFonts Pin
Anonymous24-Jul-02 8:06
Anonymous24-Jul-02 8:06 
Questionerror LNK2001?? Pin
Jh324-Jul-02 7:11
Jh324-Jul-02 7:11 
AnswerRe: error LNK2001?? Pin
Le centriste24-Jul-02 8:03
Le centriste24-Jul-02 8:03 
Generalfind in vector !!! Pin
Hadi Rezaee24-Jul-02 6:31
Hadi Rezaee24-Jul-02 6:31 
GeneralRe: find in vector !!! Pin
Joaquín M López Muñoz24-Jul-02 6:35
Joaquín M López Muñoz24-Jul-02 6:35 
GeneralRe: find in vector !!! Pin
Hadi Rezaee24-Jul-02 7:09
Hadi Rezaee24-Jul-02 7:09 
GeneralRe: find in vector !!! Pin
Phil Boyd24-Jul-02 8:32
Phil Boyd24-Jul-02 8:32 
Generala few questions Pin
NickOne24-Jul-02 6:27
NickOne24-Jul-02 6:27 
GeneralRe: a few questions Pin
Christian Graus24-Jul-02 12:35
protectorChristian Graus24-Jul-02 12:35 
GeneralPrinting a Report Via Microsoft Word Pin
SanShou24-Jul-02 5:59
SanShou24-Jul-02 5:59 
QuestionMultiple Inheritance? Pin
Peter Liddle24-Jul-02 5:58
Peter Liddle24-Jul-02 5:58 
AnswerRe: Multiple Inheritance? Pin
Tomasz Sowinski24-Jul-02 6:28
Tomasz Sowinski24-Jul-02 6:28 
GeneralRe: Multiple Inheritance? Pin
Philippe Mori24-Jul-02 7:55
Philippe Mori24-Jul-02 7:55 
AnswerRe: Multiple Inheritance? Pin
Joaquín M López Muñoz24-Jul-02 6:59
Joaquín M López Muñoz24-Jul-02 6:59 
Generalnewbie question about strcpy and pointers Pin
ns24-Jul-02 5:47
ns24-Jul-02 5:47 
GeneralRe: newbie question about strcpy and pointers Pin
Peter Liddle24-Jul-02 6:00
Peter Liddle24-Jul-02 6:00 
GeneralRe: newbie question about strcpy and pointers Pin
Chris Losinger24-Jul-02 6:01
professionalChris Losinger24-Jul-02 6:01 

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.