Click here to Skip to main content
13,003,565 members (64,205 online)
Click here to Skip to main content
Add your own
alternative version


12 bookmarked
Posted 3 May 2012

Using the Free CutePDF Writer without User Intervention

, 3 May 2012
Rate this:
Please Sign up or sign in to vote.
This is an alternative for "Using the Free CutePDF Writer without User Intervention"


The free CutePDF utility doesn't allow you to interact with it, the following article will explain how to overcome this limitation. 

Using the code 

The following snippet will illustrate how to get the main thread to press the enter button as soon as the PDF Save File dialogue is shown. 

static extern bool PostMessage(IntPtr hWnd, UInt32 Msg, int wParam, int lParam);
private static void ConfirmPDFDialog()
    bool found = false; //bool to hold if I have found the process yet
    while (!found)
        Process[] processes = Process.GetProcessesByName("CPWSave"); //Grab the PDF Dialog process
        if (processes.Length > 0) //length will be greater than 0 when it has spawned
            if(processes[0].MainWindowHandle != IntPtr.Zero) //If the IntPtr == Zero, the window hasn't been displayed
                IntPtr pFoundWindow = processes[0].MainWindowHandle; //Grab a handle to the window
                PostMessage(pFoundWindow, 0x100, (int)Keys.Enter, 0); //Press the enter key and send the message to the window
                found = true; //Window has been found so exit the while
    //give it some room to breath so that the files are actually created


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Yes, I am the president of America....

You may also be interested in...


Comments and Discussions

QuestionCode in VB.NET Pin
PatTheFrog9-Jul-12 11:44
memberPatTheFrog9-Jul-12 11:44 
AnswerRe: Code in VB.NET Pin
d347hm4n10-Jul-12 2:49
memberd347hm4n10-Jul-12 2:49 

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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170626.1 | Last Updated 3 May 2012
Article Copyright 2012 by d347hm4n
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid