ui/wpf/UIwrapper/UIwrapper/toolkit.cpp

changeset 78
135920fe441b
child 81
5eb765a7a793
equal deleted inserted replaced
77:bc0ed99e49c7 78:135920fe441b
1 // Dies ist die Haupt-DLL.
2
3 #include "stdafx.h"
4 #include <stdio.h>
5
6 #include "toolkit.h"
7
8 #using "UIcore.dll"
9
10
11 void* ObjectToPtr(Object ^obj) {
12 GCHandle handle = GCHandle::Alloc(obj);
13 IntPtr pointer = GCHandle::ToIntPtr(handle);
14 return pointer.ToPointer();
15 }
16
17 Object^ PtrToObject(void *ptr) {
18 GCHandle h = GCHandle::FromIntPtr(IntPtr(ptr));
19 Object^ object = h.Target;
20 h.Free();
21 return object;
22 }
23
24
25 UI_EXPORT void __stdcall UIinit(char *appname) {
26 UI::Application ^app = UI::Application::GetInstance();
27 app->Name = gcnew String(appname);
28 }
29
30 UI_EXPORT void __stdcall UImain() {
31 Thread ^thread = UI::Application::GetInstance()->Start();
32 thread->Join();
33 }
34
35 UI_EXPORT void __stdcall UIshow(void *wptr) {
36 UI::MainWindow ^window = (UI::MainWindow^)PtrToObject(wptr);
37 window->ShowWindow();
38 }

mercurial