title: Win32 Form for dll injection
body: <p>I created a dll with form in it, and when we inject the dll the form open.
  But the problem it when I do it, the process that I injected to, stuck and I can't with him noting.</p>
  
  <p>here what I did.</p>
  
  <pre><code>DWORD WINAPI MessageLoop(HINSTANCE hInstance)
  {
      hWindow = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, DLGPROC(WindowProc));
  
      MSG Msg;
      while(GetMessage(&amp;Msg, 0, 0, 0))
      {
          TranslateMessage(&amp;Msg);
          DispatchMessage(&amp;Msg);
      }
  
      return 0;
  }
  </code></pre>
  
  <p>and the injection:</p>
  
  <pre><code>DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPSTR lpszReserved)
  {
      if(dwReason == DLL_PROCESS_ATTACH)
      {
          CreateThread(0, 0, (LPTHREAD_START_ROUTINE)MessageLoop(hInstance), 0, 0, 0);
      }
  
      return 0;
  }
  </code></pre>
  
  <p>@Remy Lebeau :</p>
  
  <pre><code>DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPSTR lpszReserved)
  {
      if(dwReason == DLL_PROCESS_ATTACH)
      {
          CreateThread(0, 0, &amp;MessageLoop, hInstance, 0, 0);
      }
  
      return 0;
  }
  </code></pre>