diff options
Diffstat (limited to 'plugins/example')
-rw-r--r-- | plugins/example/main.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/plugins/example/main.cpp b/plugins/example/main.cpp index 00fde1e..b5af37f 100644 --- a/plugins/example/main.cpp +++ b/plugins/example/main.cpp @@ -25,6 +25,12 @@ EVENT_HANDLER our_handler(void* data) //this is event handler fuction return (void*(*)(void*))data; //just return data which we obtaned } +SERVICE our_service(void *data) //this is a service function +{ + wxMessageBox(_T("Our test service are working )"), _T("Info"), wxOK | wxICON_INFORMATION); + return 0; +} + bool wxPluginForEvilCore::OnInit() { wxMessageBox(_T("I am a plugin example") ,_T("Info"), wxOK | wxICON_INFORMATION); @@ -76,6 +82,23 @@ bool wxPluginForEvilCore::OnInit() free(str); //should be freed wxMessageBox(msg, _T("Info"), wxOK | wxICON_INFORMATION); } + //register our service in core + { + if(!pluginLink->CreateServiceFunction("ExamplePlugin/TestService", (void* (*)(void*))our_service)) + { + wxChar msg[64]; + wxSnprintf(msg, 63, _T("we have succesfuly registered service \"ExamplePlugin/TestService\"")); + wxMessageBox(msg, _T("Info"), wxOK | wxICON_INFORMATION); + } + else + { + wxChar msg[128]; + wxSnprintf(msg, 127, _T("we have failed to register service \"ExamplePlugin/TestService\"")); + wxMessageBox(msg, _T("Info"), wxOK | wxICON_INFORMATION); + } + } + if(pluginLink->ServiceExists("ExamplePlugin/TestService")) //check if service which we want to call exists + CallService("ExamplePlugin/TestService", 0); //call service return true; } |