Before Delphi, please refer to the following section of the BCB anti-Replay Function in the same window as Delphi. I have never succeeded for a long time and have little knowledge of Delphi, more than enough. Delphi/Windows SDK/API
Http://www.delphi2007.net/DelphiDB/html/delphi_20061218170853237.html
// Anti-Reopen window
Bool OpenForm (tform * wform)
{
Int I;
Bool formexist;
If (wform = NULL)
Return false;
Formexist = false;
For (I = 0; I <screen-> formcount; I ++)
If (screen-> forms [I]-> classtype () = wform-> classtype ())
{
Formexist = true;
Break;
}
If (formexist = false)
Return formexist;
If (wform-> windowstate = wsminimized)
Showwindow (wform-> handle, sw_showna );
If (! Wform-> visible)
Wform-> visible = true;
Wform-> bringtofront ();
Wform-> setfocus ();
Return true;
}
Function OpenForm (wform: tform): Boolean;
VaR
I: integer;
Begin
Result: = false;
If wform = nil then
Exit;
For I: = 0 to screen. formcount-1 do
If screen. Forms [I]. classtype = wform. classtype then
Begin
Result: = true;
Break;
End;
If not result then exit;
If wform. windowstate = wsminimized then
Showwindow (wform. Handle, sw_showna );
If not wform. Visible then
Wform. Visible: = true;
Wform. bringtofront;
Wform. setfocus;
Result: = true;
End;
I am very grateful. I have put this generation of code in private, but it cannot be accessed. Why ???
I am very grateful. I have put this generation of code in private, but it cannot be accessed. Why ???
========================================================== ========================================================== =
To add the function to the private of tform1, you must modify the precedingCodeIs
Function tform1.openform (wform: tform): Boolean;
Unit unit1;
Interface
Uses
Windows, messages, sysutils, variants, classes, graphics, controls, forms,
Dialogs;
Type
Tform1 = Class (tform)
Private
{Private Declarations}
Function OpenForm (wform: tform): Boolean;
Public
{Public declarations}
End;
VaR
Form1: tform1;
Implementation
{$ R *. DFM}
{Tform1}
Function tform1.openform (wform: tform): Boolean;
VaR
I: integer;
Begin
Result: = false;
If wform = nil then
Exit;
For I: = 0 to screen. formcount-1 do
If screen. Forms [I]. classtype = wform. classtype then
Begin
Result: = true;
Break;
End;
If not result then exit;
If wform. windowstate = wsminimized then
Showwindow (wform. Handle, sw_showna );
If not wform. Visible then
Wform. Visible: = true;
Wform. bringtofront;
Wform. setfocus;
Result: = true;
End;
End.
In Delphi, what is the difference between this parameter in private, public, or directly with procedure ??
Private, which can only be used by the class itself or other classes in the same unit
Public, all...
This type of function is directly written together with procedure and is available to all users. The difference between this function and public is that it does not need to be accessed through class instances.
We recommend that you buy or use it as an entry book online.
Multiple links.
It's a little short.