易截截图软件、单文件、免安装、纯绿色、仅160KB

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中拼装SQL语句的注意点

我使用delphi也不是很长时间,由于经常要用到SQL语句,总结了一些Delphi中使用SQL语句要注意的事项,归纳起来主要有一下几条:
一、空格不要漏:
我们经常要拼装SQL语句,特别是where条件句,在各个语句中别忘了头尾加上空格。因为在一个语句中我们会注意用空格分开关键字但是往往忘了头尾的空格。例如:
sSQL=' select ......

用Delphi开发JNI(Java+Native+Interface)应用

JNI(Java+Native+Interface,Java本地接口)技术大家都不陌生,它可以帮助解决Java访问底层硬件的局限和执行效率的提高。关于JNI的开发,大多数资料讨论的都是如何用C/C++语言开发JNI,甚至于JDK也提供了一个javah工具来自动生成C语言程序框架。但是,对于广大的Delphi程序员来说,难道就不能用自己喜爱的Delphi与Java互通消 ......

Delphi中使用DirectX截屏函数


转自:http://www.52delphi.com/List.asp?ID=597&Page=1
  核心提示:函数需要 uses Direct3D9,D3DX9; 偶然发现一个函数可以直接保存表面到文件1!所以修改了一下,函数为:...
procedure CaptureScreen(Const FileName: string);
var
BitsPerPixel: Byte;
pD3D: IDirect3D9;
pSurface: IDirect3DSurface9;
......

Delphi和C++数据类型对照表

Delphi和C++数据类型对照表
Delphi        字长/值域                                C++
ShortInt  &n ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号