问题
I'm failing to use the Invoke method of the OpenNETCF Rapi.dll. Can somebody please post an example? I can't seem to find one anywhere on the web. Other function calls worked fine, but I couldn't figure out Invoke. (dllPath was OK)
- MyDll is in the root of the CE device.
- It has a FindAndKill method which needs one string argument
I've tried this:
var rapi = new CODMrapi.CODMrapi(dllPath);
var encoding = new System.Text.UTF8Encoding();
rapi.Connect();
byte[] inputData = encoding.GetBytes(fileName);
byte[] outputData;
rapi.Connect();
rapi.Invoke("\\MyDll.dll", "FindAndKill", inputData, out outputData);
rapi.Disconnect();
回答1:
You need to debug to determine what's happening. Add in ::MessageBox
calls to the DllMain and the method to see if the DLL is even getting loaded and if the method is getting called. If they are not, make sure that your method is publicly exported from the DLL and the name wasn't mangled (dumpbin is a good tool for this)
来源:https://stackoverflow.com/questions/18332548/rapi-dll-opennetcf-invoke-example