II. Employing (Windows 's ) API operate
here having a few specific programs to illustrate :
Software 1:
Delphi has manage MEMO, after you use ought to be Manage input or modifying,
Office 2010 Activation Key, easy methods to figure out the current cursor location? Then you may call the Windows API operate in the EM_LINEFROMCHAR and EM_LINEINDEX MEMO control concept to decide the current cursor row and column , the specific method get in touch with is as follows :
process TForm1.Button1Click (Sender: TObject);
var
LineNum: longint;
CharsBeforeLine: longint;
start
LineNum: = SendMessage (Memo1.Deal with, EM_LINEFROMCHAR,
Memo1.SelStart, 0);
CharsBeforeLine: = SendMessage (Memo1.Deal with, EM_LINEINDEX,
Office 2007 License,
LineNum, 0);
Label1.Caption: = 'Line:' + IntToStr (LineNum + 1);
Label2.Caption: = 'Position:' + IntToStr ((Memo1.SelStart -
CharsBeforeLine) +1);
end;
Application 2:
Delphi control TlistBox not supplied in the horizontal scroll bar , if you would like to add A horizontal flow segment ,
Microsoft Office 2007 Ultimate, we merely use the API operate to mail a LB_SetHorizontalExtent TListBox message within the line.
source code is as follows :
SendMessage (ListBox1.Handle, LB_SetHorizontalExtent, 2000,
longint (0));
Applications 3:
After we have to get the resolution with the computer running the program , you will discover two techniques : ① supplied by Delphi Display access international variables ,
Office Standard 2010 Key, particularly Screen.WIDTH and Display.Top to provide the display pixel resolution. ② employing the API operate WINDOWS GetDeviceCaps () to obtain employed to the show resolution ,
source code is as follows :
Application.Initialize;
Application.CreateForm (TForm1,
Office Pro Plus 2007 Key, Form1);
Case GetDeviceCaps (GetDC (Form1.Handle), HORZRES) of
640: / / 640 * 480 resolution for processing the code ;
800: / / 800 * 600 resolution for processing the code ;
1024 : / / 1024 * 768 resolution for processing the code ;
1280: / / 1280 * 1024 resolution around the code for processing ;
End;
Application.Operate;