none
Console App Sendkeys equivalent

    Question

  • I am trying to send keys to Acrobat after opening a password protected pdf. What works in vba:

    s0 = "c:\p\acr6\Acrobat\acrobat.exe "
    s1 = "C:\c\05_others\fraser\mw.pdf"
    s2 = s0 + s1
    tid = Shell(s2, vbNormalFocus)
    ' AppActivate (tid)
    SendKeys "password{ENTER}", True

    I tried to do as a clr2 console app but System::Windows::Forms::SendKeys does not seem to want to be included:

    #include "stdafx.h"

    using namespace System;

    int main(array<System::String ^> ^args)

    { System::Diagnostics::Process ^ pproc;

    System::String ^ s0;System:;String ^ s1;

    s0 = "c:\\p\\acr6\\Acrobat\\acrobat.exe";

    s1 = "c:\\c\\05_others\\fraser\\mw.pdf";

    pproc=System::Diagnostics::Process::Start(s0, s1);

    //?make sure keystrokes going to right window

    //System::Windows::Forms::SendKeys("password{ENTER}");

    return 0;

    }

    Thursday, March 09, 2006 8:44 PM

Answers

  • Add a reference to system.windows.forms.dll either via the IDE, or do this : #using <system.windows.forms.dll>
    Thursday, March 09, 2006 8:53 PM

All replies

  • Add a reference to system.windows.forms.dll either via the IDE, or do this : #using <system.windows.forms.dll>
    Thursday, March 09, 2006 8:53 PM
  • Thanks.

    Now there were a way to use the task id to send the message instead of

    cxx1l=GetWindowText(pwx,cxx1,0x100);

    SetForegroundWindow(pwx);

    System::Windows::Forms::SendKeys::SendWait(spw);

    Friday, March 10, 2006 5:23 PM