一个pdf 编程的问题

welback 2008-06-19 09:42:49
我建立了一个mfc工程,作用是试图在窗口内用 adobe reader打开一个pdf文件,我从文件导入了AcroRd32.dll这个 dll文件
生成了一系列的头文件。就是 reader的 typelib。
之后我构造了 pdf的 app对象如下。
m_pAcroApp = new CCAcroApp;

但是失败了。这个是我捕捉意外事件用的代码
COleException e;
if (!m_pAcroApp->CreateDispatch("AcroExch.App",&e))
{
AfxMessageBox("Failed to create App object :<");
return;
}

确实进入了这步。

然后查看程序发现问题出在
ASSERT(m_lpDispatch == NULL);

// map prog id to CLSID
CLSID clsid;
SCODE sc = AfxGetClassIDFromString(lpszProgID, &clsid);
if (FAILED(sc))
{
if (pError != NULL)
pError->m_sc = sc;
return FALSE;
}

// create with CLSID
return CreateDispatch(clsid, pError);
这里似乎我没有正确的得到 这个对象的clsid。

有谁做过相关的能告诉我一下处理的方法么。

因为之前我导入的adobe pro 的 typelib之后用刚才的方法就可以成功的构造出 app对象。
...全文
604 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
wenabc 2009-11-26
  • 打赏
  • 举报
回复
将AcroExch.App替换为AcroExch.Document试试
bobob 2008-06-20
  • 打赏
  • 举报
回复
http://tech.163.com/06/0628/09/2KMNQ08I00091LRC.html
welback 2008-06-19
  • 打赏
  • 举报
回复
这个是 Cacroapp在ole下面的表示,具体在哪里呢?
[
odl,
uuid(9B4CD3E6-4981-101B-9CA8-9240CE2738AE),
helpstring("The application itself"),
dual,
nonextensible,
oleautomation
]
interface CAcroApp : IDispatch {
[id(0x00000001), helpstring("Exits the Acrobat viewer. Applications should call App.Exit() before exiting.")]
HRESULT Exit([out, retval] VARIANT_BOOL* vbRet);
[id(0x00000002), helpstring("Hides the Acrobat viewer.")]
HRESULT Hide([out, retval] VARIANT_BOOL* vbRet);
[id(0x00000003), helpstring("Shows the Acrobat viewer.")]
HRESULT Show([out, retval] VARIANT_BOOL* vbRet);
[id(0x00000004), helpstring("Closes all open documents. You can close each individual AVDoc by calling AVDoc.Close().")]
HRESULT CloseAllDocs([out, retval] VARIANT_BOOL* vbRet);
[id(0x00000005), helpstring("Executes the menu item whose language-independent menu item name is specified.")]
HRESULT MenuItemExecute(
[in] BSTR szMenuItemName,
[out, retval] VARIANT_BOOL* vbRet);
[id(0x00000006), helpstring("Gets the name of the currently active tool.")]
HRESULT GetActiveTool([out, retval] BSTR* sRet);
[id(0x00000007), helpstring("Sets the active-tool to the tool whose name is specified.")]
HRESULT SetActiveTool(
[in] BSTR szButtonName,
[in] long bPersistent,
[out, retval] VARIANT_BOOL* vbRet);
[id(0x00000008), helpstring("Removes the specified button from the toolbar.")]
HRESULT ToolButtonRemove(
[in] BSTR szButtonName,
[out, retval] VARIANT_BOOL* vbRet);
[id(0x00000009), helpstring("Is the specified toolbar button enabled?")]
HRESULT ToolButtonIsEnabled(
[in] BSTR szButtonName,
[out, retval] VARIANT_BOOL* vbRet);
[id(0x0000000a), helpstring("Removes the menu item whose language-independent menu item is specified.")]
HRESULT MenuItemRemove(
[in] BSTR szMenuItemName,
[out, retval] VARIANT_BOOL* vbRet);
[id(0x0000000b), helpstring("Is the specified menu item enabled?")]
HRESULT MenuItemIsEnabled(
[in] BSTR szMenuItemName,
[out, retval] VARIANT_BOOL* vbRet);
[id(0x0000000c), helpstring("Is the specified menu item marked?")]
HRESULT MenuItemIsMarked(
[in] BSTR szMenuItemName,
[out, retval] VARIANT_BOOL* vbRet);
[id(0x0000000d), helpstring("Gets the number of open AcroExch.AVDocs.")]
HRESULT GetNumAVDocs([out, retval] long* lRet);
[id(0x0000000e), helpstring("Gets an AcroExch.AVDoc by its index in the list of open AVDocs. Use App.GetNumAVDocs () to get the number of AVDocs.")]
HRESULT GetAVDoc(
[in] long lIndex,
[out, retval] IDispatch** ret);
[id(0x0000000f), helpstring("Gets the frontmost document.")]
HRESULT GetActiveDoc([out, retval] IDispatch** ret);
[id(0x00000010), helpstring("Gets a code that specifies which language the Acrobat viewer's user interface is using.")]
HRESULT GetLanguage([out, retval] BSTR* sRet);
[id(0x00000011), helpstring("Locks the Acrobat viewer.")]
HRESULT Lock(
[in] BSTR szLockedBy,
[out, retval] VARIANT_BOOL* vbRet);
[id(0x00000012), helpstring("Obsolete: One should use UnLockEx (szLockedBy As String)")]
HRESULT Unlock([out, retval] VARIANT_BOOL* vbRet);
[id(0x00000013), hidden, helpstring("Deprecated. Use SetPreferenceEx.")]
HRESULT SetPreference(
[in] short nType,
[in] long lValue,
[out, retval] VARIANT_BOOL* vbRet);
[id(0x00000014), hidden, helpstring("Deprecated. Use GetPreferenceEx.")]
HRESULT GetPreference(
[in] short nType,
[out, retval] long* lRet);
[id(0x00000015), helpstring("Maximizes the Acrobat viewer.")]
HRESULT Maximize(
[in] long vbMaximize,
[out, retval] VARIANT_BOOL* vbRet);
[id(0x00000016), helpstring("Sets the window's frame to the specified rectangle.")]
HRESULT SetFrame(
[in] IDispatch* pRect,
[out, retval] VARIANT_BOOL* vbRet);
[id(0x00000017), helpstring("Gets the window's frame.")]
HRESULT GetFrame([out, retval] IDispatch** ret);
[id(0x00000018), helpstring("Minimizes the Acrobat viewer.")]
HRESULT Minimize(
[in] long vbMinimize,
[out, retval] VARIANT_BOOL* vbRet);
[id(0x00000019), helpstring("Restores the Acrobat viewer.")]
HRESULT Restore(
[in] long vbRestore,
[out, retval] VARIANT_BOOL* vbRet);
[id(0x0000001a), helpstring("Unlocks the Acrobat viewer if it was previously locked. Specify the application as a string.")]
HRESULT UnlockEx(
[in] BSTR sLockedBy,
[out, retval] VARIANT_BOOL* vbRet);
[id(0x0000001b), helpstring("method GetInterface")]
HRESULT GetInterface(
[in] BSTR name,
[out, retval] IDispatch** ret);
[id(0x0000001c), helpstring("Sets a value in the preferences file.")]
HRESULT SetPreferenceEx(
[in] short nType,
[in] VARIANT* val,
[out, retval] VARIANT_BOOL* vbRet);
[id(0x0000001d), helpstring("Gets a value from the preferences file.")]
HRESULT GetPreferenceEx(
[in] short nType,
[out, retval] VARIANT* vRet);
};
welback 2008-06-19
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 yjgx007 的回复:]
用OLEVIEW看下主要接口的clsid, progid.
[/Quote]
能说一下具体怎么看么。
我把那个dll打开了用oleview。
但是没看到clsid。在哪个子菜单下呢?
yjgx007 2008-06-19
  • 打赏
  • 举报
回复
用OLEVIEW看下主要接口的clsid, progid.
ToperRay 2008-06-19
  • 打赏
  • 举报
回复
你机器上装的adobe reader的版本与SDK的版本可能不同。。。。。
ToperRay 2008-06-19
  • 打赏
  • 举报
回复
又是你。。。。。。。

15,473

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 进程/线程/DLL
社区管理员
  • 进程/线程/DLL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧