楼上大哥能不能说清楚点啊。这个结构我也看过了。
改成:(char*)&ca;
倒是没有错误提示了,可是按钮还是空的啊。
还有啊,对话框的背景图片我也是用的 ca .
背景可以显示。说明ca应该没有问题吧。 感谢两位老大的帮助!
我把程序的主要结构贴一下吧,看是不是其它地方错了。
static BITMAP b_data;
static DLGTEMPLATE DlgMyData =
{
WS_BORDER | WS_CAPTION,
WS_EX_NONE,
0, 0, 300, 280,
"主菜单",
0, 0,
6, NULL,
0
};
static CTRLDATA CtrlMyData[] =
{
{
"button",
WS_CHILD | WS_VISIBLE | BS_BITMAP,
36, 28, 88, 30,
ID_DATA,
&b_data,
0
},
};
static char* prompts [] = {
"日期时间",
"工具",
};
static void m_data (HWND hDlg)
{
char date [1024] = "your data is here";
MessageBox (hDlg,date,"data",MB_OK | WS_HSCROLL | WS_VSCROLL);
}
static void my_notif_proc (HWND hwnd, int id, int nc, DWORD add_data)
{
if (nc == BN_SETFOCUS) {
SetWindowText (GetDlgItem (GetParent (hwnd), ID_PROMPT), prompts [id - ID_DATA]);
}
if (nc == BN_CLICKED) {
if (id == ID_DATA)
m_data(GetParent (hwnd));
}
}
static int DialogBoxProc2 (HWND hDlg, int message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
case MSG_INITDIALOG:
{
int i;
for (i = ID_DATA; i <= ID_TOOL; i++)
SetNotificationCallback (GetDlgItem (hDlg, i), my_notif_proc);
}
return 1;
case MSG_ERASEBKGND:
{
HDC hdc = (HDC)wParam;
const RECT* clip = (const RECT*) lParam;
BOOL fGetDC = FALSE;
RECT rcTemp;
if (hdc == 0) {
hdc = GetClientDC (hDlg);
fGetDC = TRUE;
}
if (clip) {
rcTemp = *clip;
ScreenToClient (hDlg,&rcTemp.left,&rcTemp.top);
ScreenToClient (hDlg,&rcTemp.right,&rcTemp.bottom);
IncludeClipRect (hdc,&rcTemp);
}
FillBoxWithBitmap (hdc,rcTemp.left,rcTemp.top,0,0,&b_data);
if (fGetDC)
ReleaseDC(hdc);
return 0;
}
case MSG_COMMAND:
switch (wParam) {
case IDOK:
case IDCANCEL:
EndDialog (hDlg, wParam);
break;
}
break;
}
return DefaultDialogProc (hDlg, message, wParam, lParam);
}
int MiniGUIMain (int argc, const char* argv[])
{
#ifdef _LITE_VERSION
SetDesktopRect(0, 0, 1024, 768);
#endif
if (LoadBitmap (HDC_SCREEN,&b_data," DATA.jpg")) return 1;
DlgMyData.controls = CtrlMyData;
DialogBoxIndirectParam (&DlgMyData, HWND_DESKTOP, DialogBoxProc2, 0L);
UnloadBitmap (&b_data);
return 0;
}
#ifndef _LITE_VERSION
#include <minigui/dti.c>
#endif
评论