Using Visual Studio 2005 Im having a problem getting a thread started using the standard CreateThread() call. Im using the included system service template. In the section -
virtualvoid OnStart(array<String^>^ args) override
// TODO: Add code here to start your service.
HANDLE hThread = CreateThread(NULL , 0 , (LPTHREAD_START_ROUTINE)ServiceThread , NULL , 0 , (LPDWORD)&ThreadId);
The compiler throws the error
1>c:\blah blah blah\Cluster Node ServiceWinService.h(3) : error C3641: 'ServiceThread' : invalid calling convention '__stdcall ' for function compiled with /clrure or /clr:safe
I havent worked with system services before. All I really need to do is get a thread running so it can handle some network connectivity and I/O stuff. I need to run it as a system service because it has to run even when noone is logged on.