cs_naoem
Messages postés2Date d'inscriptionmardi 6 avril 2004StatutMembreDernière intervention 7 juillet 2004
-
7 juil. 2004 à 21:06
cs_naoem
Messages postés2Date d'inscriptionmardi 6 avril 2004StatutMembreDernière intervention 7 juillet 2004
-
7 juil. 2004 à 21:52
bonjour,
je m'explique: j'ai fait un programme avec un menu qui ouvre des dialogbox (jusqu'ici tout va bien)...
en mode debug, il n'y a pas de pb, les fenetres s'ouvrent correctement.. des que je passe en mode release, il n'y a plus que les champs qui s'affichent et le background de la fenetre associée est blanc. je me doute que ca vient du style de la fenetre ou bien du handle mais je trouve pas...
BruNews
Messages postés21040Date d'inscriptionjeudi 23 janvier 2003StatutModérateurDernière intervention21 août 2019 7 juil. 2004 à 21:39
et commence aussi par virer le cast (DLGPROC) dans:
DialogBox(hInst, "DP_WRITE_DATA", hWnd, DP_OutSlvProc);
S'il y en a besoin, signe que ta dlgproc est mal prototypee, t'obligera a en mettre une correcte.
case IDC_COMBO_WR_ADDR_SLV:
{
char Index;
if (HIWORD (wParam) == LBN_DBLCLK)
{
/* the same as IDOK */
PostMessage (hDlg,
WM_COMMAND,
IDOK,
(LPARAM) 0);
break;
}
if (HIWORD(lParam) == LBN_SELCHANGE)
{
Index = (char)SendMessage (hComb,
CB_GETCURSEL,
10,
(LPARAM)(LPSTR) CharBuf);
if (Index == CB_ERR)
{
break;
}
SendMessage (hComb,
CB_GETLBTEXT,
Index,
(LPARAM)(LPSTR) CharBuf);
}
break;
}
case IDC_BUTTON_WRITE:
{
/* Get actual string of the edit control */
SendMessage (hComb,
WM_GETTEXT,
10, /* max. text length */
(LPARAM)(LPSTR) CharBuf);
/* Slave address valid ? */
if ( strnicmp((const char far *)CharBuf,
(const char far *)"Slv ",
(size_t) 4 ) != 0)
{
/* invalid string */
MessageBox(hDlg,
(LPSTR) "address is out of range or unknown",
(LPSTR)"wrong slave address!",
MB_OK );
return (result);
}
achHlp = &CharBuf[3];
SlvAdr_l = strtoul ((char far *)&CharBuf[4],&achHlp,10); if ( ((SlvAdr_l 0) && (achHlp &CharBuf[4])) ||
(SlvAdr_l > 125)
)
{
/* invalid string */
MessageBox(hDlg,
(LPSTR) "address is out of range or unknown",
(LPSTR)"wrong slave address!",
MB_OK );
return (result);
}
Slave_add_g = (char)SlvAdr_l;
/* Get output bytes from edit control */
SendMessage (GetDlgItem(hDlg,IDC_DATA_WR),
WM_GETTEXT,
900, /* max. text length */
(LPARAM)(LPSTR) CharBuf);
if (GetStringValue ((char *)Slv_Module[Slave_add_g].buf_2_write ,(char *)CharBuf, (char)OutLen) == 0)
{
MessageBox( hDlg,
(LPSTR) "default value (0) is assumed for all output bytes",
(LPSTR)"Wrong syntax for output bytes!",
MB_OK );
for (i = 0; i < OutLen;i++)
{
Slv_Module[Slave_add_g].buf_2_write[i] = 0;
}
}
Slv_Module[Slave_add_g].nb_octets = OutLen;
/* Set the data to the adressed slave */
Send_Data ();
break;
}
case IDCANCEL:
case IDOK:
{
EndDialog(hDlg,IDOK);
break;
}