From: Simon Rit Date: Tue, 17 May 2011 17:18:18 +0000 (+0200) Subject: Changed entry point of application on Windows to remove background console X-Git-Tag: v1.2.1~24 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=c4663d678e8b23c79ab640ad01dbf15b8bee520d;p=clitk.git Changed entry point of application on Windows to remove background console --- diff --git a/vv/CMakeLists.txt b/vv/CMakeLists.txt index d38a79e..e9cd2d2 100644 --- a/vv/CMakeLists.txt +++ b/vv/CMakeLists.txt @@ -181,10 +181,6 @@ INCLUDE_DIRECTORIES( ../segmentation ) -IF(WIN32) - SET(EXE_ICON vvIcon.rc) -ENDIF(WIN32) - LINK_DIRECTORIES(${QT_LIBRARY_DIR}) #========================================================= #Add each tool's dependencies @@ -203,7 +199,12 @@ SET(vvExternalLibs clitkSegmentationGgoLib clitkDicomRTStruct ${toolLibs} ${foun ADD_LIBRARY(vvLib ${vv_SRCS} ${vv_UI_CXX}) TARGET_LINK_LIBRARIES(vvLib ${vvExternalLibs}) -ADD_EXECUTABLE(vv vv.cxx ${EXE_ICON}) +IF(WIN32) + ADD_EXECUTABLE(vv WIN32 vv.cxx vvIcon.rc) +ELSE(WIN32) + ADD_EXECUTABLE(vv vv.cxx) +ENDIF(WIN32) + TARGET_LINK_LIBRARIES(vv vvLib) diff --git a/vv/vv.cxx b/vv/vv.cxx index 2a68f33..0bfc01e 100644 --- a/vv/vv.cxx +++ b/vv/vv.cxx @@ -38,7 +38,7 @@ #include #include -#include +#include void load_image_first_error() { @@ -61,8 +61,16 @@ std::string create_timed_string() } //------------------------------------------------------------------------------ +#ifdef _WIN32 +int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE prevInstance, LPSTR lpCmdLine, int nShowCmd) +{ + int argc = __argc; + char **argv = __argv; +#else int main( int argc, char** argv ) { +#endif + CLITK_INIT; QApplication app( argc, argv ); @@ -129,9 +137,11 @@ int main( int argc, char** argv ) if(itksys::SystemTools::FileExists(log_dir.c_str()) && !itksys::SystemTools::FileIsDirectory(log_dir.c_str())) { - itkGenericExceptionMacro(<< "Error creating log directory, file exists and is not a directory."); + std::cerr << "Error creating log directory, file exists and is not a directory." << std::endl; + exit(1); } else if(!itksys::SystemTools::MakeDirectory(log_dir.c_str())) { - itkGenericExceptionMacro(<< "Error creating log directory."); + std::cerr << "Error creating log directory." << std::endl; + exit(1); } std::string log_file = log_dir + "/" + create_timed_string() + ".log";