疯狂的代码,疯狂的程序人生!

疯狂的代码

当前位置: 主页 > Delphi >
  • [pacal基础] 如何做出最小的可执行程序 日期:2011-07-09 13:11:10 点击:65 好评:0

    曾经在网上看到有人说Delphi能够产生大小只有16k的Win32应用程序,而我自己曾经编写过的这种可执行文件大小则是在17k左右,因而我一度猜 想Delphi恐怕也只能将代码优化到这种程度了。最近由于测试的目的重新把这个程序写了一遍,才发现利用一些技巧,还能够将文...

  • [pacal基础] 动态修改显示器分辨率 日期:2011-07-09 13:10:43 点击:102 好评:0

    Windows提供给我们两个API函数,可以动态调整显示器的分辨率,他们是 numDisplaySettings () 和ChangeDisplaySettings(),下面这个例子就是了 function DynamicResolution(X, Y: word): BOOL; var lpDevMode: TDeviceMode; begin Result := EnumDisplaySetti...

  • [pacal基础] 切换大小写的例子 日期:2011-07-09 13:09:36 点击:103 好评:0

    CapLock(True); (* 大写 *)CapLock(False); (* 小写 *) (* 键盘大小写锁定 *)Procedure CapLock(bLockIt: boolean);Var Level : Integer; KeyState : TKeyBoardState;begin Level := GetKeyState(VK_CAPITAL); GetKeyboardState(KeyState); if bLockIt then...

  • [pacal基础] 三个消息函数的威力 日期:2011-07-09 13:09:00 点击:166 好评:0

    nputBox,InputQuery和ShowMessage函数的应用: uses dialogs; var s,s1:string; b:boolean; begin s:=trim(Inputbox(NewPassword,Password,masterkey)); b:=s; s1:=s; if b then b:=InputQuery(Confirm Password,Password,s1); if not b or (s1s) then ShowMe...

  • [pacal基础] 操作注册表的另一个例子 日期:2011-07-09 13:08:36 点击:171 好评:0

    随着Win32的广泛应用,INI文件的局限性逐渐显示出来,例如不能存放二进制的数据等。虽然简单,但也不利于保密。其实注册表的操作与INI文件类似。 操作注册表需要认识到注册表的六个根键。看看DELPHI的定义: const { Reserved Key Handles. } {$EXTERNALSYM HKEY...

  • [pacal基础] 读取注册表字体设置的例子 日期:2011-07-09 13:07:59 点击:113 好评:0

    unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Registry; type TForm1 = class(TForm) Button1: TButton; Button2: TButton; procedure WriteFontToRegistry(Sender: TObject); procedu...

  • [pacal基础] 查看注册表的例子 日期:2011-07-09 13:07:21 点击:136 好评:0

    unitregform; interface uses Windows,Messages,SysUtils,Classes,Graphics,Controls,Forms,Dialogs, StdCtrls,Registry; type TForm1=class(TForm) ListSub:TListBox; ListValues:TListBox; ComboKey:TComboBox; Label1:TLabel; Label2:TLabel; Label3:TLab...

  • [pacal基础] 限制文本框中只接受数字 日期:2011-07-09 13:06:37 点击:138 好评:0

    在窗体上,放一个TEXTBOX和BUTTON,当在TEXTBOX中输入非数字时,如果点击BUTTON, 则进行人机对话框作出提示: procedureTForm1.Button1Click(Sender:TObject); var i:integer; begin fori:=1tolength(edit1.text)do ifnot(edit1.text[i]in[0..9])then begin sho...

  • [pacal基础] 统计中英文字个数的例子 日期:2011-07-09 13:05:00 点击:110 好评:0

    想在文本控件TMemo中,分别对中、英文的字符数进行统计,我们可以通过把字符转换为数值来进行判断,Ord()函数把字符转换为对应的数值,值33-126为键盘可使用字符,值127以上的为未知字符,即为汉字. 代码如下: procedure TForm1.Button1Click(Sender: TObje...

  • [pacal基础] 限制文本框中只接受数字 日期:2011-07-09 13:04:32 点击:200 好评:0

    在窗体上,放一个TEXTBOX和BUTTON,当在TEXTBOX中输入非数字时,如果点击BUTTON, 则进行人机对话框作出提示: procedureTForm1.Button1Click(Sender:TObject); var i:integer; begin fori:=1tolength(edit1.text)do ifnot(edit1.text[i]in[0..9])then begin sho...

栏目列表
推荐内容