Archive for the ‘Ostatné/Other’ Category

Doba vykonávania funkcie

utorok, august 31st, 2010
 //---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit2.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
	: TForm(Owner)
{
TDateTime t(Now());

for(int x=0;x<1000;x++){Sleep(1); }

TDateTime u(Now());
Caption=AnsiString(FormatFloat("0.000",(double(u-t)*24*3600)))+" sec";
t=u;
}
//---------------------------------------------------------------------------

ProcessMemoryInfo

streda, august 18th, 2010
//---------------------------------------------------------------------------
#include <vcl.h>
#include <vcl/PsAPI.hpp>
#pragma hdrstop
#pragma link "psdk/psapi.lib" //k projektu je treba pridať knižnicu psapi.lib (default: C:\Program Files\Borland\BDS\4.0\lib\psdk\psapi.lib)

#include "Unit2.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"

TForm2 *Form2;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
	: TForm(Owner)
{ 
 /*THeapStatus hp=GetHeapStatus(); //pri zapnutom CodeGuard vracia NULL
Caption=hp.TotalAddrSpace; */
    HANDLE hProcess;
    SIZE_T  dwMin, dwMax;
    PROCESS_MEMORY_COUNTERS pmc;

hProcess=GetCurrentProcess() ;
GetProcessWorkingSetSize(hProcess, &dwMin, &dwMax);
GetProcessMemoryInfo( hProcess, &pmc, sizeof(pmc));
Caption="Akt: "+AnsiString(pmc.WorkingSetSize)+" Min: "+AnsiString(dwMin)+" Max: "+AnsiString(dwMax);
}

StringGrid – Select on right mouse click

streda, júl 21st, 2010
void __fastcall TForm2::StringGrid1MouseUp(TObject *Sender, TMouseButton Button,
	  TShiftState Shift, int X, int Y)
{
int row, col;
TGridRect rect=TGridRect();

StringGrid1->MouseToCell(X, Y, row, col);
rect.Left=0; //alebo 'row' pre označenie iba jednej cell
rect.Top=col;
rect.Right=9; //alebo 'row' pre označenie iba jednej cell
rect.Bottom=col;
StringGrid1->Selection=rect;
}

Zmena pozadia plochy/Change desktop background

nedeľa, jún 6th, 2010

Zmena pozadia pracovnej plochy - obrázok musí byť bitmapa (.BMP).

SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "c:\\pozadie.bmp", SPIF_UPDATEINIFILE)

IP info

sobota, jún 5th, 2010

ip
(viac…)