MSDN > 論壇首頁 > XML Paper Specification (XPS) > XPS Sample Driver question
發問發問
 

已答覆XPS Sample Driver question

  • Friday, 26 June, 2009 20:47rjenovai 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    Hi,

    I am trying to modify xpsdrvsmpl to call another program shortly after the document
    starts to "print". Where would be the best place to place the CreateProcess or ShellExecute
    call so that it only executes once? Thanks

    Randy

解答

  • Thursday, 2 July, 2009 8:24digitalmercenary 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     已答覆
    Hi!

    You can to this in the User Interface DLL. see http://msdn.microsoft.com/en-us/library/bb734121.aspx with the DOCUMENTEVENT_STARTDOC event.

    • 已標示為解答rjenovai Thursday, 22 October, 2009 18:01
    •  
  • Thursday, 22 October, 2009 18:00rjenovai 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     已答覆包含代碼
    I got it to work after adding the following to DOCUMENTEVENT_QUERYFILTER:

    if (pvOut)
                {
                    DOCEVENT_FILTER* pFilter = (DOCEVENT_FILTER*)pvOut;
                    pFilter->cElementsReturned = 6;
                    pFilter->aDocEventCall[0] = DOCUMENTEVENT_ENDDOCPOST;
                    pFilter->aDocEventCall[1] = DOCUMENTEVENT_STARTDOC;
                    pFilter->aDocEventCall[2] = DOCUMENTEVENT_ENDDOC;
                    pFilter->aDocEventCall[3] = DOCUMENTEVENT_STARTPAGE;
                    pFilter->aDocEventCall[4] = DOCUMENTEVENT_ENDPAGE;
                    pFilter->aDocEventCall[5] = DOCUMENTEVENT_XPS_ADDFIXEDDOCUMENTSEQUENCEPOST;
                    *piResult = DOCUMENTEVENT_SUCCESS;
                    ret = DOCUMENTEVENT_SUCCESS;
                   
                }
                else
                {
                    *piResult = DOCUMENTEVENT_UNSUPPORTED;
                    ret = E_NOTIMPL;
                }
    
    I also made sure that piResult was not set as an unreferenced parameter

    Once these were added, the STARTDOC, ENDDOC, etc.. events were fired in windows x64.
    • 已標示為解答rjenovai Thursday, 22 October, 2009 18:01
    •  

所有回覆

  • Thursday, 2 July, 2009 8:24digitalmercenary 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     已答覆
    Hi!

    You can to this in the User Interface DLL. see http://msdn.microsoft.com/en-us/library/bb734121.aspx with the DOCUMENTEVENT_STARTDOC event.

    • 已標示為解答rjenovai Thursday, 22 October, 2009 18:01
    •  
  • Tuesday, 20 October, 2009 19:29rjenovai 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    This worked well until I tried to move my driver to 64-bit vista and windows 7. It appears that the STARTDOC and ENDDOC events
    are not being called. Is this true and if so what can I do to workaround? Thanks

    Randy
  • Thursday, 22 October, 2009 18:00rjenovai 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     已答覆包含代碼
    I got it to work after adding the following to DOCUMENTEVENT_QUERYFILTER:

    if (pvOut)
                {
                    DOCEVENT_FILTER* pFilter = (DOCEVENT_FILTER*)pvOut;
                    pFilter->cElementsReturned = 6;
                    pFilter->aDocEventCall[0] = DOCUMENTEVENT_ENDDOCPOST;
                    pFilter->aDocEventCall[1] = DOCUMENTEVENT_STARTDOC;
                    pFilter->aDocEventCall[2] = DOCUMENTEVENT_ENDDOC;
                    pFilter->aDocEventCall[3] = DOCUMENTEVENT_STARTPAGE;
                    pFilter->aDocEventCall[4] = DOCUMENTEVENT_ENDPAGE;
                    pFilter->aDocEventCall[5] = DOCUMENTEVENT_XPS_ADDFIXEDDOCUMENTSEQUENCEPOST;
                    *piResult = DOCUMENTEVENT_SUCCESS;
                    ret = DOCUMENTEVENT_SUCCESS;
                   
                }
                else
                {
                    *piResult = DOCUMENTEVENT_UNSUPPORTED;
                    ret = E_NOTIMPL;
                }
    
    I also made sure that piResult was not set as an unreferenced parameter

    Once these were added, the STARTDOC, ENDDOC, etc.. events were fired in windows x64.
    • 已標示為解答rjenovai Thursday, 22 October, 2009 18:01
    •