Because I have poor memory, I often cannot remember the commands. Note that it is not very bad, it is too bad, and it is also relatively lazy, so I want to write a little thing and release the labor force. so I had an idea to write a small tool for importing and exporting the database, so that it would be difficult to modify the file path, especially the file path, in cmd.
11. There was nothing to do at home. The time came. At first, I wanted to write it in script language. For example, I called vbs in batch processing, and vbs used ie for GUI. Later I found that the monotonous vbs script was acceptable, however, if you use batch processing to call vbs, ie will not be able to get started, and the effect is not very good. Simply write a small program (Java will not be too troublesome ), fortunately, I know more about Delphi, but since Delphi is relatively simple, although I have been in contact with C ++ for three years in college ), but I still don't think it's as simple as Delphi I have never learned. this is the gap. You can only use easy-to-use languages. if you still forget VB, there is no development environment on the machine. A few days ago, I just got a lite version of Delphi. In this year, even the development tools have played a simple green, so I have to feel cold...
It is estimated that my blog is engaged in Java and I am not interested in the source code, but I am still preparing to post it out to prevent the occasional need. Using ShellExecute can start java. If you are interested, you can check it out. if you are not interested in reading the source code, try this tool. If you come to Delphi, you should pass...
This is my first complete Delphi Program. Its Debut is commemorative.
(My csdn resources): http://download.csdn.net/source/657522
- Unit unit2;
- Interface
- Uses
- Windows, messages, sysutils, variants, classes, graphics, controls, forms,
- Dialogs, stdctrls, shellapi, customizedlg;
- Type
- Tform1 = Class (tform)
- Execbutton: tbutton;
- Usernameedit: tedit;
- Usernamelabel: tlabel;
- Impradio: tradiobutton;
- Expradio: tradiobutton;
- Databaseedit: tedit;
- Databaselabel: tlabel;
- Fromuserlabel: tlabel;
- Passwordlabel: tlabel;
- Passwordedit: tedit;
- Fromuseredit: tedit;
- Touserlabel: tlabel;
- Touseredit: tedit;
- Opendialog1: topendialog;
- Ext;lineedit: tedit;
- Button3: tbutton;
- Filelabel: tlabel;
- Extcmdlabel: tlabel;
- Fileedit: tedit;
- Cmdlineedit: tedit;
- Bloglabel: tlabel;
- Procedure execbuttonclick (Sender: tobject );
- Procedure button3click (Sender: tobject );
- Procedure bloglabelmouseenter (Sender: tobject );
- Procedure bloglabelmouseleave (Sender: tobject );
- Procedure bloglabelclick (Sender: tobject );
- Procedure databaseeditchange (Sender: tobject );
- Procedure chgw.line ();
- Procedure formcreate (Sender: tobject );
- Procedure impradioclick (Sender: tobject );
- Procedure expradioclick (Sender: tobject );
- Procedure usernameeditchange (Sender: tobject );
- Procedure passwordeditchange (Sender: tobject );
- Procedure fromusereditchange (Sender: tobject );
- Procedure tousereditchange (Sender: tobject );
- Procedure ext1_lineeditchange (Sender: tobject );
- Procedure fileeditchange (Sender: tobject );
- Procedure formdestroy (Sender: tobject );
- Private
- {Private Declarations}
- Public
- {Public declarations}
- End;
- VaR
- Form1: tform1;
- Batfile: textfile;
- Implementation
- {$ R *. DFM}
- Procedure tform1.execbuttonclick (Sender: tobject );
- Begin
- Assignfile (batfile, 'temp. bat ');
- Rewrite (batfile );
- Writeln (batfile, '% ~ 1 '+ #10 + 'pause ');
- Closefile (batfile );
- ShellExecute (application. Handle, 'open', 'temp. bat', pchar ('"' + response lineedit. Text + '"'), nil, sw_show );
- End;
- Procedure tform1.button3click (Sender: tobject );
- Begin
- Opendialog1.filter: = 'backup file | *. dmp | all files | *.*';
- If opendialog1.execute then
- Begin
- Fileedit. Text: = opendialog1.filename;
- End;
- End;
- Procedure tform1.bloglabelmouseenter (Sender: tobject );
- Begin
- Bloglabel. Font. Style: = [fsunderline];
- End;
- Procedure tform1.bloglabelmouseleave (Sender: tobject );
- Begin
- Bloglabel. Font. Style: = [];
- End;
- Procedure tform1.bloglabelclick (Sender: tobject );
- Begin
- ShellExecute (handle, 'open', 'HTTP: // blog.csdn.net/sunyujia/', '','', sw_shownormal );
- End;
- Procedure tform1.databaseeditchange (Sender: tobject );
- Begin
- Chgw.line ();
- Ext;lineedit. Text: = 'Log = '+ databaseedit. Text +'. log ';
- Fileedit. Text: = databaseedit. Text + '. dmp ';
- End;
- Procedure tform1.chgw.line ();
- Begin
- Export lineedit. Text: = usernameedit. Text + '/' + passwordedit. Text + '@' + databaseedit. text;
- If impradio. Checked = true then
- Begin
- Export lineedit. Text: = 'Imp '+ export lineedit. Text + 'fromuser =' + fromuseredit. Text + ''+ 'touser = '+ touseredit. Text + '';
- End else
- Begin
- Export lineedit. Text: = 'exp' + export lineedit. Text + 'owner = '+ fromuseredit. Text + '';
- End;
- Export lineedit. Text: = export lineedit. Text + 'file = "'+ fileedit. Text +'" '+ ext1_lineedit. text;
- End;
- Procedure tform1.usernameeditchange (Sender: tobject );
- Begin
- Chgw.line ();
- Fromuseredit. Text: = usernameedit. text;
- Touseredit. Text: = usernameedit. text;
- End;
- Procedure tform1.formdestroy (Sender: tobject );
- Begin
- Deletefile ('temp. bat ');
- End;
- Procedure tform1.formcreate (Sender: tobject );
- Begin
- Chgw.line ();
- End;
- Procedure tform1.impradioclick (Sender: tobject );
- Begin
- Chgw.line ();
- End;
- Procedure tform1.expradioclick (Sender: tobject );
- Begin
- Chgw.line ();
- End;
- Procedure tform1.passwordeditchange (Sender: tobject );
- Begin
- Chgw.line ();
- End;
- Procedure tform1.fromusereditchange (Sender: tobject );
- Begin
- Chgw.line ();
- End;
- Procedure tform1.tousereditchange (Sender: tobject );
- Begin
- Chgw.line ();
- End;
- Procedure tform1.ext1_lineeditchange (Sender: tobject );
- Begin
- Chgw.line ();
- End;
- Procedure tform1.fileeditchange (Sender: tobject );
- Begin
- Chgw.line ();
- End;
- End.