]> git.tdb.fi Git - libs/core.git/commitdiff
Store hInstance in Application class on win32
authorMikko Rasa <tdb@tdb.fi>
Thu, 27 Dec 2007 17:10:20 +0000 (17:10 +0000)
committerMikko Rasa <tdb@tdb.fi>
Thu, 27 Dec 2007 17:10:20 +0000 (17:10 +0000)
source/core/application.cpp
source/core/application.h
source/core/main.cpp

index c93475fea972e84985f82acfb08fb030018407bd..5acae82242b0a6d4106c7d647460934fd6acae12 100644 (file)
@@ -24,7 +24,7 @@ application throws a UsageError, the static usage() function is called.
 This function can only be called once.  The global main() function provided by
 the library normally does it automatically at program startup.
 */
 This function can only be called once.  The global main() function provided by
 the library normally does it automatically at program startup.
 */
-int Application::run(int argc, char **argv)
+int Application::run(int argc, char **argv, void *data)
 {
        static bool called=false;
        if(called)
 {
        static bool called=false;
        if(called)
@@ -40,6 +40,8 @@ int Application::run(int argc, char **argv)
                return 126;
        }
 
                return 126;
        }
 
+       data_=data;
+
        try
        {
                try
        try
        {
                try
@@ -201,5 +203,6 @@ Application::RegBase::RegBase()
 
 Application *Application::app_=0;
 Application::RegBase *Application::reg_app_=0;
 
 Application *Application::app_=0;
 Application::RegBase *Application::reg_app_=0;
+void *Application::data_=0;
 
 } // namespace Msp
 
 } // namespace Msp
index bd433aafcc3fb16dfd0e0d1bc51c435f6bf5adab..d3b992e17a019321c31579cfb6804178a4d2d2ac 100644 (file)
@@ -20,8 +20,9 @@ class Application
 public:
        virtual ~Application() { }
 
 public:
        virtual ~Application() { }
 
-       static int run(int, char **);
+       static int run(int, char **, void * =0);
        static void usage(const char *, const char *, bool);
        static void usage(const char *, const char *, bool);
+       static void *get_data() { return data_; }
 protected:
        enum LoopMode
        {
 protected:
        enum LoopMode
        {
@@ -70,6 +71,7 @@ private:
 
        static RegBase     *reg_app_;
        static Application *app_;
 
        static RegBase     *reg_app_;
        static Application *app_;
+       static void        *data_;
 
        static void sighandler_(int);
        static void sigalrm_(int) { }
 
        static void sighandler_(int);
        static void sigalrm_(int) { }
index 9fdaba297c7ed8ef7c74b5e22e5d1c9eb289669c..5cf18c3a81222412d8bf61ae8ed724e7b2ff4062 100644 (file)
@@ -11,11 +11,11 @@ Distributed under the LGPL
 #include "application.h"
 
 #ifdef WIN32
 #include "application.h"
 
 #ifdef WIN32
-int APIENTRY WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/, int /*nCmdShow*/)
+int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/, int /*nCmdShow*/)
 { 
        int argc        = 0;
        LPWSTR *argv=CommandLineToArgvW(GetCommandLineW(), &argc);
 { 
        int argc        = 0;
        LPWSTR *argv=CommandLineToArgvW(GetCommandLineW(), &argc);
-       return Msp::Application::run(argc, (char **)argv);
+       return Msp::Application::run(argc, (char **)argv, hInstance);
 }
 #endif
 
 }
 #endif