diff options
Diffstat (limited to 'src/common.cpp')
-rw-r--r-- | src/common.cpp | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/common.cpp b/src/common.cpp index 9bc1b80..59c7695 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -25,6 +25,10 @@ namespace W32DLib { +static const char *def_msg="Message"; +static const char *def_err="Error"; +static const char *def_qry="Error"; + // ------------------------------------------------------------ // void Common::Initialise() @@ -36,9 +40,19 @@ void Common::Initialise() // ------------------------------------------------------------ // +void Common::MessageTitle(const char *title) +{ + def_msg=title; + def_err=title; + def_qry=title; +} + + +// ------------------------------------------------------------ +// void Common::Message(HWND parent, const char *title, const char *msg) { - ::MessageBox(parent,msg,title ? title:"Message",MB_ICONINFORMATION|MB_OK); + ::MessageBox(parent,msg,title ? title:def_msg,MB_ICONINFORMATION|MB_OK); } @@ -46,7 +60,7 @@ void Common::Message(HWND parent, const char *title, const char *msg) // void Common::Message(HWND parent, const char *title, const std::string& msg) { - ::MessageBox(parent,msg.c_str(),title ? title:"Message", + ::MessageBox(parent,msg.c_str(),title ? title:def_msg, MB_ICONINFORMATION|MB_OK); } @@ -55,7 +69,7 @@ void Common::Message(HWND parent, const char *title, const std::string& msg) // void Common::Error(HWND parent, const char *title, const char *msg) { - ::MessageBox(parent,msg,title ? title:"Error",MB_ICONSTOP|MB_OK); + ::MessageBox(parent,msg,title ? title:def_err,MB_ICONSTOP|MB_OK); } @@ -63,7 +77,7 @@ void Common::Error(HWND parent, const char *title, const char *msg) // void Common::Error(HWND parent, const char *title, const std::string& msg) { - ::MessageBox(parent,msg.c_str(),title ? title:"Error",MB_ICONSTOP|MB_OK); + ::MessageBox(parent,msg.c_str(),title ? title:def_err,MB_ICONSTOP|MB_OK); } @@ -71,7 +85,7 @@ void Common::Error(HWND parent, const char *title, const std::string& msg) // bool Common::Query(HWND parent, const char *title, const char *msg) { - return ::MessageBox(parent,msg,title ? title:"Question", + return ::MessageBox(parent,msg,title ? title:def_qry, MB_ICONQUESTION|MB_YESNO)==IDOK; } @@ -80,7 +94,7 @@ bool Common::Query(HWND parent, const char *title, const char *msg) // bool Common::Query(HWND parent, const char *title, const std::string& msg) { - return ::MessageBox(parent,msg.c_str(),title ? title:"Question", + return ::MessageBox(parent,msg.c_str(),title ? title:def_qry, MB_ICONQUESTION|MB_YESNO)==IDOK; } |