case WM_NOTIFY:
switch(((LPNMHDR)lParam)->code)
{
case NM_RELEASEDCAPTURE:
.........................
return 0;
}
break;
Сообщения от органов управления в диалоговом окне
вобщем у меня вопрос как работать с некоторыми
элементами управления:
у меня в диалоговом окне несколько элементов -
ползунков (IDC_SLIDER1 ... IDC_SLIDER18 ),
и одно поле ввода (IDC_EDIT1).
Но функция диалогового окна пока их сообщения не
обрабатывает, она сейчас такая:
BOOL CALLBACK DlgProc(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
// Инициализация диалоговой панели
case WM_INITDIALOG:
{
return TRUE;
}
case WM_COMMAND:
{
switch(wParam)
{
case IDOK:
case IDCANCEL:
{
EndDialog(hdlg, 0);
return TRUE;
}
}
}
}
return FALSE;
}
Чё нужно добавить в функцию диалогового окна, чтоб
перехватывать сообшения от этих слайдеров, (ну был
ли ползунок сдвинут вперёд или назад) и ну сообщения от поля Edit тоже получать.
Для слайдеров:
NM_RELEASEDCAPTURE
lpnmh = (LPNMHDR) lParam;
Notifies a trackbar control's parent window that the control is releasing mouse capture. This notification is sent in the form of a WM_NOTIFY message.
Код:
для едита:
The EN_CHANGE notification message is sent when the user has taken an action that may have altered text in an edit control. Unlike the EN_UPDATE notification message, this notification message is sent after the system updates the screen. The parent window of the edit control receives this notification message through the WM_COMMAND message.
Код:
case WM_COMMAND:
switch(HIWORD(wParam))
{
case EN_CHANGE:
.........................
return 0;
}
switch(HIWORD(wParam))
{
case EN_CHANGE:
.........................
return 0;
}
MSDN рулит :)
когда я закрываю окно мне надо считать из
полей EDIT то что в них введено, для этого мне
надо послать окну сообщение:
cbText = SendMessage(hEdit, EM_GETLINE, 0,(LPARAM)(LPSTR)chBuff); - а откуда я получу hEdit
если у меня известен только его идентификатор -
IDC_EDIT1???
Цитата:
Originally posted by bave
а откуда я получу hEdit
если у меня известен только его идентификатор -
IDC_EDIT1???
а откуда я получу hEdit
если у меня известен только его идентификатор -
IDC_EDIT1???
The GetDlgItem function retrieves the handle of a control in the specified dialog box.
HWND GetDlgItem(
HWND hDlg, // handle of dialog box
int nIDDlgItem // identifier of control
);
Цитата:
Originally posted by Matush
The GetDlgItem function retrieves the handle of a control in the specified dialog box.
HWND GetDlgItem(
HWND hDlg, // handle of dialog box
int nIDDlgItem // identifier of control
);
The GetDlgItem function retrieves the handle of a control in the specified dialog box.
HWND GetDlgItem(
HWND hDlg, // handle of dialog box
int nIDDlgItem // identifier of control
);
Проще SendDlgItemMessage
Цитата:
Originally posted by craftyfox
Проще SendDlgItemMessage
Проще SendDlgItemMessage
Спасибо, учту :)
Цитата: Matush
The GetDlgItem function retrieves the handle of a control in the specified dialog box.
HWND GetDlgItem(
HWND hDlg, // handle of dialog box
int nIDDlgItem // identifier of control
);
HWND GetDlgItem(
HWND hDlg, // handle of dialog box
int nIDDlgItem // identifier of control
);
Никак не могу найти, как получить идентификатор контрола из его "названия". Т.е. есть у меня, к примеру, IDC_COMBO1. Как из него получить целое значение для GetDlgItem?
Цитата: craftyfox
Проще SendDlgItemMessage
а ещё проще
Код:
UINT GetDlgItemText( HWND hDlg,
int nIDDlgItem,
LPTSTR lpString,
int nMaxCount
);
int nIDDlgItem,
LPTSTR lpString,
int nMaxCount
);
а IDC_COMBO1 это и есть идентификатор контрола. это число. зайди в resource.h и посмотри -- он там задефайнен.
http://msdn2.microsoft.com/en-gb/library/ms645489.aspx
Вот я балбес. Я забыл подключить resource.h