title: _beginthreadex cannot convert from 'overloaded-function'
body: <p>So I was making a function to print text layered across a different window, and I wanted it to be in a separate thread so I can run a timer for the text to display while leaving the user open to continue using the program. However, when I compile I get this error:</p>
  
  <pre><code>error C2664: '_beginthreadex' : cannot convert parameter 3 from 'overloaded-function' to 'unsigned int (__stdcall *)(void *)'
  </code></pre>
  
  <p>Here's the main cpp file:</p>
  
  <pre><code>#include "stdafx.h"
  #include "Trial.h"
  
  int main()
  {
  wchar_t* text = L"Message!";
  HWND hwnd = FindWindowW(0, L"Halo");
  unsigned threadID;
  _beginthreadex(0, 0, DrawText,(void *)(hwnd, 175, 15, text, 8), 0 , &amp;threadID);
  // Other function here
  }
  </code></pre>
  
  <p>And here's the header file Trial.h: (it's a little sloppy, but works fine and since most monitors are around 2ms updates, sleep(2) should help prevent flicker).</p>
  
  <pre><code>#pragma once    
  #include &lt;Windows.h&gt;
  #include &lt;string&gt;
  #include &lt;process.h&gt;
  
  void DrawText(HWND hWnd, float x, float y, wchar_t* mybuffer, float DisplayTime)
  {
  SetForegroundWindow(hWnd);
  HDC hdc = GetDC(hWnd);
  SetBkColor(hdc,RGB(255, 255, 255));                   // While Background color...
  SetBkMode(hdc, TRANSPARENT);                        // Set background to transparent so we don't see the white...
  
  int howmany = sizeof(mybuffer) * 2;
  
  DisplayTime *= 500;
  int p = 0;
  while(p &lt; DisplayTime)
  {
              // Shadow Offset
      SetTextColor(hdc,RGB(0, 0, 0)); 
      TextOut(hdc,x+2,y+2, (LPCWSTR)mybuffer,howmany);
  
      // Primary text
      SetTextColor(hdc,RGB(255, 0, 0));   
      TextOutW(hdc,x,y,(LPCWSTR)mybuffer,howmany);
  
      UpdateWindow(hWnd);
      p++;
      Sleep(2);
  }
  ReleaseDC(hWnd,hdc);
  _endthreadex(0);
  }
  </code></pre>
  
  <p>I've looked through multiple examples, checked the syntax, and made sure that I didn't mess up on _beginthreadex, but can't seem to find the cause of the problem :|</p>