登录
首页 » Delphi源码 » Delphi 简单获取Windows时间的例子

Delphi 简单获取Windows时间的例子

于 2022-07-09 发布 文件大小:5.81 kB
0 194
下载积分: 2 下载次数: 1

代码说明:

简单获取Windows时间-Delphi源代码,改时间的小程序,在Windows自带的时间管理中也可完成系统时间的修改,这个只是一个帮助了解Windows与Delphi编程的例子,如何通过Delphi的程序来修改Windows时间,大致就是这样实现的。可参见以下源码:   procedure TForm1.Button1Click(Sender: TObject);   var    Dtimer : TSystemTime;    hh,Ghh : Integer;   begin    hh := StrToInt(Trim(Edit4.Text));    if hh < 8 then    Ghh := 16 + hh    else    Ghh := hh - 8;    with Dtimer do    begin    wYear:=StrToInt(Edit1.Text);    wMonth:=StrToInt(Edit2.Text);    wDay:=StrToInt(Edit3.Text);    wHour:=Ghh;    wMinute:=StrToInt(Edit5.Text);    wSecond:=StrToInt(Edit6.Text);    end;    SetSystemTime(Dtimer);   end;

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • Delphi 获取MonthCalendar中选择的日期
    Delphi 获取MonthCalendar中选择的日期,其实就是完成一个时间、日期的选择功能,年份、月份、日期、时间都可自定义调整并选择,这个简单的例子,可演示Delphi中MonthCalendar的用法,生成一个日期时间选择器功能。下面是相关代码:   procedure TForm1.Button1Click(Sender: TObject);   var    Year,Month,Days: Word;   begin    DecodeDate(MonthCalendar1.Date,Year,Month,Days);    Edit1.Text:=IntToStr(Year);    Edit2.Text:=IntToStr(Month);    Edit3.Text:=IntToStr(Days);   end;   全部源码请下载本实例包。
    2022-02-02 06:32:18下载
    积分:1
  • Delphi 打印图形(图片)
    Delphi 打印图形,把图片打印出来,通过这个例子,你可以学习到:    strect:Trect;//定义打印输出矩形框的大小    temhi,temwd:integer;   begin    if DIGPrint.execute then    begin    temhi:=imgpic.picture.height;    temwd:=imgpic.picture.width;    while (temhi = printer.pageheight div 2)and    //将图形放大到打印页面的1/2大小    (temwd = printer.pagewidth div 2) do    begin    temhi:=temhi+temhi;    temwd:=temwd+temwd;    end;    with strect do //定义图形在页面上的中心位置输出    begin    left := (printer.pagewidth -temwd) div 2;    top := (printer.pageheight-temhi) div 2;    right := left+temwd;    bottom := top+temhi;    end;    with printer do    begin    begindoc;    canvas.stretchdraw(strect,imgpic.picture.graphic);    enddoc;    end;    end;
    2022-10-24 23:35:04下载
    积分:1
  • Delphi 监测程序多久未被使用
    Delphi 监测程序多久未被使用,以秒数来衡量使用了多久,打开一次然后再关闭,就可以显示使用了多长时间。
    2022-06-02 20:45:39下载
    积分:1
  • Delphi控制电脑蜂鸣器或扬声器发声音
    Delphi控制电脑蜂鸣器或扬声器发声音,有些称之为喇叭,不过测试发现,这个是优先机箱蜂鸣器发出声音,或没装蜂鸣器,则会从音箱中发声音,实现的代码很简单,以下代码即可实现:   procedure TForm1.Button1Click(Sender: TObject);   var    i,j : integer;   begin    for i := 1000 to 2000 do    begin    j := i;    windows.Beep(1000,3000);    end;   end;
    2022-02-05 03:44:28下载
    积分:1
  • 在输入时按回车移动光标到一下文本框-Delphi示例
    Delphi实现回车移动焦点的功能,当用户在输入时按回车键,将移动光标到一下文本框,这个功能我觉得可很好的提升软件的操作体验,为实现快捷输入近了一步。具体代码请参考如下:   begin    if Key = 13 then    begin    keybd_event(VK_TAB,0,KEYEVENTF_EXTENDEDKEY,0); //按下    keybd_event(VK_TAB,0,KEYEVENTF_EXTENDEDKEY or KEYEVENTF_KEYUP,0); //弹起    end;   end;
    2022-08-21 20:36:32下载
    积分:1
  • Delphi 7.0 在局域网内发消息
    Delphi 7.0 在局域网内发消息,这个本站收集有很多例子了,学习Delphi网络编程可参考的例子,Delphi网络发消息,局域网发消息的例子,敬请关注。   局域网内发消息核心代码:   procedure TFrmSendMessage.Sendmessage(const msg,tomachine,from:string);   var    ms:PWideChar;   begin    ms:=PWIDEChar(WideString(msg));    NetMessageBufferSend(nil,pWidechar(WideString(tomachine)),pWidechar(WideString(from)),ms,length(msg)*2);   end;   procedure TFrmSendMessage.BtnSendClick(Sender: TObject);   begin    Sendmessage(mmMessage.Text,EDTo.Text,EDFrom.Text);   end;
    2022-04-01 17:32:07下载
    积分:1
  • Delphi 演示使用演示Brush对象的各种风格
    Delphi 演示使用演示Brush笔刷对象后生成的各种风格,一种演示了7种笔刷效果,定义了一个存储绘图风格的7维数组,然后使用For循环对绘图风格数组赋值,然后使用Canvas.Brush.Style来预览风格。这些笔刷风格都是浅色彩的风格。
    2022-07-08 18:13:17下载
    积分:1
  • Delphi 利用API绘制弧形
    Delphi 利用API绘制弧形,   begin    ArcRect := ClientRect;    Canvas.Pen.Width:=2;    for i:=1 to 10 do    begin    Arc(Canvas.Handle,ArcRect.Left,ArcRect.Top,ArcRect.Right,    ArcRect.Bottom,ArcRect.Right,(ArcRect.Bottom-ArcRect.Top) div 2,    ArcRect.Left,(ArcRect.Bottom-ArcRect.Top) div 2);    InflateRect(ArcRect,-2,-2);    Canvas.Pen.Color := PaletteIndex(i+10);    end;
    2022-03-21 03:44:09下载
    积分:1
  • Delphi 制作红绿眼镜三维立体画
    这是一个Delphi色彩控制方面的示例,我看上去更像是Delphi分离出红绿颜色通道,从页形成的一种立体效果,复制和修改颜色模式来实现,相关代码可参考如下:    //设置添充颜色的大小    DBitmap.Width := LBitmap.Width;    DBitmap.Height := LBitmap.Height;    vRect := Rect(0, 0, DBitmap.Width, DBitmap.Height); //获取添充区域    DBitmap.Canvas.Brush.Color := vGreen; //设置画笔颜色    DBitmap.Canvas.FillRect(vRect); //添充颜色    LBitmap.Canvas.CopyMode := cmSrcPaint; //将复制模式改为OR    LBitmap.Canvas.CopyRect(vRect, DBitmap.Canvas, vRect); //对图片进行复制    DBitmap.Canvas.Brush.Color := vRed;    DBitmap.Canvas.FillRect(vRect);    RBitmap.Canvas.CopyMode := cmSrcPaint; //将复制模式改为OR    RBitmap.Canvas.CopyRect(vRect, DBitmap.Canvas, vRect); //对图片进行复制    DBitmap.Canvas.CopyRect(vRect, LBitmap.Canvas, vRect);    DBitmap.Canvas.CopyMode := cmSrcAnd; //将复制模式改为AND    DBitmap.Canvas.CopyRect(vRect, RBitmap.Canvas, vRect);    except    Exit;    end;    Result := True;   end;
    2023-02-01 08:05:04下载
    积分:1
  • Delphi 在图片中写入文字
    在图片中写入文字(写入文字后按回车键),Delphi 图片合成 效果,图片与字符的合并,在图片中写入文字,就像PhotoShop中完成的效果,有兴趣的参考源码吧。
    2023-03-24 10:00:04下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载