c# - How to use RAPI.Invoke to call device winapi method from Desktop app -


i need device id desktop application, device windows ce 5.0 based handheld terminal , connected pc.

getting information application within device easy, can use of getdeviceuniqueid or kerneliocontrol winapi methods example:

    [dllimport("coredll.dll")]     private extern static int getdeviceuniqueid([in, out] byte[] appdata,                            int cbapplictiondata,                             int dwdeviceidversion,                             [in, out] byte[] deviceidouput,                             out uint pcbdeviceidoutput);      public byte[] getdeviceid(string appstring)     {         // call getdeviceuniqueid         byte[] appdata = encoding.unicode.getbytes(appstring);         int appdatasize = appdata.length;         byte[] deviceoutput = new byte[20];         uint sizeout = 20;         getdeviceuniqueid(appdata, appdatasize, 1, deviceoutput, out sizeout);         return deviceoutput;     } 

but need desktop application.

there sample within windows mobile 5.x sdk id desktop app. since using windows ce sample not give id (it's windows mobile).

getdeviceidsampleoutput

i believe possible use said method desktop app using rapi.invoke() method (or opennetcf rapi). can't figure how use rapi.invoke multi-parameter winapi method e.g. getdeviceuniqueid .

i have sample code, included c# signature of winapi method comment:

    //[dllimport("coredll.dll")]     //private extern static int getdeviceuniqueid([in, out] byte[] appdata,     //                       int cbapplictiondata,     //                        int dwdeviceidversion,     //                        [in, out] byte[] deviceidouput,     //                        out uint pcbdeviceidoutput);      private void buttongetdeviceid_click(object sender, routedeventargs e)     {         // rapi         rapi rapi = new rapi();         rapi.connect(true);         // how pass several parameters inside byte[] ?         rapi.invoke(@"\windows\coredll.dll", "getdeviceuniqueid", inputdata, out outputdata);         //process outputdata     } 

also there similar question here not provide solution.

i found answer here. in nutshell; there no direct way, need create win32 dll c call winapi made , deploy \windows folder. after can use rapi.invoke().

also this link article containing implementation.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -