上記処理を Win32 Application で実装 |
|
|
LRESULT CALLBACK About( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
switch( message ) {
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
if( LOWORD(wParam) == IDOK ||
LOWORD(wParam) == IDCANCEL ) {
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
if( LOWORD(wParam) == IDC_BUTTON1 ) {
char szBuffer[128];
GetDlgItemText( hDlg, IDC_EDIT1, szBuffer, 128 );
SendMessage(
GetDlgItem( hDlg, IDC_LIST1),
LB_ADDSTRING,
0L,
(LPARAM)(LPCTSTR)szBuffer
);
}
break;
}
return FALSE;
}
| |
|
|
|
|
#define AddEditToList(dlg,edit,list,size) \
{ \
char szBuffer[size]; \
GetDlgItemText( dlg, edit, szBuffer, size ); \
SendMessage( \
GetDlgItem( dlg, list ), \
LB_ADDSTRING, \
0L, \
(LPARAM)(LPCTSTR)szBuffer \
); \
}
LRESULT CALLBACK About( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
switch( message ) {
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
if( LOWORD(wParam) == IDOK ||
LOWORD(wParam) == IDCANCEL ) {
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
if( LOWORD(wParam) == IDC_BUTTON1 ) {
AddEditToList(hDlg,IDC_EDIT1,IDC_LIST1,128);
}
break;
}
return FALSE;
}
| |
|
|
上記処理を Win32 Application で実装 |
|
|
LRESULT CALLBACK About( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
switch( message ) {
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
if( LOWORD(wParam) == IDOK ||
LOWORD(wParam) == IDCANCEL ) {
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
if( LOWORD(wParam) == IDC_BUTTON1 ) {
char szBuffer[128];
GetDlgItemText( hDlg, IDC_EDIT1, szBuffer, 128 );
SendMessage(
GetDlgItem( hDlg, IDC_LIST1),
LB_INSERTSTRING,
0L,
(LPARAM)(LPCTSTR)szBuffer
);
}
break;
}
return FALSE;
}
| |
|
|
|