初始化adobereader自动化

c++ Initialize Adobe Reader automation

本文关键字:自动化 adobereader 初始化      更新时间:2023-10-16

我有下面显示的代码打开adobe阅读器。我的灵感来自http://www.codeproject.com/Articles/8763/A-simple-wrapper-to-control-Acrobat-Reader-from-yo每次adobe阅读器没有打开,ddeconconnect返回null,所以我得到DDE连接失败。你知道如何帮我连接到adobereader吗?

我必须使用纯c++和win32 api。

iReturn = DdeInitialize(&this->dwIdInst, (PFNCALLBACK)DdeCallback,
        APPCLASS_STANDARD | APPCMD_CLIENTONLY, 0 );
/*Start the DDE server*/
hRet = ShellExecute(0, "open", this->stPdfFileName.c_str(), 0, 0, SW_SHOWNORMAL);
/*Connect to server*/
HSZ hszApp, hszTopic;
char szApp[] = "acroviewR11"; // Also I tried acroviewA11
char szTopic[] = "control";
hszApp = DdeCreateStringHandle(this->dwIdInst, szApp, 0);
hszTopic = DdeCreateStringHandle(this->dwIdInst, szTopic, 0);
this->hConv = DdeConnect(this->dwIdInst, hszApp, hszTopic, NULL);
DdeFreeStringHandle(this->dwIdInst, hszApp);
DdeFreeStringHandle(this->dwIdInst, hszTopic);
if (this->hConv == NULL) {
    printf("DDE Connection Failed.n");
    Sleep(1500);
    DdeUninitialize(this->dwIdInst);
}

我不想只打开文档。我想自动化一些东西,感谢adobereader自动化,如添加的链接上面显示。

我也试过这样的代码:

DdeInitialize(&id, &DDE_ProcessMessage, APPCMD_CLIENTONLY, 0);
hszServerName = DdeCreateStringHandle(id, "Acrobat Search", 0);
hszTopicName = DdeCreateStringHandle(id, "Acrobat Search", 0);
hConv = DdeConnect(id, hszServerName, hszTopicName, NULL);

用"AcroViewR11"代替"AcroViewR11"