1. Is there a way to set the Mach error label like MachErrorMsg("*********x") or SetMachError("*********x")? From the Shuttle Plugin:
void SetMachError(Cstring Message){
CString *err = &MainPlanner->LastError;
if(err != NULL )
*err = Message;"}
In Ed's -TrajectoryControl structure LastError is a LPCSTR pointer. In C++/CLI I came up with:
void SetMachError(LPCSTR Message){
LPCSTR err = (LPCSTR)&MainPlanner->LastError;
if(err != nullptr )
err = Message;// Compiles NO OUTPUT
}
Has anybody figured this out?
Kurt, I solved the same problem with the following piece of code:
void SetMachError(char* msg){
void *temp = &MainPlanner->LastError;
if( temp != NULL) *(CString*)temp = msg; //need #include <atlstr.h>
}
One more tip: put the include atlstr.h before setting default namespaces in order to prevent name ambiguities.
I hope it helps.
I just thought I'd let everyone know that this code also solved my problem with the Mach Status field.
void SetMachError(char* msg){
void *temp = &MainPlanner->LastError;
if( temp != NULL) *(CString*)temp = msg; //need #include <atlstr.h>
}
but in order to get it to work, there are two caveats, first, atlstr.h is not included in the express version of visual studio, so I had to compile it on my Visual Studio Pro. I used Studio 2010 pro to get it working. Second, since I used the plugin wizard to generate my beginning project, I am using mixed mode code, and this includes the .net framework, so in order to load the atlstr.h header, you will have to load it before your first "using namespace" statement. For me this was in my stdafx.h and if you don't load it before your first "using namespace" statement, the errors you will get during compile are that there are several ambiguous statements related to thing in the CLR since .net and atl define a bunch of stuff with the same names.
I hope this helps anyone who, like me, spent hours doing just this one simple little thing.