Below I have piece of software that I have to control the Feedoverride:
extern CMyScriptObject co;
extern double GetOEMDRO(short);
extern void SetOEMDRO(short,double);
const int FeedRateOverRide = 821;
double FRO;
......
if( code == 108 ) {
FRO = co.GetOEMDRO(FeedRateOverRide);
FRO += 1;
co.SetOEMDRO(FeedRateOverRide, FRO);
return;
}
if( code == 109 ) {
FRO = co.GetOEMDRO(FeedRateOverRide);
FRO -= 1;
co.SetOEMDRO(FeedRateOverRide,FRO);
return;
}
.......
I had a bug in a row that I noted a sign "-------->", Mach3 program installation is not prescribed in the registry value "Mach4.Document". Therefore, the functions SetOEMDRO (), GetOEMDRO () did not work.
VOID Mach3ObjectModelStartup(VOID)
{
static const IID IID_IMyScriptObject = { 0xf1d3ee6c, 0xab32, 0x4996,
{ 0xb2, 0x70, 0xf4, 0x15, 0x61, 0x3f, 0x5b, 0xa3 } };
CLSID clsid;
HRESULT res;
res = CoInitialize(NULL);
LPUNKNOWN lpUnk = NULL;
LPDISPATCH lpDispatch = NULL;
try {
----------> res = CLSIDFromProgID(OLESTR("Mach4.Document"),&clsid);
if (res == NOERROR) {
if (res = GetActiveObject(clsid,NULL,&lpUnk) == NOERROR) {
HRESULT hr = lpUnk->QueryInterface(IID_IDispatch,
(LPVOID*)&lpDispatch);
lpUnk->Release();
if (hr == NOERROR) {
mach4.AttachDispatch(lpDispatch, TRUE);
lpDispatch = mach4.GetScriptDispatch();
co.AttachDispatch(lpDispatch, TRUE);
connected = TRUE;
}
}
}
}
catch(_com_error &e) {
// com_error_msg(e);
}
}