+ Reply to Thread
Results 1 to 2 of 2

Thread: Create a simple thread using WIN32

  1. #1

    Create a simple thread using WIN32

    I would like to know how I can create a simple thread using WIN32. Please note that I am newbie to multi-threading programming. Please provide some simple example.

  2. #2
    Junior Member
    Join Date
    Apr 2012
    Posts
    46
    Use following example:

    Code:
    UINT WINAPI WIN32ThreadFunc(void *pParam)
    {
    	OutputDebugString("Hello World from first WIN32 thread!!\n") ;
    	return 0 ;
    }
    BOOL CDlg::OnInitDialog()
    {
    	CDialog::OnInitDialog();
    	_beginthreadex(NULL, 0, &WIN32ThreadFunc, NULL, 0, NULL) ;
    	return TRUE ;
    }
    You can use _beginthreadex to create a thread. Thread just displays a message in debug output window.

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts