Se agradece fary seguro a muchos les ayudara a entender el funcionamiento y no solo a copiar y pegar.
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes Menúuses
SysUtils,ActiveX,URLMon;
type
TBuffer=Array of Byte;
Function downloadFileBuffer(const URL:String):TBuffer;
var
stream:IStream;
sizeFile,sizeSet,bytesWritten:Int64;
buffer:TBuffer;
begin
Result:=nil;
if URLOpenBlockingStream (nil,pchar(URL),stream,0,nil)=S_OK then
begin
stream.Seek(0,STREAM_SEEK_END,sizeFile);
SetLength(buffer,sizeFile);
stream.Seek(0,STREAM_SEEK_SET,sizeSet);
stream.Read(@buffer[0],sizeFile,@bytesWritten);
Result:=buffer;
end;
end;
var
url:String;
buffer:TBuffer;
begin
url:='http://i67.tinypic.com/2v8lv88.png';
buffer:=downloadFileBuffer(url);
if buffer<>nil then
Writeln('Tamano del fichero leido ',Length(buffer))
else
Writeln('Hubo un error ');
Readln;
end.
typedef struct _SYSTEM_PROCESS_INFORMATION {
ULONG NextEntryOffset;
BYTE Reserved1[52];
PVOID Reserved2[3];
HANDLE UniqueProcessId;
PVOID Reserved3;
ULONG HandleCount;
BYTE Reserved4[4];
PVOID Reserved5[11];
SIZE_T PeakPagefileUsage;
SIZE_T PrivatePageCount;
LARGE_INTEGER Reserved6[6];
} SYSTEM_PROCESS_INFORMATION;
typedef struct _SYSTEM_PROCESS_INFORMATION
{
ULONG NextEntryOffset;
BYTE Reserved1[56];
// PVOID Reserved2[3];
HANDLE UniqueProcessId;
PVOID Reserved3;
ULONG HandleCount;
BYTE Reserved4[4];
PVOID Reserved5[11];
SIZE_T PeakPagefileUsage;
SIZE_T PrivatePageCount;
LARGE_INTEGER Reserved6[6];
} SYSTEM_PROCESS_INFORMATION;
ret = __SystemProcessInformation(5, spi, 1024*1024, NULL);
typedef enum _SYSTEM_INFORMATION_CLASS
{
SystemBasicInformation = 0,
SystemPerformanceInformation = 2,
SystemTimeOfDayInformation = 3,
SystemProcessInformation = 5,
SystemProcessorPerformanceInformation = 8,
SystemInterruptInformation = 23,
SystemExceptionInformation = 33,
SystemRegistryQuotaInformation = 37,
SystemLookasideInformation = 45
} SYSTEM_INFORMATION_CLASS;
__SystemProcessInformation(SystemProcessInformation, spi, 1024*1024, NULL);
Dim fechaini As DateTime
Dim fechafin As DateTime
Dim cobro As Integer=0
DateTime.TryParse("12:00", fechaini)
DateTime.TryParse("12:30", fechafin)
Dim dif As TimeSpan = fechafin - fechaini
If dif.Hours>=1 Then
cobro=cobro+(500*dif.Hours)
If dif.Minutes>15 Then
Dim n15min As Integer =dif.Minutes\15
cobro =cobro+n15min*150
End If
ElseIf dif.Minutes>=1 Then
cobro=500
End If
Console.WriteLine("Han transcurridos " & dif.Hours & ":" & dif.Minutes & " hrs.")
Console.WriteLine("El costo total es de "+Convert.ToString(cobro))
Console.ReadLine()