关于DLL中创建 非模态对话框 的问题。

Bors 2003-11-27 07:13:35
我要使用的一个DLL中要创建一个非模态对话框,我只能拿到该对话框的句柄。

是不是应该在主程序中为他加一个IsDialogMessage(hDLLDialog,&msg);
主程序是MFC框架的,这个东西应该加在哪里?
高人指点一下。谢了。
...全文
159 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
farfh 2003-11-30
  • 打赏
  • 举报
回复
如果只是一个dialog窗口,应该是不需要的,因为IsDialogMessage跟TranslateMessage等函数的功能是差不多的(MSDN好象是这么解释的,我从来没用过,楼主最好自己做实验^_^),除非消息循环是你自己来写的.在MFC中好象没见有哪儿有调用这个函数,楼主最好跟踪看一下MFC的代码就很清楚了.
kof99th 2003-11-28
  • 打赏
  • 举报
回复
mfc的CDialog实现里的PreTranslateMessage()已经有了IsDialogMessage()。
你想干什么?
osborn 2003-11-28
  • 打赏
  • 举报
回复
没明白,楼主想做什么.
sinhighly 2003-11-28
  • 打赏
  • 举报
回复
CreateDialogParam和CopyHandle是什么东东?
fayifu 2003-11-28
  • 打赏
  • 举报
回复
主程序需要对话框返回的数据吗?还是简单的调用对话框时主程序传递相关参数给对话框应行?
Bors 2003-11-28
  • 打赏
  • 举报
回复
不是要实现什么。

看了半天的MFC源码,具体在哪里加入::IsDialogMessage(hDLLDialog,&msg),我已经比较清楚了。就是想问一下,这种情况是不是需要在主消息循环加::IsDialogMessage(hDLLDialog,&msg)?
farfh 2003-11-28
  • 打赏
  • 举报
回复
没有搞懂楼主到底想实现什么东西,呵呵,随便贴了个该函数的用法^_^
farfh 2003-11-28
  • 打赏
  • 举报
回复
CWnd::IsDialogMessage
This method determines whether the specified message is intended for a modeless dialog box. If it is, this method processes the message. When the IsDialogMessage function processes a message, it checks for keyboard messages and converts them to selection commands for the corresponding dialog box. For example, the TAB key selects the next control or group of controls, and the DOWN ARROW key selects the next control in a group.

You must not pass a message processed by IsDialogMessage to the TranslateMessage or DispatchMessage Windows CE functions, because it has already been processed.

BOOL IsDialogMessage(
LPMSG lpMsg );
Parameters
lpMsg
Points to an MSG structure that contains the message to be checked.
Return Value
Specifies whether the method has processed the given message. It is nonzero if the message has been processed; otherwise, it is zero. If the return is 0, call the CWnd::PreTranslateMessage method of the base class to process the message. In an override of the CWnd::PreTranslateMessage method the code looks like this :

BOOL CMyDlg::PreTranslateMessage( msg )
{
if( IsDialogMessage( msg ) )
return TRUE;
else
return CWnd::PreTranslateMessage( msg );
}

Requirements
Windows CE versions: 1.0 and later
Header file: Declared in Afxwin.h
Platform: H/PC Pro, Palm-size PC, Pocket PC

See Also
CWnd::PreTranslateMessage

Bors 2003-11-28
  • 打赏
  • 举报
回复
解释一下。
该DLL是一个类似插件的东东。该DLL自己用纯Winapi的CreateDialogParam创建一个非模态对话框,用来设置其自身的一些数据参数(有点像Winamp的Plugins的工作方式)。主程序不需要知道这些具体参数。

我的主程序是MFC写的,我想是应该手动加入::IsDialogMessage(hDLLDialog,&msg);到程序的主消息循环的。

===============================
TO:kof99th(小虫)
MFC自己怎么会找第三方的一个对话框的句柄。MFC的IsDialogMessage(MSG)最后是要走到WINAPI的::IsDialogMessage(m_hWnd, lpMsg);他都不知道该对话框的句柄,如何正确的把::IsDialogMessage()加入主消息循环。
Bors 2003-11-27
  • 打赏
  • 举报
回复
IsDialogMessage()应该放在那里,是不是在CMyWinApp::PreTranslateMessage()

我是刚从C++Builder转到VC的,MFC框架不是很熟。

BTW:据我了解该对话框是用CreateDialogParam()创建的。
hahu 2003-11-27
  • 打赏
  • 举报
回复
有一个想法
用CopyHandle把这个句柄复制成全局不知道行不行

15,979

社区成员

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

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