VC++ Automation Word 2000 Error : Unable to Disable "Cntrl+C"
-
Hi, I am automating Word 2000 and I want to disable the "Ctrl C" keyboard functionality. (Using VBA I am successful in disabling the "Ctrl+C" by doing this - "Application.FindKey(BuildKeyCode(wdKeyControl, wdKeyC)).Disable") I am using the following C++ automation code which gives me the DISP_E_EXCEPTION error code on IDispatch::Invoke for "Disable" method ("AutoWrap" function below is a wrapper around IDispatch::Invoke). Here is my C++ code: parm1.vt = VT_I4; parm1.lVal = wdKeyControl; parm2.vt = VT_I4; parm2.lVal = wdKeyC; VariantClear(&result); AutoWrap(DISPATCH_METHOD, &result, pWdApp, L"BuildKeyCode",2,parm2,parm1); parm1.vt = VT_I4; parm1.lVal = result.lVal; VariantClear(&result); AutoWrap(DISPATCH_PROPERTYGET , &result, pWdApp, L"FindKey", 1,parm1); pWdKey = result.pdispVal; AutoWrap(DISPATCH_METHOD, NULL,pWdKey , L"Disable", 0); Error : "This method or property is not available because this document is in another application" I will appreciate any help on this. Thanks. Vishal ---------------------- Vishal More