Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / C++ [игнор отключен] [закрыт для гостей] / а может нужно что то еще сделать с Dialog - ом / 3 сообщений из 3, страница 1 из 1
09.03.2004, 17:04
    #32435176
zmeyka13
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
а может нужно что то еще сделать с Dialog - ом
Я добавил новую форму ... в ResursView у нее ID: IDD_HWNDTIMER_DIALOG

Устанавливаю таймер:
CDialog dial;
dial.Create(IDD_HWNDTIMER_DIALOG);
dial.SetTimer(0,1000,TimeHandler);
Обработчик таймера:

VOID CALLBACK TimeHandler(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime) // Îáðàáîò÷èê òàéìåðà
{
int ii;
ii=0;
MessageBox("TimeHandler");
}


ну так реакции никакой нет ... MessageBox не выскакивают. может что то с диалогом надо сделать ???
...
Рейтинг: 0 / 0
09.03.2004, 17:19
    #32435205
zmeyka13
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
а может нужно что то еще сделать с Dialog - ом
А если я после этого вызываю

LPVOID lpMsgBuf;

FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
0,
NULL
);

// Display the string.
MsgBox((const char *) lpMsgBuf);

// Free the buffer.
LocalFree( lpMsgBuf );
То начинают MessagBox появлятся .... вот что за бред ........
Может кто знает ........
...
Рейтинг: 0 / 0
10.03.2004, 07:41
    #32435581
rst
rst
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
а может нужно что то еще сделать с Dialog - ом
Вот беда-то :)
Если используешь hwnd - тогда WM_TIMER
Если callback - тогда callback.

А вот и MSDN:

SetTimer
The SetTimer function creates a timer with the specified time-out value.

UINT SetTimer(
HWND hWnd, // handle to window
UINT nIDEvent, // timer identifier
UINT uElapse, // time-out value
TIMERPROC lpTimerFunc // timer procedure
);
Parameters
hWnd
Handle to the window to be associated with the timer. This window must be owned by the calling thread. If this parameter is NULL, no window is associated with the timer and the nIDEvent parameter is ignored.
nIDEvent
Specifies a nonzero timer identifier. If the hWnd parameter is NULL, this parameter is ignored. If the hWnd parameter is not NULL and the window specified by hWnd already has a timer with the value nIDEvent, then the existing timer is replaced by the new timer.
uElapse
Specifies the time-out value, in milliseconds.
lpTimerFunc
Pointer to the function to be notified when the time-out value elapses. For more information about the function, see TimerProc.
If lpTimerFunc is NULL, the system posts a WM_TIMER message to the application queue. The hwnd member of the message's MSG structure contains the value of the hWnd parameter.

Return Values
If the function succeeds, the return value is an integer identifying the new timer. An application can pass this value, or the string identifier, if it exists, to the KillTimer function to destroy the timer.

If the function fails to create a timer, the return value is zero. To get extended error information, call GetLastError.

Remarks
An application can process WM_TIMER messages by including a WM_TIMER case statement in the window procedure or by specifying a TimerProc callback function when creating the timer. When you specify a TimerProc callback function, the default window procedure calls the callback function when it processes WM_TIMER. Therefore, you need to dispatch messages in the calling thread, even when you use TimerProc instead of processing WM_TIMER.

The wParam parameter of the WM_TIMER message contains the value of the nIDEvent parameter.

The timer identifier, nIDEvent, is specific to the associated window. Another window can have its own timer which has the same identifier as a timer owned by another window. The timers are distinct.

Requirements
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in winuser.h.
Import Library: Use user32.lib.


KillTimer
The KillTimer function destroys the specified timer.

BOOL KillTimer(
HWND hWnd, // handle to window
UINT uIDEvent // timer identifier
);
Parameters
hWnd
Handle to the window associated with the specified timer. This value must be the same as the hWnd value passed to the SetTimer function that created the timer.
uIDEvent
Specifies the timer to be destroyed. If the window handle passed to SetTimer is valid, this parameter must be the same as the uIDEvent value passed to SetTimer. If the application calls SetTimer with hWnd set to NULL, this parameter must be the timer identifier returned by SetTimer.
Return Values
If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
The KillTimer function does not remove WM_TIMER messages already posted to the message queue.

Requirements
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in winuser.h.
Import Library: Use user32.lib.
...
Рейтинг: 0 / 0
Форумы / C++ [игнор отключен] [закрыт для гостей] / а может нужно что то еще сделать с Dialog - ом / 3 сообщений из 3, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]