How to log in to the form

xiaoxiao2021-03-05  22

(1) Let the login form open before the main form is run, (2) Determine whether the main form should be run depending on the login form return value. The detailed code is as follows: //Project.dpr file program project; ... ... begin application.initialize; entryfrm: = tentryfrm.create (application); // Login window if entryfrm.showModal = Mrok When the THEN // logs in the form is closed, returns the mrok value, indicating that the login is successful begin application.createform (TMAINFRM, MainFRM); // Other auto-create forms end; entryfrm.free; Application.Terminate Application.title: = 'a certain Management system '; application.run; end .// entry.pas login form file var count: short; // Login number {$ r * .dfm} procedure tentryfrm.bitbtn2click (sender: Tobject); // Cancel sign Application.terminate; end; procedure tentryfrm.bitbtn1click (sender: Tobject); // Determine login begin inc (count); id: = edit1.text; // account PAS: = Edit2.Text; // password; ID, PAS Is global variable / / ※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※ // idinfo.open; if idinfo.locate ('ID', ID, []) THEN BEGINFO.FIELDBYNAME ('PAS'). Asstring) = pas // password decryption, login success begin pop: = idinfo.fieldbyname ('pop'). Asstring ; // get the permissions WRITELOG (ID, 'login'); // Write log Self.ModalResult : = mrok; // Close the window and return the MROK value end; end; if count> = 3 Then Self.ModalResult: = mrabort; // only allow login 3 idinfo.close; // ※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※ ※※※※※※※※※※※※※※※※※※※※※※※※※※ // Edit1.Text: = '; Edit2.Text: ='; Edit1.Setfocus; End ;

转载请注明原文地址:https://www.9cbs.com/read-32668.html

New Post(0)