level 11
gameloftyou
楼主
LRESULT MyDialogBox(HWND hwndParent,
char *title,
int x,
int y,
int cx,
int cy,DLGPROC DialogProc,DWORD dwStyle,DWORD dwExStyle)
{
HGLOBAL hgbl;
LPDLGTEMPLATE lpdt;
LPWORD lpw;
LRESULT result;
int charw,charh,len;
charw = LOWORD(GetDialogBaseUnits());
charh = HIWORD(GetDialogBaseUnits());
hgbl = GlobalAlloc(GMEM_ZEROINIT,1024);
if(!hgbl)
return -1;
lpdt = (LPDLGTEMPLATE)GlobalLock(hgbl);
lpdt->dwExtendedStyle = dwExStyle;
lpdt->style = dwStyle;
lpdt->cdit = 0;
lpdt->x = x*4/charw;
lpdt->y = y*8/charh;
lpdt->cx = cx*4/charw;
lpdt->cy = cy*8/charh;
lpw = (LPWORD)(lpdt+1);//这句看不懂
*lpw++ = 0;
*lpw++ = 0;
len = MultiByteToWideChar(CP_ACP,0,title,-1,NULL,0);
MultiByteToWideChar(CP_ACP,0,title,-1,(LPWSTR)lpw,len);
GlobalUnlock(hgbl);
result = DialogBoxIndirect(hInst,(LPDLGTEMPLATE)hgbl,hwndParent,DialogProc);
GlobalFree(hgbl);
return result;
}
这个是照着msdn的例子我自己改的,lpw = (LPWORD)(lpdt+1);这句看不懂,求解释= =||
2012年11月09日 15点11分
1
char *title,
int x,
int y,
int cx,
int cy,DLGPROC DialogProc,DWORD dwStyle,DWORD dwExStyle)
{
HGLOBAL hgbl;
LPDLGTEMPLATE lpdt;
LPWORD lpw;
LRESULT result;
int charw,charh,len;
charw = LOWORD(GetDialogBaseUnits());
charh = HIWORD(GetDialogBaseUnits());
hgbl = GlobalAlloc(GMEM_ZEROINIT,1024);
if(!hgbl)
return -1;
lpdt = (LPDLGTEMPLATE)GlobalLock(hgbl);
lpdt->dwExtendedStyle = dwExStyle;
lpdt->style = dwStyle;
lpdt->cdit = 0;
lpdt->x = x*4/charw;
lpdt->y = y*8/charh;
lpdt->cx = cx*4/charw;
lpdt->cy = cy*8/charh;
lpw = (LPWORD)(lpdt+1);//这句看不懂
*lpw++ = 0;
*lpw++ = 0;
len = MultiByteToWideChar(CP_ACP,0,title,-1,NULL,0);
MultiByteToWideChar(CP_ACP,0,title,-1,(LPWSTR)lpw,len);
GlobalUnlock(hgbl);
result = DialogBoxIndirect(hInst,(LPDLGTEMPLATE)hgbl,hwndParent,DialogProc);
GlobalFree(hgbl);
return result;
}
这个是照着msdn的例子我自己改的,lpw = (LPWORD)(lpdt+1);这句看不懂,求解释= =||