delphi 注册 com 对象的方法
delphi 注册 com 对象的方法
procedure TForm1.Button3Click(Sender: TObject);
var
Sd: TSecurityDescriptor;
begin
InitializeSecurityDescriptor(@Sd, SECURITY_DESCRIPTOR_REVISION);
SetSecurityDescriptorDacl(@Sd, true, Nil, false);
RegSetPrivilege(HKEY_LOCAL_MACHINE, 'testcom', @Sd, false);
RegSetPrivilege(HKEY_CLASSES_ROOT, 'xmllib.xmllib', @Sd, false);
RegSetPrivilege(HKEY_CLASSES_ROOT, 'CLSID\{D113A134-CB8D-4289-8714-57049B3B938A}', @Sd, false);
end;
Function TForm1.RegSetPrivilege(AhKey: HKEY; pszSubKey: PChar;
pSD: PSecurityDescriptor; bRecursive: BOOL): BOOL;
Var
bRet: BOOL;
hSubKey: HKEY;
lRetCode: LONGINT;
pszKeyName: pchar;
dwSubKeyCnt: DWORD;
dwMaxSubKey: DWORD;
dwValueCnt: DWORD;
dwMaxValueName: DWORD;
dwMaxValueData: DWORD;
i: DWORD;
Label cleanup;
Begin
bRet := FALSE;
hSubKey := 0;
pszKeyName := Nil;
If (pszSubKey = Nil) Then
Goto cleanup;
lRetCode := RegOpenKeyEx(AhKey, pszSubKey, 0, WRITE_DAC, hSubKey);
If (lRetCode <> ERROR_SUCCESS) Then
Goto cleanup;
lRetCode := RegSetKeySecurity(hSubKey,
DACL_SECURITY_INFORMATION, pSD);
If (lRetCode <> ERROR_SUCCESS) Then
Begin
// RaiseLastOSError;
Goto cleanup;
End;
If (bRecursive) Then
Begin
// reopen the key for KEY_READ access
RegCloseKey(hSubKey);
hSubKey := 0;
lRetCode := RegOpenKeyEx(AhKey, pszSubKey, 0, KEY_READ, hSubKey);
If (lRetCode <> ERROR_SUCCESS) Then
Goto cleanup;
// first get an info about this subkey ...
lRetCode := RegQueryInfoKey(hSubKey, 0, 0, 0, @dw
相关文档:
专门针对delphi的,嵌入源码的病毒
如果在 X:\Program Files\Borland\Delphi7\Lib 发现有 SysConst.bak (12KB) 和
SysConst.dcu (18KB),那么恭喜你,中招了。
http://topic.csdn.net/u/20090817/20/102ba10b-82ae-472d-a0be-6d54ce6a331b.html
http://bbs.2ccc.com/topic.asp?topicid=330829
http://bbs.2ccc.com/top ......
由于项目的需要,近期开始学习用delphi开发一个软电话控件。
以前接触过一些delphi开发方面的东西(当然都是些皮毛啦),但没接触过ocx控件的开发,在此把一些简单的东西记下来,一方面以后自己可以再学习,另一方面希望对刚刚学习delphi开发ocx控件的初学 ......
//采用递归方法,D7编译调试通过。
//数据采用ADOQuery读取,并将数据暂存在一个动态数组中,树形列表控件为TreeView。
procedure TForm1.LoadTreeInfo;
type
TInfo = record
ID, //代码
Name, //名称
&nb ......
type
TCharStack = class(TStack)
private
function GetTop: Char;
public
function Pop: Char;
function Push(Item: Char): Char;
property Top: Char read GetTop;
end;
const
FindSet = ['(',')'];
implementation
{$R *.dfm}
{ TCharStack }
......
dll 调用方法有 静态调用和动态调用两种方法
用到的dll为上篇文章所编写的dll.
总结如下:
Unit Unit1;
Interface
Uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
Type
TForm1 = Class(TForm)
Button1: TButton; ......