diff --git a/progress.cpp b/progress.cpp index a1ac09f..3fb6cb1 100644 --- a/progress.cpp +++ b/progress.cpp @@ -100,7 +100,7 @@ void ProgressBar::print( int perc ) { #ifndef _WIN32 static_cast< ProgressWindow * >( ptr )->setPerc( perc ); #else - PostMessage( ptr, WM_APP, 0, perc ); + SendMessage( (HWND)ptr, WM_APP, PROGRESS_PERC, perc ); #endif } @@ -108,7 +108,7 @@ void ProgressBar::print( const string &t ) { #ifndef _WIN32 static_cast< ProgressWindow * >( ptr )->setLabel( t ); #else - PostMessage( ptr, WM_APP, 1, ( LPARAM )t.c_str() ); + SendMessage( (HWND)ptr, WM_APP, PROGRESS_STRING, ( LPARAM )t.c_str() ); #endif } @@ -116,7 +116,7 @@ ProgressBar::~ProgressBar() { #ifndef _WIN32 static_cast< ProgressWindow * >( ptr )->hide(); #else - PostMessageW( ptr, WM_APP, 2, 0 ); + SendMessage( (HWND)ptr, WM_CLOSE, 0, 0 ); #endif } diff --git a/progress.hpp b/progress.hpp index c8e4673..332094d 100644 --- a/progress.hpp +++ b/progress.hpp @@ -10,6 +10,9 @@ using string = std::wstring; using string = std::string; #endif +#define PROGRESS_PERC 0x4000 +#define PROGRESS_STRING 0x4001 + class ProgressBar { public: #ifndef GUI @@ -19,11 +22,7 @@ public: #ifndef _WIN32 ProgressBar( void *pw ) : ptr( pw ){}; #else - ProgressBasr( void *hwnd_in ) { - while ( *hwnd_in == nullptr ) - sleep( 50 ); - ptr = *hwnd_in; - }; + ProgressBar( void *hwnd ) : ptr( hwnd ){}; #endif // _WIN32 ~ProgressBar(); #endif // GUI