大悟还俗

邮箱 key_ok@qq.com 我的收集 http://pan.baidu.com/share/home?uk=1177427271
  新随笔  :: 联系 :: 订阅 订阅  :: 管理

2013年11月18日

摘要: unit Main;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs,TlHelp32, StdCtrls, ComCtrls,psAPI;type PTokenUser = ^TTokenUser; _TOKEN_USER = record User: TSIDAndAttributes; end; TTokenUser = _TOKEN_USER; TForm1 = class(TForm) btn... 阅读全文

posted @ 2013-11-18 17:25 大悟还俗_2 阅读(288) 评论(0) 推荐(0) 编辑

摘要: 为了显示效果,在钩子的DLL中我们会获取挂钩函数的窗体句柄,这里的主程序窗体名为"TestMain",通过FindWindow查找。KeyBoardHook.dll代码library KeyBoardHook;{ Important note about DLL memory management: ShareMem must be the first unit in your library's USES clause AND your project's (select Project-View Source) USES clause if your D 阅读全文

posted @ 2013-11-18 17:24 大悟还俗_2 阅读(816) 评论(0) 推荐(0) 编辑

摘要: 原理简单,在FTP上维护一个Update.ini文件,里面记录着要更新文件的版本号,本地也有一个Update.ini文件,每次启动更新程序时,先从FTP上下载Update.ini文件到本地名字为Update_new.ini,然后比较这两个文件,如果新的版本号大于旧的,或者新的文件在就ini中没有,这些就表示要更新的文件,然后逐一下载。 本程序名字为AutoUpdate,你生成这个exe,然后和主程序一起打包,创建桌面快捷方式时,指向AutoUpdate,而不是主程序。 在本地还有一个ini文件,比如叫ftp.ini吧,里面内容是[coninfo]main=Project1.exeparam=. 阅读全文

posted @ 2013-11-18 17:23 大悟还俗_2 阅读(439) 评论(0) 推荐(0) 编辑

摘要: 在很多程序中,都可以看到程序运行中,会有一个Dos窗口,实时显示一些运行信息,这里就告诉大家是如何实现的,我们做个简单的,其实对控制台的操作还有很多,有兴趣的可以去查资料。 用到的API函数如下: //创建控制台 AllocConsole; //获取控制台窗口 GetStdHandle; //向控制台输出信息 WriteConsole; //释放控制台 FreeConsole;unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs,.. 阅读全文

posted @ 2013-11-18 17:21 大悟还俗_2 阅读(523) 评论(0) 推荐(0) 编辑

摘要: 我们知道在文本框等可以接收输入的组件中,我们可以看到闪烁的光标,并可以输入文字,如果我们在,比如窗体上时,因为不支持输入,也无法显示闪烁的光标,那我们 有办法做自己的输入吗?当然可以,下面我们演示在Form上来输入文字。 用到的API函数如下GetTextMetrics:获取程序当前的字体信息,存放到TEXTMETRIC结构中CreateCaret:为系统插入标记创建一个新的形状,并且将插入标记的属主关系指定给特定的窗口。插入标记的形状。可以是线、块或位图ShowCaret:显示光标SetCaretPos:设置光标的位置unit Unit1;interfaceuses Windows, Me. 阅读全文

posted @ 2013-11-18 17:20 大悟还俗_2 阅读(633) 评论(0) 推荐(0) 编辑

摘要: RTTI需要引用单元TypeInfo至于RTTI的数据结构,大家可以参考TypeInfo单元的代码看例子,先为大家介绍一下根据字符串找到属性,并且对其修改的例子根据属性字符串找到属性,并修改属性GetPropInfo 函数用于获得属性的 RTTI 指针 PPropInfo。它有四种重载形式,后面三种重载的实现都是调用第一种形式。AKinds 参数用于限制属性的类型,如果得到的 PPropInfo 不属于指定的类型,则返回 nil。 function GetPropInfo(TypeInfo: PTypeInfo; const PropName: string): PPropInfo; func 阅读全文

posted @ 2013-11-18 17:19 大悟还俗_2 阅读(265) 评论(0) 推荐(0) 编辑

摘要: 功能: 根据省份更新地市信息-------------------------------------------------------------------------------}procedure TForm.GetCityInfo;var iXMLAreaFile : IXMLDocument; sFileName,aProvince,sProvince,sCity : string; nCol,nNum,nCityCount,nprovinceCount : Integer;begin iXMLAreaFile := TXMLDocument.create(nil)... 阅读全文

posted @ 2013-11-18 17:15 大悟还俗_2 阅读(985) 评论(0) 推荐(0) 编辑

摘要: procedure CreateParams(var Params: TCreateParams); override; procedure MainForm.Createparams(var Params: TCreateParams);begin inherited; With Params do begin WndParent := Application.MainForm.Handle; Params.ExStyle := WS_EX_TOPMOST; end;end;View Code 阅读全文

posted @ 2013-11-18 17:12 大悟还俗_2 阅读(510) 评论(1) 推荐(0) 编辑

摘要: 例如对windows发消息让文本选中。 SendMessage(Text1.hwnd,EM_GETSEL,0,-1); EC_LEFTMARGIN(&H1) EC_USEFONTINF //设置左边距时使用EC_RIGHTMARGIN EC_USEFONTINF //设置右边距时使用EC_USEFONTINF,O//边距 设置编辑控件的左、右边距,当wParam含EC_LEFTMARGIN时在lParam的低16位指定左边距点数,当wParam含EC_RIGHTMARGIN时在lParam的高16位指定右边距点数。当指定wParam为EC_USEFONTINFO时,则用当前字体的字符& 阅读全文

posted @ 2013-11-18 15:02 大悟还俗_2 阅读(404) 评论(0) 推荐(0) 编辑

摘要: library Hook;uses SysUtils, Windows, Classes, ApiDefine in 'ApiDefine.pas', APIHook in 'APIHook.pas';{$R *.res}var HookHandle: HHook;function HookProc(code:Integer;wparam:WPARAM;lparam:LPARAM):LRESULT;stdcall;begin Result := CallNextHookEx(HookHandle,code,wparam,lparam);end;procedure 阅读全文

posted @ 2013-11-18 10:37 大悟还俗_2 阅读(315) 评论(0) 推荐(0) 编辑

摘要: unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ComCtrls;type //导入表元素结构 TImageImportDiscriptor = packed record OriginalFirstThunk: DWORD; DataTimpStamp: DWORD; ForwardChain: DWORD; DLLName: DWORD; FirstThunk: D... 阅读全文

posted @ 2013-11-18 10:36 大悟还俗_2 阅读(634) 评论(0) 推荐(0) 编辑

摘要: uses mshtml, ActiveX;//初始加载网易主页procedure TForm1.FormCreate(Sender: TObject);begin Webbrowser1.Navigate('http://www.163.com/');end;procedure TForm1.Button1Click(Sender: TObject);varI: Integer;Document: IHTMLDocument2;Element: IHTMLElement;Anchors: IHTMLElementCollection;sLink: string;begin // 阅读全文

posted @ 2013-11-18 10:32 大悟还俗_2 阅读(238) 评论(0) 推荐(0) 编辑

摘要: DDE(Dynamic Data Exchange),称为动态数据交换。用于进程间的通讯,看看他如何来和Word交互。在System页签下有TDdeClientConv组件,拖一个放到界面上,然后我们写如下代码:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, OleServer, StdCtrls, DdeMan;type TForm1 = class(TForm) Button1: TButton; Dde... 阅读全文

posted @ 2013-11-18 10:30 大悟还俗_2 阅读(315) 评论(0) 推荐(0) 编辑

摘要: unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ComCtrls;type TForm1 = class(TForm) PageControl1: TPageControl; TabSheet1: TTabSheet; TabSheet2: TTabSheet; procedure FormCreate(Sender: TObject); private { Private declara... 阅读全文

posted @ 2013-11-18 10:29 大悟还俗_2 阅读(455) 评论(1) 推荐(0) 编辑

摘要: PMouseHookStruct = ^TMouseHookStruct; {$EXTERNALSYM tagMOUSEHOOKSTRUCT} tagMOUSEHOOKSTRUCT = packed record pt: TPoint; hwnd: HWND; wHitTestCode: UINT; dwExtraInfo: DWORD; end; TMouseHookStruct = tagMOUSEHOOKSTRUCT;library Mouse_HookDLL;{ Important note about DLL memory management: S... 阅读全文

posted @ 2013-11-18 10:27 大悟还俗_2 阅读(418) 评论(0) 推荐(0) 编辑

摘要: 数据库结构:包括两张表BaseData和UserRightData,BaseData中是一张基本表,里面不区分用户,UserRightData是用户权限表,结构和BaseData一样,只是多了用户字段,增加用户时,就是从BaseData表中复制数据到UserRightData中,并标识用户ID。字段说明:FucCode:该字段与控件tag对应FucName:功能名称IsSel:是否有权限的标志IsFuc:标识该项是否是可以执行的功能FucPID:父节点ID,用来生成树形结构时用权限管理单元:UserRightCenterunit UserRightCenter;interfaceuses W. 阅读全文

posted @ 2013-11-18 10:26 大悟还俗_2 阅读(453) 评论(0) 推荐(0) 编辑

摘要: procedure TUIOperate.FillTree(treeview: TTreeView);var findq: TADOQuery; node: TTreeNode; //这个方法是根据记录的id字段值,查找TreeView上的父节点 function FindParentNode(id:Integer):TTreeNode; var i:Integer; begin Result := nil; for i := 0 to treeview.Items.Count - 1 do begin //比较Node的Data值和记录的id值 ... 阅读全文

posted @ 2013-11-18 10:23 大悟还俗_2 阅读(323) 评论(0) 推荐(0) 编辑

摘要: 关键字:MethodAddress:取得方法的地址,这个方法需要是published的。unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TShowInfo = procedure(info:string) of object; //声明一个procedure类型,参数和ShowInfo一致 TForm1 = class(TForm) Button1: TButton; pr... 阅读全文

posted @ 2013-11-18 10:22 大悟还俗_2 阅读(212) 评论(0) 推荐(0) 编辑

摘要: 这是DLL的代码library MyDll;uses SysUtils, Dialogs, Classes;procedure ShowInfo(info:PChar);stdcall;begin ShowMessage('您选择了【'+info+'】');end;function GetCaption:Pchar;begin Result := '中国';end;exports ShowInfo, GetCaption;{$R *.res}beginend.View Code 这是调用窗体的代码本例只使用了一个DLL,所以当有多个DLL时,需要 阅读全文

posted @ 2013-11-18 10:21 大悟还俗_2 阅读(397) 评论(0) 推荐(0) 编辑

摘要: SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE) or WS_EX_TRANSPARENT or WS_EX_LAYERED ); WS_EX_ACCEPTFILES = 0x00000010 指明了一个已创建视窗具有拖拽文件功能 WS_EX_APPWINDOW = 0x00040000 强制一个可见的顶级视窗到工具栏上 WS_EX_CLIENTEDGE = 0x00000200 使一个视窗具有凹陷边框 WS_EX_COMPOSITED = 0x02000000 Windows XP:... 阅读全文

posted @ 2013-11-18 10:18 大悟还俗_2 阅读(1646) 评论(0) 推荐(0) 编辑