برای باز کردن منو برنامه خود و فعال کردن گزینه مورد نظر در آن منو با استفاده از این روش امکان پذیر است
procedure TForm1.Button1Click(Sender: T);
procedure DropMenuAndSelectItem(MainMenuItemIndex,ItemIndex:integer);
var
n : integer;
begin
//Activate MainMenu
keybd_event( VK_MENU, Mapvirtualkey( VK_MENU, 0 ), 0, 0 );
keybd_event( VK_MENU, Mapvirtualkey( VK_MENU, 0 ), KEYEVENTF_KEYUP, 0 );
keybd_event( VK_RETURN, MapVirtualKey( VK_RETURN, 0), 0, 0 );
keybd_event( VK_RETURN, MapVirtualKey( VK_RETURN, 0), KEYEVENTF_KEYUP, 0 );
//Select MainMenuItem
while (MainMenuItemIndex>0) do begin
keybd_event( VK_RIGHT, MapVirtualKey( VK_RIGHT, 0), 0, 0 );
keybd_event( VK_RIGHT, MapVirtualKey( VK_RIGHT, 0), KEYEVENTF_KEYUP, 0 );
Dec(MainMenuItemIndex);
end;
//Select SubItem
while (ItemIndex>0) do begin
keybd_event( VK_DOWN, MapVirtualKey( VK_DOWN, 0), 0, 0 );
keybd_event( VK_DOWN, MapVirtualKey( VK_DOWN, 0), KEYEVENTF_KEYUP, 0 );
Dec(ItemIndex);
end;
end;
begin
//Drop and select third item of the first MainMenuItem
DropMenuAndSelectItem(0,2);
end;
برگرفته شده از سایت دنیای برنامه نویسی دلفی(http://mt85.blogfa.com)
گرفتن اطلاعات سیستم - اطلاعاتی در رابطه با حافظه
procedure TForm1.Button1Click(Sender: T);
var
MemoryStatus: TMemoryStatus;
begin
Memo1.Lines.Clear;
MemoryStatus.dwLength := SizeOf(MemoryStatus);
GlobalMemoryStatus(MemoryStatus);
with MemoryStatus do
begin
{ Size of MemoryStatus record }
Memo1.Lines.Add(IntToStr(dwLength) +
" Size of ""MemoryStatus"" record");
{ Per-Cent of Memory in use by your system }
Memo1.Lines.Add(IntToStr(dwMemoryLoad) +
"% memory in use");
{The amount of Total Physical memory allocated to your system.}
Memo1.Lines.Add(IntToStr(dwTotalPhys) +
" Total Physical Memory in bytes");
{ The amount available of physical memory in your system. }
Memo1.Lines.Add(IntToStr(dwAvailPhys) +
" Available Physical Memory in bytes");
{ The amount of Total Bytes allocated to your page file }
Memo1.Lines.Add(IntToStr(dwTotalPageFile) +
" Total Bytes of Paging File");
{ The amount of available bytes in your page file }
Memo1.Lines.Add(IntToStr(dwAvailPageFile) +
" Available bytes in paging file");
{ The amount of Total bytes allocated to this program
(generally 2 gigabytes of virtual space) }
Memo1.Lines.Add(IntToStr(dwTotalVirtual) +
" User Bytes of Address space");
{ The amount of avalable bytes that is left to your program to use }
Memo1.Lines.Add(IntToStr(dwAvailVirtual) +
" Available User bytes of address space");
end;
end
procedure CopyDirectory(Origen, Desti : string);
var
Files : integer;
FOrigen, FDesti : string;
ok : boolean;
Search : TSearchRec;
begin
Files := FindFirst(Origen + "\*.*", faAnyFile, Search);
while Files = 0 do
begin
if Search.Attr <> faDirectory then
begin
FOrigen := Origen + "\" + Search.Name;
FDesti := Desti + "\" + Search.Name;
ok := CopyFile(PChar(FOrigen),PChar(FDesti),false);
if not ok then ShowMessage("No se pudo copiar el fichero: "+
Search.Name);
end
else
begin
if (Search.Name <> ".") and (Search.Name <> "..") then
begin
ok := CreateDir(Desti + "\" + Search.Name);
if not ok then ShowMessage("No se pudo crear el directorio: "+
Search.Name)
else CopiaDirectori(Origen+"\"+Search.Name,Desti+"\"+Search.Name);
end;
end;
Files := FindNext(Search);
end;
FindClose(Search);
end;
برگرفته شده از سایت دنیای برنامه نویسی دلفی(http://mt85.blogfa.com)
برگرفته شده از سایت دنیای برنامه نویسی دلفی(http://mt85.blogfa.com)
برای ذخیره کردن در فیلد بانک اطلاعاتی
Table1.Append;
Table1Imagen.LoadFromfile("c:\image?.jpg");
Table1.Post;
نحوه لود کردن یک عکس از فیلد باینری بانک اطلاعاتی
procedure TForm1.Button2Click(Sender: T);
var
Jpeg:TJpegImage;
Corriente:TMemoryStream;
begin
{We crate a TJPejImage and a TMemoryStream}
Jpeg:=TJpegImage.create;
Corriente:=TMemoryStream.create;
{Save the binary field in the stream}
Table1Imagen.SaveToStream(Corriente);
{Rewind the stream}
Corriente.Seek(0,soFromBeginning);
{Load the stream into the TJpegImage}
Jpeg.LoadFromStream(Corriente);
{Assign the TJpegImage to the Image1 of the form}
Image1.Picture.Assign(Jpeg);
{Free the temporal things}
Corriente.Free;
Jpeg.Free;
end;
procedure TForm1.StringGrid1DrawCell(Sender: T; Col, Row: Integer;
Rect: TRect; State: TGridDrawState);
var
Grid : TStringGrid;
Texto : String;
const
{Escoger una de las tres}
{Choose one}
ALINEACION =
// DT_LEFT;
// DT_RIGHT;
DT_CENTER;
begin
Grid := TStringGrid(Sender);
if (Row < Grid.FixedRows) or (Col < Grid.FixedCols)
then
Grid.Canvas.Brush.Color := clBtnFace
else
Grid.Canvas.Brush.Color := clWhite;
Grid.Canvas.FillRect(Rect);
Texto := Grid.Cells[Col,Row];
DrawText( Grid.Canvas.Handle,
PChar(Texto),
StrLen(PChar(Texto)),
Rect,
ALINEACION);
end;
برگرفته شده از سایت دنیای برنامه نویسی دلفی(http://mt85.blogfa.com)
procedure TForm1.FormCreate(Sender: T);
var
hMenuHandle : HMENU;
i:Integer;
begin
hMenuHandle := GetSystemMenu(handle, FALSE);
if (hMenuHandle <> 0) then begin
DeleteMenu(hMenuHandle, SC_CLOSE, MF_BYCOMMAND);
i := GetMenuItemCount(hMenuHandle)-1;
if i > -1 then
DeleteMenu(hMenuHandle,i,MF_BYPOSITION);
end;
end;
procedure TForm1.Button1Click(Sender: T);
const CLAVE =
"\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
var
reg : TRegistry;
Lista : TStringList;
Lista2 : TStringList;
i,n : integer;
begin
{Create temporal things}
reg := TRegistry.Create;
Lista := TStringList.Create;
Lista2 := TStringList.Create;
{Load all the subkeys}
with Reg do
begin
RootKey := HKEY_LOCAL_MACHINE;
OpenKey(CLAVE,false);
GetKeyNames(Lista);
end;
{Load all the Value Names}
for i := 0 to Lista.Count -1 do begin
reg.OpenKey(CLAVE + "\" +Lista.Strings[i],false);
reg.GetValueNames(Lista2);
{We will show only if there is "DisplayName"}
n:=Lista2.IndexOf("DisplayName");
if (n <> -1) and (Lista2.IndexOf("UninstallString")<>-1) then
begin
{DisplayName+UnInstallString}
Memo1.Lines.Append ( reg.ReadString(Lista2.Strings[n])+"-"+
reg.ReadString(Lista2.Strings[Lista2.IndexOf("UninstallString")]) );
end;
end;
{Free temporals}
Lista.Free;
Lista2.Free;
reg.CloseKey;
reg.Destroy;
end;
برگرفته شده از سایت دنیای برنامه نویسی دلفی(http://mt85.blogfa.com)
نحوه اضافه کردن یک ستون برای شماره ردیف در گرید
{+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1. create new blank field in dbgrid
2. rename the title with "No"
3. put this code in OnDrawColumncell
4. Now your Grid has a row number
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
procedure TForm1.DBGrid1DrawColumnCell(Sender: T; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if DataSource1.DataSet.RecNo > 0 then
begin
if Column.Title.Caption = "No" then
DBGrid1.Canvas.TextOut(Rect.Left + 2, Rect.Top, IntToStr(DataSource1.DataSet.RecNo));
end;
end;
برگرفته شده از سایت دنیای برنامه نویسی دلفی(http://mt85.blogfa.com)
نحوه افزدون کابر - تعریف کاربر برای لاگین در بانک اس کیو ال سرور
procedure TForm1.Button1Click(Sender: T);
begin
ADOConnection1.Connected := True;
ADOCommand1.CommandText := "Exec SP_AddLogin " + QuotedStr("UserName") +
"," + QuotedStr("Password") + "," + QuotedStr("Database Name") + "," +
QuotedStr("English") + ";";
ADOCommand1.Execute;
end;
برگرفته شده از سایت دنیای برنامه نویسی دلفی(http://mt85.blogfa.com)
برای ریجستر کردن فایل های
ocx از این روش استفاده نماییدprocedure TForm1.Button1Click(Sender: T);
type
TDLLRegisterServer = function: HResult stdcall;
var
MangoOCX : THandle;
Registrar : TDllRegisterServer;
begin
{Cargamos el OCX}
{Load the OCX}
MangoOCX:= LoadLibrary("c:\windows\system\html.ocx");
{Hallamos la direccion de la funcion para registrar el OCX}
{Get the address to register the OCX}
Registrar:= GetProcAddress(MangoOCX, "DllRegisterServer");
{Llamamos a la funci?n}
{Call to the function}
if Registrar <> 0 then ShowMessage("Error");
{Liberamos el OCX}
{Free the OCX}
FreeLibrary(MangoOCX);
end;
برگرفته شده از سایت دنیای برنامه نویسی دلفی(http://mt85.blogfa.com)
یک ساعت فوق العاده
اضافه کردن زبان فارسی به ویندوز XP
یک Message Dialog با امکان تغییر نوشته ی دکمه و تمام قسمتها
بستن پنجره
پاک کردن برنامه به وسیله ی خودش
دانلود کردن سورس یک سایت
بدست آوردن آدرس جاری IE
پاک کردن آدرسهای IE
آموزش کار با IntraWeb در دلفی
مبدل ها
تصویر به bmp2icon) Icon)
تشخیص اینکه HARD DISK ما چند درایو دارد.
اینم یک برنامه ای که ICON درایوها را تغییر می دهد.
درست کردن فیلتر زرد رنگ روی ایمیج
[همه عناوین(126)][عناوین آرشیوشده]
بازدید دیروز: 42
کل بازدید :88482

در این وبلاگ سعی میکنم مطالب مربوط به برنامه نویسی دلفی ، پاسکال و گرافیک رایانه ای 2 بعدی و 3 بعدی را به روز کنم منتظر سوالات شما نیز هستم
قویترین سایت دانلود رایگان نرم افزار [18]
دانلود رایگان نرم افزار [40]
دایره المعارف فارسی رایانه [22]
اخبار فناوری 2 [29]
فروش انواع نوت بوک [32]
کتابخانه مجازی ایران [25]
مقالات آماده کامپیوتری [33]
بزرگترین سایت دانلود3 [74]
اخبار فناوری 1 [18]
خفن ترین کدهای جاوا اسکریپت [29]
قیمت انواع سخت افزار2 [34]
آخرین قیمت سخت افزار ها [23]
دانلود کتاب های فارسی [49]
علم الکترونیک و کامپیوتر [28]
[آرشیو(20)]
