Build an event, that is usable from a C# program, which belongs to a C++ program.
$250-750 USD
Betalades vid leverans
I have a small C++ dll which creates a CLRCreateInstance and loads a C# dll.
Here is the source:
///////////////////////////////////////////////////////////////////////////////////////////////////////
#include <metahost.h>
#pragma comment(lib, "[login to view URL]")
DWORD WINAPI ControlThread(LPVOID lpParam)
{
ICLRMetaHost* metaHost = NULL;
ICLRRuntimeInfo* runtimeInfo = NULL;
ICLRRuntimeHost* runtimeHost = NULL;
if (CLRCreateInstance(CLSID_CLRMetaHost, IID_ICLRMetaHost, (LPVOID*)&metaHost) == S_OK)
if (metaHost->GetRuntime(L"v4.0.30319", IID_ICLRRuntimeInfo, (LPVOID*)&runtimeInfo) == S_OK)
if (runtimeInfo->GetInterface(CLSID_CLRRuntimeHost, IID_ICLRRuntimeHost, (LPVOID*)&runtimeHost) == S_OK)
if (runtimeHost->Start() == S_OK)
{
DWORD pReturnValue;
runtimeHost->ExecuteInDefaultAppDomain(L"C:\\[login to view URL]", L"[login to view URL]", L"EntryPoint", L"asd", &pReturnValue);
runtimeInfo->Release();
metaHost->Release();
runtimeHost->Release();
}
return 0;
}
BOOL APIENTRY DllMain(HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)ControlThread, hModule, NULL, NULL);
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
And now here is the source code for the C# [login to view URL]
///////////////////////////////////////////////////////////////////////////////////////////////////////
namespace ExampleProject
{
public class Example
{
public static int EntryPoint(string pwzArgument)
{
string processName = [login to view URL]().ProcessName;
[login to view URL]("The current process is " + processName);
return 0;
}
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
What I want is to create a second thread in the C++ project and call it TickEvent
///////////////////////////////////////////////////////////////////////////////////////////////////////
DWORD WINAPI TickEvent(LPVOID lpParam)
{
while (true)
{
Sleep(500);
//[login to view URL]();
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
And use it like this in the C# [login to view URL]
///////////////////////////////////////////////////////////////////////////////////////////////////////
namespace ExampleProject
{
public class Example
{
public static int EntryPoint(string pwzArgument)
{
[login to view URL] += OnTick;
}
private static void OnTick(EventArgs args)
{
string processName = [login to view URL]().ProcessName;
[login to view URL]("Called every 500ms inside " + processName);
return 0;
}
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
The question from me is, can you make an event like this, which is controlled from the C++ dll and usable from any C# dll?
If you can complete this task, I will be asking from you to also implement different C++ API which are usable in C# inside the events earlier created.
Please take a moment and use the passw0rd "I am C# pr0grammer" to confirm you have read my post in general and are sure you can complete it.
Projekt-id: #22266905
About the project
13 frilansare har lagt bud på i genomsnitt $509 för det här jobbet
Hi,. I have gone through the brief details mentioned on the job. I have done multiple jobs with .NET, C Programming, C# Programming, C++ Programming, Software Architecture which are the skills required to get this job Mer
I can start work right now and I can show you perfect result in a short time. Please contact me freely. Waiting for you with your great news.
"I am C# pr0grammer" - I understand your frustration with automated bids. Hello, I'm very experienced with C, C++ and C# programming and I believe I can help you implement this project. I would implement this type of f Mer
Hello There. How are you doing?. I have read the description, I have great experience doing similar jobs related to these skills .NET, C Programming, C# Programming, C++ Programming, Software Architecture. Please start Mer
Dear Hiring Manager, After reviewing your job description, it’s clear that you’re looking for a candidate that is extremely familiar with the responsibilities associated with the role, and can perform them confidentl Mer
Hello, How are you? My pleasure to bid your project. I've read carefully your project description. I have more than five years experience in development related with your project. Your satisfaction with the project is Mer
Good day! I'm a licensed full stack developer and designer. I have rich experiences in python/Django, python selenium , image processing by using openCV and google apis and extensions. I have many experiences in c#, Mer
I am C# pr0grammer I am C# pr0grammer I am C# pr0grammer I am C# pr0grammer I am C# pr0grammer I am C# pr0grammer I am C# pr0grammer
Dear Client. Thanks for your job posting. My slogan is to satisfy the client's requirement with a low price. However, high quality and fast-deliver is promised. I am interested in your project. Because I have strong sk Mer