When I tried this<br><a href="http://stackoverflow.com/questions/2139637/hide-console-of-windows-application" target="_blank">http://stackoverflow.com/questions/2139637/hide-console-of-windows-application</a><br><br><ol><li>
<ul><li>replace the following code:</li></ul>

<p><strong>int main(int argc, char <em>argv[])
{
QApplication app(argc, argv);
// your code</em>
}</strong></p>

<p>by</p>

<p><strong>int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, char*, int nShowCmd)
{
int argc = 0;
QApplication app( argc, 0 );</strong></p></li></ol>I havent had console windows, but I cannot close process.<br><br>When I try modified CMakeLists.txt it compile fine (Thanks) but I have had console window :( <br><br>I think it is problem with<br>
<span style="font-family: courier new,monospace;">QObject::killTimers: timers cannot be stopped from another thread</span><br>isnt it?<br>I dont know how to disable it... I dont use timers or threads...<br><br><br><div class="gmail_quote">
2011/4/27 Michael Jackson <span dir="ltr">&lt;<a href="mailto:mike.jackson@bluequartz.net">mike.jackson@bluequartz.net</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">&gt; Las time I had to fight with that, I had to change the name of the &quot;main&quot; function for &quot;WinMain&quot;.<br>
<br>
</div>NO, Ignore that. In your CMakeLists.txt file you need the following set of commands to properly find Qt4 and set it up for use:<br>
<br>
 # ------------------------------------------------------------------------------<br>
   #  Qt 4 Section<br>
   # ------------------------------------------------------------------------------<br>
   # by default only QtCore and QtGui modules are enabled<br>
   # other modules must be enabled like this:<br>
   IF (WIN32)<br>
       SET (QT_USE_QTMAIN TRUE)<br>
   ENDIF (WIN32)<br>
<br>
   # this command finds Qt4 libraries and sets all required variables<br>
   # note that it&#39;s Qt4, not QT4 or qt4<br>
   FIND_PACKAGE( Qt4 REQUIRED )<br>
   # add some useful macros and variables<br>
   # (QT_USE_FILE is a variable defined by FIND_PACKAGE( Qt4 ) that<br>
   # contains a path to CMake script)<br>
   INCLUDE( ${QT_USE_FILE} )<br>
<br>
# Set some Win32 Specific Settings<br>
IF(WIN32)<br>
 SET(GUI_TYPE WIN32)<br>
ENDIF(WIN32)<br>
<br>
<br>
add_executable (MyProgram ${GUI_TYPE}  ${SRCS})<br>
TARGET_LINK_LIBRARIES(MyProgram ${QT_LIBRARIES})<br>
<br>
Cheers<br>
___________________________________________________________<br>
Mike Jackson                      <a href="http://www.bluequartz.net" target="_blank">www.bluequartz.net</a><br>
Principal Software Engineer       <a href="mailto:mike.jackson@bluequartz.net">mike.jackson@bluequartz.net</a><br>
BlueQuartz Software               Dayton, Ohio<br>
<div><div></div><div class="h5"><br>
On Apr 27, 2011, at 9:10 AM, Cyrille Faucheux wrote:<br>
<br>
&gt;<br>
&gt;<br>
&gt; But it was a long time ago, and I was working with GTK...<br>
&gt;<br>
&gt; Take a look at that: <a href="http://stackoverflow.com/questions/2139637/hide-console-of-windows-application" target="_blank">http://stackoverflow.com/questions/2139637/hide-console-of-windows-application</a><br>
&gt;<br>
&gt; Good luck<br>
&gt; Cyrille<br>
&gt;<br>
&gt; Le 27/04/2011 14:46, G G a écrit :<br>
&gt;&gt; When I add WIN32, as you wrote<br>
&gt;&gt;<br>
&gt;&gt; ADD_EXECUTABLE( Application WIN32 ${SRCS} ${UI_SRCS} ${RCC_SRCS})<br>
&gt;&gt;<br>
&gt;&gt; then when I compile solution I get<br>
&gt;&gt;<br>
&gt;&gt; Error    1    error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup    MSVCRT.lib    Application<br>
&gt;&gt; Error    2    fatal error LNK1120: 1 unresolved externals    C:\DP-ITK-APPS\src\my_test\bin\Release\Application.exe    Application<br>
&gt;&gt;<br>
&gt;&gt; I have set window subsystem acording this<br>
&gt;&gt; <a href="http://bobobobo.wordpress.com/2008/01/29/error-lnk2019-error1error-lnk2019-unresolved-external-symbol-_main-referenced-in-function-___tmaincrtstartupmsvcrtdlib/" target="_blank">http://bobobobo.wordpress.com/2008/01/29/error-lnk2019-error1error-lnk2019-unresolved-external-symbol-_main-referenced-in-function-___tmaincrtstartupmsvcrtdlib/</a><br>

&gt;&gt;<br>
&gt;&gt; (I think, that new solution is hasnt to be created?)<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; 2011/4/27 G G &lt;<a href="mailto:greenlander1986@gmail.com">greenlander1986@gmail.com</a>&gt;<br>
&gt;&gt; Thank you, I tried it ;)<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; 2011/4/27 Michael Jackson &lt;<a href="mailto:mike.jackson@bluequartz.net">mike.jackson@bluequartz.net</a>&gt;<br>
&gt;&gt; In your add_executable call in your cmakelists.txt file you need to to<br>
&gt;&gt; set the GUI type to win32. Look at the documentation for cmake to get<br>
&gt;&gt; an idea of what you should write.<br>
&gt;&gt;<br>
&gt;&gt; Mike Jackson<br>
&gt;&gt; <a href="http://Www.bluequartz.net" target="_blank">Www.bluequartz.net</a><br>
&gt;&gt;<br>
&gt;&gt; On Wednesday, April 27, 2011, G G &lt;<a href="mailto:greenlander1986@gmail.com">greenlander1986@gmail.com</a>&gt; wrote:<br>
&gt;&gt; &gt; I have tried it, but I ran console window again :(<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; 2011/4/27 G G &lt;<a href="mailto:greenlander1986@gmail.com">greenlander1986@gmail.com</a>&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Thank you very much, I will try it :)<br>
&gt;&gt; &gt; Do you know some article about it? I wrote some thesis and it would be nice, if I have some reference for it...<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; 2011/4/27 Lodron, Gerald &lt;<a href="mailto:Gerald.Lodron@joanneum.at">Gerald.Lodron@joanneum.at</a>&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Qt runs only in console mode, if you want to hide console<br>
&gt;&gt; &gt; you can write a bat file which starts the exe like this:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; start MyPropgram.exe<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Then the program does not wait for the return value of the<br>
&gt;&gt; &gt; MyProgram.exe console<br>
&gt;&gt; &gt; best regards<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Von: <a href="mailto:vtkusers-bounces@vtk.org">vtkusers-bounces@vtk.org</a><br>
&gt;&gt; &gt; [mailto:<a href="mailto:vtkusers-bounces@vtk.org">vtkusers-bounces@vtk.org</a>] Im Auftrag von G G<br>
&gt;&gt; &gt; Gesendet:<br>
&gt;&gt; &gt; Mittwoch, 27. April 2011 12:57<br>
&gt;&gt; &gt; An: <a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a><br>
&gt;&gt; &gt; Betreff:<br>
&gt;&gt; &gt; [vtkusers] QT + VKT + ITK + VS2008<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Hi I have some project with QT+VTK+ITK and I compile it in Visual<br>
&gt;&gt; &gt; Studio 2008. I create solution with CMake. It works fine. But I compile it and<br>
&gt;&gt; &gt; run. When I run it, I have GUI window and console window. So I have question.<br>
&gt;&gt; &gt; How to disable console window?<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; I think, that it is because of CMake, but<br>
&gt;&gt; &gt; I dont know very well.<br>
&gt;&gt; &gt; I tried to used this<br>
&gt;&gt; &gt; <a href="http://www.qtforum.org/article/18473/tutorial-for-using-qt-with-vtk.html" target="_blank">http://www.qtforum.org/article/18473/tutorial-for-using-qt-with-vtk.html</a><br>
&gt;&gt; &gt; But<br>
&gt;&gt; &gt; when I tried to compile it, it gave me many errors...<br>
&gt;&gt; &gt; Do you know some<br>
&gt;&gt; &gt; complete progress, how to compile it?<br>
&gt;&gt; &gt; Or how to disable console<br>
&gt;&gt; &gt; window?<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; I dont have console window because of it get me qWarning<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; QObject::killTimers: timers cannot be stopped from another<br>
&gt;&gt; &gt; thread<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; when I exit application from console window.<br>
&gt;&gt; &gt; When I exit<br>
&gt;&gt; &gt; application from GUI console window freeze :(<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Thank you all for<br>
&gt;&gt; &gt; help<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; _________________________________________________________<br>
&gt;&gt; Mike Jackson                  <a href="mailto:mike.jackson@bluequartz.net">mike.jackson@bluequartz.net</a><br>
&gt;&gt; BlueQuartz Software                    <a href="http://www.bluequartz.net" target="_blank">www.bluequartz.net</a><br>
&gt;&gt; Principal Software Engineer                  Dayton, Ohio<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Powered by<br>
&gt;&gt; <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Visit other Kitware open-source projects at<br>
&gt;&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Please keep messages on-topic and check the VTK FAQ at:<br>
&gt;&gt; <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt;<br>
&gt;&gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;<br>
&gt; Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</div></div></blockquote></div><br>