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. 关于自定义jar包(tomcat)的添加

    1 鼠标右击工程 选择 properties 或者 Ait + Enter 2 选择Libraries 3 点击Add Library... 4 选择User Library  点击 Next 5 如 ...

  2. FusionCharts 分类以及各个属性参数列表

    <FusionCharts学习及使用笔记>之 第一篇 其实一直以来我都在有意无意的把我平常工作中遇到并解决的问题做个记录,放到我的网易博客中.但却一直没有想过如何把我使用的技术做一个系列化 ...

  3. Android ART

    这几天在做一个项目时需要在Android中使用OSGi框架(Apache Felix),于是在一个android 4.4.2 版本系统的某品牌的平板上实验.实验内容很简单:把felix包里的felix ...

  4. LoadRunner 录制cas 登陆脚本

    关于CAS 的概念,见链接:http://www.360doc.com/content/15/0204/17/21706453_446251626.shtml 需要增加4个关联函数 //Correla ...

  5. git archive

    git archive --format zip --output ../g.zip 3.4.2 git archive --format=tar \ --remote=ssh://remote_se ...

  6. Tinyproxy

    Tinyproxy Tinyproxy is a light-weight HTTP/HTTPS proxy daemon for POSIX operating systems. Designed ...

  7. Struts2不配置result参数 进行跳转实现

    的 this.getRequest().getRequestDispatcher("url").forward(this.getRequest(),this.getResponse ...

  8. Ueditor的配置及使用

    Ueditor官网:http://ueditor.baidu.com/website/    (项目需要JSP版本:UTF-8版) 1.配置 <script type="text/ja ...

  9. precision、recall、accuracy的概念

    机器学习中涉及到几个关于错误的概念: precision:(精确度) precision = TP/(TP+FP) recall:(召回率) recall = TP/(TP+FN) accuracy: ...

  10. WKWebKit基础

    UIWebView & UIWebViewDelegate 这个两个东西在 WKWebKit 中被重构成 14 个类 3 个协议. WKWebKit Framework Classes WKB ...