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

C / C++ / MFC

 
GeneralRe: Threads and Messages Pin
Joaquín M López Muñoz21-Oct-02 22:06
Joaquín M López Muñoz21-Oct-02 22:06 
GeneralRe: Threads and Messages Pin
Steen Krogsgaard21-Oct-02 23:34
Steen Krogsgaard21-Oct-02 23:34 
GeneralRe: Threads and Messages Pin
Joaquín M López Muñoz21-Oct-02 23:45
Joaquín M López Muñoz21-Oct-02 23:45 
GeneralRe: Threads and Messages Pin
Steen Krogsgaard21-Oct-02 23:55
Steen Krogsgaard21-Oct-02 23:55 
GeneralRe: Threads and Messages Pin
Joaquín M López Muñoz22-Oct-02 0:19
Joaquín M López Muñoz22-Oct-02 0:19 
GeneralRe: Threads and Messages Pin
Hans Ruck22-Oct-02 0:36
Hans Ruck22-Oct-02 0:36 
GeneralRe: Threads and Messages Pin
Joaquín M López Muñoz22-Oct-02 0:39
Joaquín M López Muñoz22-Oct-02 0:39 
GeneralRe: Threads and Messages Pin
Hans Ruck22-Oct-02 1:01
Hans Ruck22-Oct-02 1:01 
I've created a SDI application with a menu item used to start the worker.

The code:
void CMainFrame::OnFileThread() // menu item
{
  DWORD *th=new DWORD;
  HANDLE h=::CreateThread(NULL, 0, ThreadProc_, m_hWnd,
    0, th);

  Sleep(3000);
  delete th;
}

DWORD WINAPI ThreadProc_(
  LPVOID lpParameter   // thread data
)
{
  MSG msg;

  TRACE("in thread proc\n");
  ::PostMessage((HWND)lpParameter, WM_DUMMY3, 0, 0); // queued
  ::SendMessage((HWND)lpParameter, WM_DUMMY2, 0, 0); // calls Func2, a handler

  return 0;
}

LRESULT CMainFrame::Func2(WPARAM, LPARAM) // treating WM_DUMMY2
{
  MSG msg;

  TRACE("in dummy2\n");
  while (::GetMessage(&msg, NULL, 0, 0))
    if (msg.message==WM_DUMMY3)
    {
      TRACE("found dummy3\n");
      return 0;
    }

  return 0;
}

And the debug output:
in thread proc
in dummy 2
found dummy 3

Due to your obvious programming skills, it should be enough Blush | :O .

rechi
GeneralRe: Threads and Messages Pin
Steen Krogsgaard22-Oct-02 1:40
Steen Krogsgaard22-Oct-02 1:40 
GeneralRe: Threads and Messages Pin
Zdenek Navratil21-Oct-02 23:06
Zdenek Navratil21-Oct-02 23:06 
GeneralRe: Threads and Messages Pin
Neville Franks21-Oct-02 23:32
Neville Franks21-Oct-02 23:32 
GeneralCHtmlView Pin
alex.barylski21-Oct-02 21:08
alex.barylski21-Oct-02 21:08 
GeneralJpeg Pin
Kristian3321-Oct-02 20:42
Kristian3321-Oct-02 20:42 
GeneralRe: Jpeg Pin
Stephane Rodriguez.21-Oct-02 20:46
Stephane Rodriguez.21-Oct-02 20:46 
GeneralRe: Jpeg Pin
Christian Graus21-Oct-02 20:47
protectorChristian Graus21-Oct-02 20:47 
GeneralRe: Jpeg Pin
Christian Graus21-Oct-02 20:47
protectorChristian Graus21-Oct-02 20:47 
GeneralRe: Jpeg Pin
Daniel Turini21-Oct-02 22:04
Daniel Turini21-Oct-02 22:04 
GeneralASSERT in afxwin2.inl, Line 120, Please HELP! Pin
Daniel Strigl21-Oct-02 20:23
Daniel Strigl21-Oct-02 20:23 
GeneralRe: ASSERT in afxwin2.inl, Line 120, Please HELP! Pin
Joaquín M López Muñoz21-Oct-02 20:49
Joaquín M López Muñoz21-Oct-02 20:49 
GeneralMultiDocument Interface Pin
Anonymous21-Oct-02 18:47
Anonymous21-Oct-02 18:47 
GeneralDisable the taskbar process Pin
suresh_sathya21-Oct-02 18:29
suresh_sathya21-Oct-02 18:29 
QuestionHow to get size of maximized? Pin
Soni21-Oct-02 17:56
Soni21-Oct-02 17:56 
AnswerRe: How to get size of maximized? Pin
Carlos Antollini21-Oct-02 19:47
Carlos Antollini21-Oct-02 19:47 
AnswerRe: How to get size of maximized? Pin
Mike Nordell21-Oct-02 20:58
Mike Nordell21-Oct-02 20:58 
GeneralRe: How to get size of maximized? Pin
Soni21-Oct-02 21:12
Soni21-Oct-02 21:12 

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.