From c4663d678e8b23c79ab640ad01dbf15b8bee520d Mon Sep 17 00:00:00 2001 From: Simon Rit Date: Tue, 17 May 2011 19:18:18 +0200 Subject: [PATCH] Changed entry point of application on Windows to remove background console --- vv/CMakeLists.txt | 11 ++++++----- vv/vv.cxx | 16 +++++++++++++--- 2 files changed, 19 insertions(+), 8 deletions(-) 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"; -- 2.47.1