diff -r bc0ed99e49c7 -r 135920fe441b ui/wpf/UIwrapper/UIwrapper/toolkit.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/wpf/UIwrapper/UIwrapper/toolkit.cpp Sat Jan 24 19:14:29 2015 +0100 @@ -0,0 +1,38 @@ +// Dies ist die Haupt-DLL. + +#include "stdafx.h" +#include + +#include "toolkit.h" + +#using "UIcore.dll" + + +void* ObjectToPtr(Object ^obj) { + GCHandle handle = GCHandle::Alloc(obj); + IntPtr pointer = GCHandle::ToIntPtr(handle); + return pointer.ToPointer(); +} + +Object^ PtrToObject(void *ptr) { + GCHandle h = GCHandle::FromIntPtr(IntPtr(ptr)); + Object^ object = h.Target; + h.Free(); + return object; +} + + +UI_EXPORT void __stdcall UIinit(char *appname) { + UI::Application ^app = UI::Application::GetInstance(); + app->Name = gcnew String(appname); +} + +UI_EXPORT void __stdcall UImain() { + Thread ^thread = UI::Application::GetInstance()->Start(); + thread->Join(); +} + +UI_EXPORT void __stdcall UIshow(void *wptr) { + UI::MainWindow ^window = (UI::MainWindow^)PtrToObject(wptr); + window->ShowWindow(); +}