K
Gibts es eine Möglichkeit, die Größe der ComboBoxen "dynamisch" zu erstellen, damit man nicht selber immer rumprobieren muss,
Bin grade am Rum Probieren...
char templ[1000];
char *Even4(char *s)
{
unsigned long l;
l = (long)s;
l = (l+3)&~3;
return (char *)l;
}
char *CopyWide(short *dest, char *src)
{
do
*dest++ = *src;
while(*src++);
return (char *)dest;
}
void CreatTempl(void)
{
DLGTEMPLATE *dlgt;
DLGITEMTEMPLATE *dlgit;
char *s;
dlgt = (DLGTEMPLATE *)templ;
dlgt->style = WS_SYSMENU;
dlgt->dwExtendedStyle = 0;
dlgt->cdit = 1;
dlgt->x = 10;
dlgt->y = 10;
dlgt->cx = 200;
dlgt->cy = 200;
s = (char *)(dlgt+1);
s += 2;/* menu */
s += 2;/* class */
/*s += 2;*//* title */
s = CopyWide((short *)s, "Schweine im Weltall");
s = Even4(s);
dlgit = (DLGITEMTEMPLATE *)s;
dlgit->style = WS_CHILD | WS_VISIBLE;
dlgit->dwExtendedStyle = 0;
dlgit->x = 10;
dlgit->y = 10;
dlgit->cx = 40;
dlgit->cy = 40;
dlgit->id = 20;
s = (char *)(dlgit+1);
/*s += 2;*//* class */
s = CopyWide((short *)s, "button");
/*s += 2;*//* title */
s = CopyWide((short *)s, "OK");
s += 2;/* dsize */
}
int _stdcall dialogproc(HWND hwnd, unsigned int message, unsigned int wParam, long lParam)
{
switch(message)
{ case WM_INITDIALOG:
return 1;
case WM_KEYDOWN:
EndDialog(hwnd, 28);
return 1;
case WM_COMMAND:
EndDialog(hwnd, 30);
return 1;
}
useparms(0, wParam, lParam);
return 0;
}
void DoDialogBox(HWND hwnd)
{
CreatTempl();
ReturnValue = DialogBoxIndirectParam(hInstGlobal, (DLGTEMPLATE *)templ, hwnd,
dialogproc, 0);
}