با سلام
چگونه توابع API را در دلفی فراخوانی کنیم :گیج:
Printable View
با سلام
چگونه توابع API را در دلفی فراخوانی کنیم :گیج:
کدام تابع API را؟
آخه تابع ها با هم فرق دارن
نرم افزاری مثل API-Guide یا AllAPI را دانلود کن
با سلام
من کتابی را دیدم در مورد توابع API
بعضی از آنها بدرد برنامه ام خورد سوال من اینست که:
1- ایا توابع API را در دلفی میتوان استفاده کرد یا خیر :confy2:
2- اگر جواب بله است کدام توابع را :cry:
3- ابزار بهتر از توابع API آیا وجود دارد که استفاده انها در دلفی بهتر باشد :kaf:
4- در صورت امکان یک مثال :sunglass:
فکر منم بعضی هاش توی shelapi باشه
بله.نقل قول:
ایا توابع API را در دلفی میتوان استفاده کرد یا خیر
تمام شان را !نقل قول:
اگر جواب بله است کدام توابع را
برنامه های دلفی کلا با فراخوانی توابع API کار میکنند. خود VCL که چهارچوب برنامه نویسی در دلفی است در حقیقت لایه ای بر روی توابع API است.نقل قول:
ابزار بهتر از توابع API آیا وجود دارد که استفاده انها در دلفی بهتر باشد
در صورت نیاز به فرخوانی مستقیم توابع API کافی است یونیت Windows را در فرم تان Use کنید.
مثال:
<span dir=ltr></span>
- ActivateKeyboardLayout
Unit
Windows.Pas
Syntax
ActivateKeyboardLayout(
klh: HKL; {keyboard layout handle}
Flags: UINT {activation flag}
): HKL; {returns previous handle}
Description
The ActivateKeyboardLayout function activates the keyboard layout identified by the specified keyboard layout handle. In Windows95, it takes effect for the current thread. In Windows NT, it affects all threads.
Parameters
klh: The keyboard layout handle. This handle can be obtained by calling LoadKeyboardLayout or GetKeyboardLayoutList. This parameter can also be set to HKL_NEXT or HKL_PREV which refer to the next or previous entries in the keyboard layout list.
Flags: Specifies Keyboard layout options.
Return Value
If the function succeeds, the return value is the keyboard layout handle of the previous keyboard layout. If the function fails, it returns zero, indicating no matching keyboard layout was found. To get extended error information, call the GetLastError function.
Example:var
Form1: TForm1;
List : array [0..MAX_HKL] of HKL; // list of keyboard handles
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
MyLangID: WORD; // holds a language identifier
begin
{load the keyboard layout specified by language IDs}
MyLangID:=MakeLangID(WORD(StrToInt( ;Edit1.Text)), WORD(StrToInt(Edit2.Text)));
if LoadKeyBoardLayout(PChar('0000' + IntToHex(MyLangID,4)),KLF_ACTIVATE) ; = 0
then ShowMessage('Error loading keyboard layout');
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
{activate the highlighted keyboard layout}
if (ActivateKeyboardLayout(StrToInt(ListB ox1.Items[Listbox1.Itemindex]),
KLF_REORDER) = 0) then
ShowMessage('Error activating the keyboard layout');
{clear the keyboard layout list and repopulate it}
ListBox1.Clear;
FormCreate(Sender);
end;
procedure TForm1.FormCreate(Sender: TObject);
var
pwszKLID: PChar; // holds the name of a keyboard layout
MyListIndex: Integer; // specifies a list index
begin
{get the keyboard layout lists}
GetKeyboardLayoutList(MAX_HKL, List);
{allocate a buffer for the keyboard layout name string}
GetMem(pwszKLID, KL_NAMELENGTH);
{retrieve the name string for active keyboard layout}
GetKeyboardLayoutName(pwszKLID);
ShowMessage('The active keyboard layout is '+pwszKLID);
StatusBar1.SimpleText:= 'Active keyboard layout ' + pwszKLID;
{retrieve the code page identifier}
StaticText1.Caption:=IntTostr(GetACP);
{free the string memory}
FreeMem(pwszKLID);
{list all the keyboard layout in the list box}
MyListIndex := 0;
while (List[MyListIndex] <> 0) do
begin
ListBox1.Items.Add(IntToStr(List[MyLis tIndex]));
Inc(MyListIndex);
end;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
{unload keyboard layout}
if not UnloadKeyboardLayout(StrToInt(ListBox1.Ite ms[Listbox1.ItemIndex])) then
ShowMessage('Error Unloading Keyboard Layout');
end;
function MakeLangID(PrimLang, SubLang:WORD): WORD;
begin
{make a Language ID by combining the Primary language ID and Sub language ID}
Result := (SubLang SHL 10) + PrimLang;
end;
دوست عزیز DelphiAssistant :
جالب بود . استفاده کردم .....
:تشویق: :تشویق: :موفق:
ببخشید آیا می توانید مرا راهنمایی کنید که چگونه میتوانم API جستجوی یک کلمه خاص را در یک صفحه HTML از داخل دلفی استفاده کنم
در برنامه یک صفحه وب داریم میخواهیم دنبال کلمه خاصی بگردیم ابتدا آن کلمه را داخل یک edit تایپ کنیم و با زدن یک دکمه و با استفاده از API ویندوز تمامی کلمات مشابه در صورت وجود داشتن در صفحه وب مورد نظر به حالت select مشخص شود
اگر لطف کنید بصورت سورس کد کامل برایم مثال بزنید متشکر می شوم
با احترام