unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls; type
TForm1 = class(TForm)
ListBox1: TListBox;
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end; var
Form1: TForm1; implementation {$R *.dfm} function GetAllHandle(hwnd: Integer; lparam: Longint): Boolean; stdcall; //回调函数
var
buffer: array[..] of Char;
s: string;
int: integer;
begin
Result := True;
GetClassName(hwnd, buffer, );
Form1.listbox1.items.add(format('%d', [hwnd, StrPas(Buffer)])); //写入窗口ListBox1中
end; procedure TForm1.Button1Click(Sender: TObject);
var
handle: THandle;
begin
Handle := findWindow(nil, Pchar('Borland Delphi 7 Enterprise Edition - Installation Wizard')); //获得句柄
if Handle <> then
begin
EnumChildWindows(Handle, @GetAllHandle, Integer(@Handle)); // 枚举子窗体 if Form1.ListBox1.Items.Count = then //这是破解delphi7的代码片段,由Timer控制这段代码运行,由于Delphi7安装时打开的窗口比较多,这里对窗口作一个简单的分析,判断要写入注册码的窗口内的控件句柄是否为31个(0——30)
begin
handle := StrToInt(Trim(Form1.ListBox1.Items.Strings[])); //给delphi7输入注册码
SendMessage(handle, WM_SETTEXT, , Integer(PChar('6KN6')));
handle := StrToInt(Trim(Form1.ListBox1.Items.Strings[]));
SendMessage(handle, WM_SETTEXT, , Integer(PChar('PNWBQS')));
handle := StrToInt(Trim(Form1.ListBox1.Items.Strings[]));
SendMessage(handle, WM_SETTEXT, , Integer(PChar('PB?ZUB')));
handle := StrToInt(Trim(Form1.ListBox1.Items.Strings[]));
SendMessage(handle, WM_SETTEXT, , Integer(PChar('J8XW')));
handle := StrToInt(Trim(Form1.ListBox1.Items.Strings[]));
SendMessage(handle, WM_SETTEXT, , Integer(PChar('YC7')));
handle := StrToInt(Trim(Form1.ListBox1.Items.Strings[]));
SendMessage(handle, WM_SETTEXT, , Integer(PChar('24X'))); end; end
else
ShowMessage('抱歉,没有找到!'); end; procedure TForm1.Button2Click(Sender: TObject);
var
s:string;
BHandle:THandle;
begin
BHandle:=StrToInt(Edit1.Text);
S:='你好吗?OK吗?';
SendMessage(BHandle, WM_SETTEXT, , LongInt(lpstr(S))); //写入文本字符
end; end.

delphi下实现控制其它窗体中的控件代码模板(delphi 7安装程序)的更多相关文章

  1. 【机房系统知识小结点系列】之遍历窗体中的控件,判断Text是否为空?

    做机房系统时,几乎每个窗体中都会用到判断界面中的控件是否为空的情景.我们曾经是这样走来的: 第一版: 好处:对窗体界面中的Text等控件,逐一做判断,当用户输入某一项为空的时候,会议弹出框的形式,告诉 ...

  2. C# 向程序新建的窗体中添加控件,控件需要先实例化,然后用controls.add添加到新的窗体中去

    C# 向程序新建的窗体中添加控件,控件需要先实例化,然后用controls.add添加到新的窗体中去 Form settingForm = new Form(); setForm deviceSet ...

  3. C# 清除当前窗体中TextBox控件中的内容

    //当有多个窗体时,对顶层的窗口进行操作,例如:我们开发具有录入功能的界面的时候,为了防止提交后的二次(重复)录入,希望点击提交按钮并提示成功后,界面的所有文本框内容能够自动清空.NET Framew ...

  4. 设置Form窗体中的控件的属性

    借助于反射,可获取当前窗体中的所有控件,根据需要设置它们的属性. Font defaultFont = new System.Drawing.Font("Microsoft Sans Ser ...

  5. vb将窗体中的控件或某种颜色透明

    Option Explicit ' ******************** 窗体透明 ******************** '***Module.bas '**** Public Declare ...

  6. c# winform 在一个窗体中使用另一个窗体中TextBox控件的值——解决办法

    [前提]一个winform应用程序项目中,窗体B,需要使用 窗体A 中一个TextBox控件的值,进行计算等操作. [解决方案] 1.在窗体A中定义:public static double a;// ...

  7. winform 窗体中 Time 控件的用法

    作用: 用于背景进程中.通过引发Timer事件,Timer控件可以有规律的隔一段时间执行一次代码.也就是,你可以根据你自己的需要,给Timer控件设置时间,Timer每隔这段时间,就执行一次代码. 属 ...

  8. C# 中对WinForm窗体中的控件快速设置TableIndex次序

    点击“视图”--“Tab键顺序”,然后便可设置.

  9. winform窗体中查找控件

    private RichTextBox FindControl()        { RichTextBox ret = null;            try            {       ...

随机推荐

  1. 转 Fragment 和 FragmentActivity的使用

    今天学习下 Android中的 Fragment 和 FragmentActivity,因为没有4.0手机,平台是2.3.3 所以我是使用 v4 support 包来进行学习. 要想用Fragment ...

  2. C#中Dictionary的用法

    在C#中,Dictionary提供快速的基于兼职的元素查找.他的结构是这样的:Dictionary<[key], [value]> ,当你有很多元素的时候可以使用它.它包含在System. ...

  3. didMoveToSuperView 引发的思考

    1. - (void)didMoveToSuperview 通知视图已经移动到一个新的父视图中 2. /**系统自动调用(留给子类去实现)**/ - (void)didAddSubview:(UIVi ...

  4. make[1]: *** [/workopenwrt/trunk/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/stamp/.tools_install_nnnnn] Error 2 make[1]: Leaving directory `/work/openwrt/trunk' make: *** [world]

    主要原因是编译时未连上网,编译时需要下载些插件,连接网后,重启下系统再编译下.

  5. iOS的基本图形绘制

    绘图的步骤: 1.获取上下文 2.创建路径(描述路径) 3.把路径添加到上下文 4.渲染上下文 通常在- (void)drawRect:(CGRect)rect这个方法里面绘制图形 为什么要再draw ...

  6. 一个int类型引发的bug

    一.引言 今天我在项目开发中,遭遇了一个莫名其妙的问题,概括加抽象后形成如下问题:在使用MyBatis的XML语句实现Dao层接口 List<Person> selectBySome(@P ...

  7. mysql的一些特殊命令

    mysql命令行工具的编辑技巧 从mysql performace blog 中学到的: 1. pager 例子 mysql> pager more PAGER set to 'more' my ...

  8. 一道题看懂OC的文件管理:NSFileManager,计算文件包含内存大小

    计算文件夹下所有文件的大小 // 查看错误信息 __autoreleasing NSError *error; // 文件管理对象 NSFileManager *manager = [NSFileMa ...

  9. keil c51的内部RAM(idata)动态内存管理程序(转)

    源:keil c51的内部RAM(idata)动态内存管理程序 程序比较简单,但感觉比较有意思,个人认为有一定应用价值,希望大家有更好的思路和方法,互相促进. 程序的基本思路是:在CPU堆栈指针SP以 ...

  10. (简单) POJ 3259 Wormholes,SPFA判断负环。

    Description While exploring his many farms, Farmer John has discovered a number of amazing wormholes ...