ورود

View Full Version : Only API هر کسی تابعی داره انجا مطرح کنه که همه استفاده کنن



mrkh1759
جمعه 12 اسفند 1384, 18:27 عصر
سلام
اولیش رو خودم افتتاح می کنم .
امیدوارم سایر عزیزان هم در رونق این موضوع در این قسمت سهیم شوند.

یاعلی

mrkh1759
جمعه 12 اسفند 1384, 18:31 عصر
Compilers Delphi
Category Misc
uses
Windows,
ShellApi,
ShlObj;

const
SHFMT_ID_DEFAULT = $FFFF;
SHFMT_OPT_QUICKFORMAT = 0;
SHFMT_OPT_FULLFORMAT = 1;
SHFMT_OPT_SYSONLY = 2;

SHFMT_ERROR = -1;
SHFMT_CANCEL = -2;
SHFMT_NOFORMAT = -3;

function SHFormatDrive(hWnd : HWND; Drive : Word; fmtID : Word; Options : Word) : Longint; stdcall;
external 'Shell32.dll' name 'SHFormatDrive';

procedure DiskFormat(Drive:Char);
var
RetCode : Integer;
begin
retCode:= SHFormatDrive(GetDesktopwindow,
Ord(Upcase(Drive))-Ord('A'),
SHFMT_ID_DEFAULT,
SHFMT_OPT_QUICKFORMAT);
end;

mrkh1759
جمعه 12 اسفند 1384, 18:33 عصر
Uses
Windows,
Graphics,
ShellApi;

Procedure GetIcon(Filename,IconFilename:String;SmallIcon:Boo lean);
Var
HIcon32 ,
HIcon16 : HIcon;
Icon : tIcon;
Begin
ExtractIconEx(Pchar(Filename),0,HIcon32,HIcon16,1) ;

If (HIcon16<>0) and SmallIcon then
Begin
Icon:=tIcon.Create;
Icon.handle:=HIcon16;
Icon.SaveToFile(IconFilename);
Icon.Free;
end else
If (HIcon32<>0) and not SmallIcon then
Begin
Icon:=tIcon.Create;
Icon.handle:=HIcon32;
Icon.SaveToFile(IconFilename);
Icon.Free;
end;
End

mrkh1759
جمعه 12 اسفند 1384, 18:34 عصر
Compilers Delphi
Category System
Uses
Windows;

function GetCPUSpeed: Double;
const
DelayTime = 500; // measure time in ms
var
TimerHi, TimerLo: DWORD;
PriorityClass, Priority: Integer;
begin
PriorityClass := GetPriorityClass(GetCurrentProcess);
Priority := GetThreadPriority(GetCurrentThread);

SetPriorityClass(GetCurrentProcess, REALTIME_PRIORITY_CLASS);
SetThreadPriority(GetCurrentThread, THREAD_PRIORITY_TIME_CRITICAL);

Sleep(10);
asm
dw 310Fh // rdtsc
mov TimerLo, eax
mov TimerHi, edx
end;
Sleep(DelayTime);
asm
dw 310Fh // rdtsc
sub eax, TimerLo
sbb edx, TimerHi
mov TimerLo, eax
mov TimerHi, edx
end;

SetThreadPriority(GetCurrentThread, Priority);
SetPriorityClass(GetCurrentProcess, PriorityClass);

Result := TimerLo / (1000.0 * DelayTime);
end;

Touska
جمعه 12 اسفند 1384, 18:43 عصر
یک سئوال میپرسم ، ببینم کی جواب می ده این سئوال مربوط به استخدام در شرکت iolo technologies البته در سال 2005 :

و مربوط به Api است.

و سئوال اینکه بدون اینکه Dialogy را در Shell32.dll باز کنید Caption آنها را بدست آورید :

:)

Hamid_PaK
شنبه 13 اسفند 1384, 06:17 صبح
//[function GetSystemDir]
function GetSystemDir: String;
var Buf: array[ 0..MAX_PATH ] of Char;
begin
GetSystemDirectory( @ Buf[ 0 ], MAX_PATH + 1 );
Result := IncludeTrailingPathDelimiter( PChar( @ Buf[ 0 ] ) );
end;

//*
//[function GetWindowsDir]
function GetWindowsDir : string;
var Buf : array[ 0..MAX_PATH ] of Char;
begin
GetWindowsDirectory( @Buf[ 0 ], MAX_PATH + 1 );
Result := IncludeTrailingPathDelimiter( PChar( @ Buf[ 0 ] ) );
end;

//[function GetWorkDir]
function GetWorkDir : string;
var Buf: array[ 0..MAX_PATH ] of Char;
begin
GetCurrentDirectory( MAX_PATH + 1, @ Buf[ 0 ] );
Result := IncludeTrailingPathDelimiter( PChar( @ Buf[ 0 ] ) );
end;

//*
//[function GetTempDir]
function GetTempDir : string;
var Buf : array[ 0..MAX_PATH ] of Char;
begin
Windows.GetTempPath( MAX_PATH + 1, @Buf[ 0 ] );
Result := IncludeTrailingPathDelimiter( PChar( @ Buf[ 0 ] ) );
end;



یا حق !!!

Hamid_PaK
شنبه 13 اسفند 1384, 06:55 صبح
uses
Windows, SysUtils, ShlObj;

function BrowseForFolder(const frmHandle:THandle;const Title: String; const Flag: Cardinal): String;
var
lpItemID : PItemIDList;
BrowseInfo : TBrowseInfo;
DisplayName : array[0..MAX_PATH] of char;
TempPath : array[0..MAX_PATH] of char;
begin
Result:='';
FillChar(BrowseInfo, sizeof(TBrowseInfo), #0);
with BrowseInfo do begin
hwndOwner := frmHandle;
pszDisplayName := @DisplayName;
lpszTitle := PChar(Title);
ulFlags := Flag;
end;
lpItemID := SHBrowseForFolder(BrowseInfo);
if lpItemId <> nil then begin
SHGetPathFromIDList(lpItemID, TempPath);
Result := IncludeTrailingPathDelimiter(TempPath);
GlobalFreePtr(lpItemID);
end else
Result := '-1';
end;

// usage procedure ...
var
tmp: String;
begin
tmp := BrowseForFolder(GetDesktopWindow, 'Select your own program folder',
BIF_RETURNONLYFSDIRS);
MessageBox(GetDesktopWindow, pChar(tmp), 'iNFO ...',
MB_TOPMOST+MB_ICONINFORMATION);
end;


یا حق !!!

daneshpazho
دوشنبه 14 فروردین 1385, 16:35 عصر
یه تاپیک به نام استفاده از توابع API هم هست که می تونی از اون استفاده کنی

Ehsansh
سه شنبه 15 فروردین 1385, 07:04 صبح
میتونید از این مرجع API هم استفاده کنید:
http://www.iranwebsoft.com/apistart.asp
API چیست؟
http://en.wikipedia.org/wiki/API