<!-- Wanted to avoid copying .css to each folder, so copied default .css from doxyen in here, kicked out most stuff we don't need for examples and modified some a little bit.
Target was having a single html in each example folder which is created from the main.cpp files and needs no files besides some images below media folder.
<p>This example only runs under MS Windows and demonstrates that Irrlicht can render inside a win32 window. MFC and .NET Windows.Forms windows are possible, too.</p>
<p>In the beginning, we create a windows window using the windows API. I'm not going to explain this code, because it is windows specific. See the MSDN or a windows book for details. </p><divclass="fragment"><divclass="line"><spanclass="preprocessor">#include <irrlicht.h></span></div><divclass="line"><spanclass="preprocessor">#ifndef _IRR_WINDOWS_</span></div><divclass="line"><spanclass="preprocessor">#error Windows only example</span></div><divclass="line"><spanclass="preprocessor">#else</span></div><divclass="line"><spanclass="preprocessor">#include <windows.h></span><spanclass="comment">// this example only runs with windows</span></div><divclass="line"><spanclass="preprocessor">#include <iostream></span></div><divclass="line"><spanclass="preprocessor">#include "driverChoice.h"</span></div><divclass="line"><spanclass="preprocessor">#include "exampleHelper.h"</span></div><divclass="line"></div><divclass="line"><spanclass="keyword">using namespace </span>irr;</div><divclass="line"></div><divclass="line"><spanclass="preprocessor">#ifdef _MSC_VER</span></div><divclass="line"><spanclass="preprocessor">#pragma comment(lib, "irrlicht.lib")</span></div><divclass="line"><spanclass="preprocessor">#endif</span></div><divclass="line"></div><divclass="line">HWND hOKButton;</div><divclass="line">HWND hWnd;</div><divclass="line"></div><divclass="line"><spanclass="keyword">static</span> LRESULT CALLBACK CustomWndProc(HWND hWnd, UINT message,</div><divclass="line"> WPARAM wParam, LPARAM lParam)</div><divclass="line">{</div><divclass="line"><spanclass="keywordflow">switch</span> (message)</div><divclass="line"> {</div><divclass="line"><spanclass="keywordflow">case</span> WM_COMMAND:</div><divclass="line"> {</div><divclass="line"> HWND hwndCtl = (HWND)lParam;</div><divclass="line"><spanclass="keywordtype">int</span> code = HIWORD(wParam);</div><divclass="line"></div><divclass="line"><spanclass="keywordflow">if</span> (hwndCtl == hOKButton)</div><divclass="line"> {</div><divclass="line"> DestroyWindow(hWnd);</div><divclass="line"> PostQuitMessage(0);</div><divclass="line"><spanclass="keywordflow">return</span> 0;</div><divclass="line"> }</div><divclass="line"> }</div><divclass="line"><spanclass="keywordflow">break</span>;</div><divclass="line"><spanclass="keywordflow">case</span> WM_DESTROY:</div><divclass="line"> PostQuitMessage(0);</div><divclass="line"><spanclass="keywordflow">return</span> 0;</div><divclass="line"></div><divclass="line"> }</div><divclass="line"></div><divclass="line"><spanclass="keywordflow">return</span> DefWindowProc(hWnd, message, wParam, lParam);</div><divclass="line">}</div></div><!-- fragment --><p> Now ask for the driver and create the Windows specific window. </p><divclass="fragment"><divclass="line"><spanclass="keywordtype">int</span> main()</div><divclass="line">{</div><divclass="line"><spanclass="comment">// ask user for driver</span></div><divclass="line"> video::E_DRIVER_TYPE driverType=driverChoiceConsole();</div><divclass="line"><spanclass="keywordflow">if</span> (driverType==video::EDT_COUNT)</div><divclass="line"><spanclass="keywordflow">return</span> 1;</div><divclass="line"></div><divclass="line"> printf(<spanclass="stringliteral">"Select the render window (some dead window may exist too):\n"</span>\</div><divclass="line"><spanclass="stringliteral">" (a) Window with button (via CreationParam)\n"</span>\</div><divclass="line"><spanclass="stringliteral">" (b) Window with button (via beginScene)\n"</span>\</div><divclass="line"><spanclass="stringliteral">" (c) Own Irrlicht window (default behavior)\n"</span>\</div><divclass="line"><spanclass="stringliteral">" (otherKey) exit\n\n"</span>);</div><d
<p>if (msg.message == WM_QUIT) break; }</p>
<p>advance virtual time device->getTimer()->tick();</p>
<p>draw engine picture driver->beginScene(true, true, 0, (key=='c')?hIrrlichtWindow:0); smgr->drawAll(); driver->endScene(); }</p><divclass="fragment"><divclass="line"> device->closeDevice();</div><divclass="line"> device->drop();</div><divclass="line"></div><divclass="line"><spanclass="keywordflow">return</span> 0;</div><divclass="line">}</div><divclass="line"><spanclass="preprocessor">#endif // if windows</span></div></div><!-- fragment --><p> That's it, Irrlicht now runs in your own windows window. </p>