title: Visual Studio: Display Form Application through native DLL call with CLR support
body: <h2><strong>Scenario:</strong></h2>
  
  <ol>
  <li>Creating a windows form application (App-1) in C# which sits on the System Tray</li>
  <li>Creating a native unmanaged C++ DLL (App-2) to control the windows form application such as:
  <ul>
  <li>Bring up/minimize the App-1 application from/to System Tray</li>
  <li>Provide input and perform action on the App-1</li>
  </ul></li>
  <li>Creating a console application (App-3) to test the App-2 application</li>
  </ol>
  
  <h2><strong>Solution:</strong></h2>
  
  <p>App-1:
  I created a simple windows form application using Visual Studio 2010 in C# and generate exe. It runs without problem.</p>
  
  <p>In order to control this application through another DLL, then I converted this application output as DLL instead of EXE.</p>
  
  <p>App-2:
  I created a simple Win32 C++ DLL application and enabled /CLR feature as ON. The reason is that only with this option I can managed to perform import of the code from App-1, such as follows:</p>
  
  <pre><code>#include "stdafx.h"
  
  #include "FormlessStarter.h"
  
  #include &lt;stdexcept&gt;
  
  #using &lt;mscorlib.dll&gt;
  #using &lt;FormlessSysTry.dll&gt;
  
  using namespace FormlessSysTry;         //this does not work with /CLR option OFF
  
  void __stdcall FormlessStart()
  {
      FormlessSysTry::Program::Main();  //this is to call the App-1
  }
  </code></pre>
  
  <p>App-3:
  Create a console application to call the FormlessStart() function from the App-2 as simple as below:</p>
  
  <pre><code>#include "FormlessStarter.h"
  int _tmain(int argc, _TCHAR* argv[])
  {
  FormlessStart();
  return 0;
  }
  </code></pre>
  
  <h2><strong>Problem:</strong></h2>
  
  <p>When I tried to build the App-3, I always encounter error as below and unable to figure it out:
      DllTest.obj : error LNK2019: unresolved external symbol _FormlessStart@0 referenced in function _wmain</p>
  
  <p>Any idea why it's failing?
  Is this the correct way to achieve my scenario?</p>
  
  <h2>Updated:</h2>
  
  <p>Actually I have a third party windows application which is not accepting managed dll only unmanaged dll. What I wanted to do is having a new windows form application minimized in the system tray which responsible in submitting data to my website. And I'd like to pass the data from the third party application upon an event. And the third application only can call unmanaged DLL. Therefore, I wanted to create the form application as unmanaged DLL which is going to be started by the third party application during its initialization. Once the form application started it has to sit on the System tray. Whenever an even on the third party app is satisfied, it should bring the form application to allow the user to interact with it before submitting the data. Hope my description is clear and apologies for my English.</p>