Click here to Skip to main content
15,913,773 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionPreTranslateMessage problem? :( Pin
bosfan24-Feb-12 2:47
bosfan24-Feb-12 2:47 
AnswerRe: PreTranslateMessage problem? :( Pin
Jochen Arndt24-Feb-12 3:14
professionalJochen Arndt24-Feb-12 3:14 
GeneralRe: PreTranslateMessage problem? :( Pin
bosfan24-Feb-12 3:25
bosfan24-Feb-12 3:25 
GeneralRe: PreTranslateMessage problem? :( Pin
David Crow24-Feb-12 4:05
David Crow24-Feb-12 4:05 
GeneralRe: PreTranslateMessage problem? :( Pin
bosfan24-Feb-12 4:33
bosfan24-Feb-12 4:33 
GeneralRe: PreTranslateMessage problem? :( Pin
Jochen Arndt24-Feb-12 5:10
professionalJochen Arndt24-Feb-12 5:10 
GeneralRe: PreTranslateMessage problem? :( Pin
bosfan24-Feb-12 5:25
bosfan24-Feb-12 5:25 
AnswerRe: PreTranslateMessage problem? :( Pin
Member 843817224-Feb-12 4:51
Member 843817224-Feb-12 4:51 
GeneralRe: PreTranslateMessage problem? :( Pin
bosfan24-Feb-12 5:20
bosfan24-Feb-12 5:20 
AnswerRe: PreTranslateMessage problem? :( Pin
Randor 24-Feb-12 10:12
professional Randor 24-Feb-12 10:12 
AnswerRe: PreTranslateMessage problem? :( Pin
JackDingler24-Feb-12 10:56
JackDingler24-Feb-12 10:56 
QuestionHow to fix compile error error C2535 Pin
KASR124-Feb-12 0:06
KASR124-Feb-12 0:06 
AnswerRe: How to fix compile error error C2535 Pin
Code-o-mat24-Feb-12 22:50
Code-o-mat24-Feb-12 22:50 
QuestionHow to create toolbar on the dialog. Pin
appollosputnik23-Feb-12 23:11
appollosputnik23-Feb-12 23:11 
AnswerRe: How to create toolbar on the dialog. Pin
_AnsHUMAN_ 24-Feb-12 1:24
_AnsHUMAN_ 24-Feb-12 1:24 
QuestionRe: How to create toolbar on the dialog. Pin
David Crow24-Feb-12 3:15
David Crow24-Feb-12 3:15 
QuestionOnTimer function is killed automatically when the dialog is closed Pin
shanmugarajaa23-Feb-12 21:50
shanmugarajaa23-Feb-12 21:50 
AnswerRe: OnTimer function is killed automatically when the dialog is closed Pin
Jochen Arndt23-Feb-12 22:21
professionalJochen Arndt23-Feb-12 22:21 
QuestionRe: OnTimer function is killed automatically when the dialog is closed Pin
Richard MacCutchan23-Feb-12 22:24
mveRichard MacCutchan23-Feb-12 22:24 
AnswerRe: OnTimer function is killed automatically when the dialog is closed Pin
shanmugarajaa23-Feb-12 23:28
shanmugarajaa23-Feb-12 23:28 
GeneralRe: OnTimer function is killed automatically when the dialog is closed Pin
Richard MacCutchan23-Feb-12 23:40
mveRichard MacCutchan23-Feb-12 23:40 
AnswerRe: OnTimer function is killed automatically when the dialog is closed Pin
bjorn_ht23-Feb-12 22:29
bjorn_ht23-Feb-12 22:29 
GeneralRe: OnTimer function is killed automatically when the dialog is closed Pin
shanmugarajaa23-Feb-12 23:37
shanmugarajaa23-Feb-12 23:37 
GeneralRe: OnTimer function is killed automatically when the dialog is closed Pin
bjorn_ht24-Feb-12 1:22
bjorn_ht24-Feb-12 1:22 
Create a console app and put this code in to see how it works, then you can adapt "myOnTimer" and the call to ::SetTimer to your code.

C++
#include <windows.h>
#include <iostream>

void CALLBACK myOnTimer(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD tickCount)
{
  std::cout << "Timer. id = " << idEvent << ", tick = " << tickCount << std::endl;
}

int main(int argc, char * argv[])
{
  MSG msg;

  UINT_PTR timerId = ::SetTimer(0, 42, 1000, myOnTimer);

  std::cout << "Timer set, id = " << timerId << std::endl;

  // This is done by MFC in your application but needed for the example.
  while(GetMessage(&msg, 0, 0, 0))
  {
    TranslateMessage(&msg);
    DispatchMessage(&msg);
  }
  return 0;
}

GeneralRe: OnTimer function is killed automatically when the dialog is closed Pin
shanmugarajaa24-Feb-12 1:53
shanmugarajaa24-Feb-12 1:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.