12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- // TestApp1.cpp : Defines the entry point for the application.
- //
-
- #ifdef _WIN32
- #include "Win32/stdafx.h"
- #endif
-
- #include <DK.h>
-
-
- class TestApp1 : public DKApplication
- {
- DKObject<DKThread> thread;
- public:
- void OnInitialize(void) override
- {
- DKLog("%s", __PRETTY_FUNCTION__);
-
- DKLog("---- SystemPath ----");
- DKLog("SystemRoot: %ls", (const wchar_t*)DefaultPath(SystemPath::SystemRoot));
- DKLog("AppRoot: %ls", (const wchar_t*)DefaultPath(SystemPath::AppRoot));
- DKLog("AppResource: %ls", (const wchar_t*)DefaultPath(SystemPath::AppResource));
- DKLog("AppExecutable: %ls", (const wchar_t*)DefaultPath(SystemPath::AppExecutable));
- DKLog("AppData: %ls", (const wchar_t*)DefaultPath(SystemPath::AppData));
- DKLog("UserHome: %ls", (const wchar_t*)DefaultPath(SystemPath::UserHome));
- DKLog("UserDocuments: %ls", (const wchar_t*)DefaultPath(SystemPath::UserDocuments));
- DKLog("UserPreferences: %ls", (const wchar_t*)DefaultPath(SystemPath::UserPreferences));
- DKLog("UserCache: %ls", (const wchar_t*)DefaultPath(SystemPath::UserCache));
- DKLog("UserTemp: %ls", (const wchar_t*)DefaultPath(SystemPath::UserTemp));
- DKLog("---- ProcessInfo ----");
- DKLog("HostName: %ls", (const wchar_t*)ProcessInfoString(ProcessInfo::HostName));
- DKLog("OsName: %ls", (const wchar_t*)ProcessInfoString(ProcessInfo::OsName));
- DKLog("UserName: %ls", (const wchar_t*)ProcessInfoString(ProcessInfo::UserName));
- DKLog("ModulePath: %ls", (const wchar_t*)ProcessInfoString(ProcessInfo::ModulePath));
-
- thread = DKThread::Create(DKFunction([this]()
- {
- DKLog("Running new thread!");
- this->EventLoop()->Post(DKFunction([&]()
- {
- DKLog("test1");
- })->Invocation(), 2);
- this->EventLoop()->Post(DKFunction([&]()
- {
- DKLog("test2");
- })->Invocation(), 4);
- this->EventLoop()->Post(DKFunction([&]()
- {
- DKLog("Terminate!!");
- DKApplication::Instance()->Terminate(0);
- })->Invocation(), 10);
-
- })->Invocation());
- }
- void OnTerminate(void) override
- {
- DKLog("%s", __PRETTY_FUNCTION__);
- DKLog("Waiting for worker thread!");
- thread->WaitTerminate();
- }
- };
-
-
- #ifdef _WIN32
- int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
- _In_opt_ HINSTANCE hPrevInstance,
- _In_ LPWSTR lpCmdLine,
- _In_ int nCmdShow)
- #else
- int main(int argc, const char * argv[])
- #endif
- {
- TestApp1 app;
- DKPropertySet::SystemConfig().SetValue("AppDelegate", "AppDelegate");
- return app.Run();
- }
|