有时候需要仿照另一个程序实现一些对话框,比较笨的办法是打开那个程序,照着样子自己在VC里面画啊画。这样的效率实在有点低。
现在有很多工具可以从exe和dll里面取出图片、图片、字符串、对话框等资源。比如ResEdit,在指定include目录之后,可以直接把dialog资源反编译成MFC可用的格式,比如:
//
// Dialog resources
//
LANGUAGE 9, SUBLANG_DEFAULT
1 DIALOG 34, 22, 222, 99
STYLE DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_POPUP | WS_SYSMENU
CAPTION "About My Control"
FONT 10, "System"
{
ICON 1, 65535, 10, 10, 20, 20, SS_ICON, WS_EX_LEFT
LTEXT "My Control 3.35", 65535, 39, 13, 134, 8, SS_LEFT, WS_EX_LEFT
LTEXT "My Inc. 1998", 65535, 39, 37, 160, 8, SS_LEFT, WS_EX_LEFT
DEFPUSHBUTTON "OK", 1, 183, 7, 32, 14, WS_GROUP, WS_EX_LEFT
LTEXT "Email Address: support@mmm.com.cn", 65535, 39, 48, 136, 8, SS_LEFT, WS_EX_LEFT
LTEXT "(Contact us if you have any comment)", 65535, 39, 59, 166, 8, SS_LEFT, WS_EX_LEFT
LTEXT "Web Site (USA): http://www.my.com", 65535, 39, 71, 168, 8, SS_LEFT, WS_EX_LEFT
LTEXT "Web Site (China) : http://www.my.com.cn", 65535, 38, 82, 177, 8, SS_LEFT, WS_EX_LEFT
}
比自己画对话框快了很多。