C # Call Desert plugin

Source: Internet
Author: User

Desert plug-in is a very good thing, in the key wizard and language inside a lot of use, you can find the background to find the word, write game automatic script used particularly much. Write an automatic script in front, check some information, easy language is not too familiar, key wizard function may not be implemented, find some information, desert plug-ins can be used in C # call. Share the next method here.

One, the reference Ddm.dll.NET inside can directly reference, reference method, add Reference--com--find DM, double-click to register Desert plugin
//This is a way to register the DLL to the system, register the Desert to call Autoregcom ("Regsvr32-s dm.dll");Static stringAutoregcom (stringstrcmd) {            stringRinfo; Try{Process myprocess=NewProcess (); ProcessStartInfo Myprocessstartinfo=NewProcessStartInfo ("Cmd.exe"); Myprocessstartinfo.useshellexecute=false; Myprocessstartinfo.createnowindow=true; Myprocessstartinfo.redirectstandardoutput=true; Myprocess.startinfo=Myprocessstartinfo; Myprocessstartinfo.arguments="/ C"+Strcmd;                Myprocess.start (); StreamReader Mystreamreader=Myprocess.standardoutput; Rinfo=Mystreamreader.readtoend ();                Myprocess.close (); Rinfo= Strcmd +"\ r \ n"+Rinfo; returnRinfo; }            Catch(Exception ex) {returnEx.            Message; }        }

Iii. instantiation of the Desert object
New Dm.dmsoft ();
Four, call the desert method directly through the instantiation of the object DM call, such as DM. MoveTo (30, 30); Complete code: Put a button on the form, click the button, call the desert plugin to move the mouse to (30,30)
usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.Diagnostics;usingSystem.IO;namespaceplayer{ Public Partial classPlayer:form { PublicPlayer () {InitializeComponent (); Autoregcom ("regsvr32-s Dm.dll"); }        Private voidButton1_Click (Objectsender, EventArgs e) {Dm.dmsoft Dm=NewDm.dmsoft (); Dm. MoveTo ( -, -); }        Static stringAutoregcom (stringstrcmd) {            stringRinfo; Try{Process myprocess=NewProcess (); ProcessStartInfo Myprocessstartinfo=NewProcessStartInfo ("Cmd.exe"); Myprocessstartinfo.useshellexecute=false; Myprocessstartinfo.createnowindow=true; Myprocessstartinfo.redirectstandardoutput=true; Myprocess.startinfo=Myprocessstartinfo; Myprocessstartinfo.arguments="/ C"+Strcmd;                Myprocess.start (); StreamReader Mystreamreader=Myprocess.standardoutput; Rinfo=Mystreamreader.readtoend ();                Myprocess.close (); Rinfo= Strcmd +"\ r \ n"+Rinfo; returnRinfo; }            Catch(Exception ex) {returnEx.            Message; }        }    }}

C # Call Desert plugin

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.