打印本文 打印本文 关闭窗口 关闭窗口
在Windows操作系统中改变文件打开方式
作者:武汉SEO闵涛  文章来源:敏韬网  点击数1739  更新时间:2009/4/23 14:58:29  文章录入:mintao  责任编辑:mintao
n,“请注意”
   End If
   OSRegCloseKey (hKey)
  End Sub
  6、按F5运行程序,在简体中文Windows95/NT/98、VB5.0/6.0环境中调试通过。
  ㈡利用Delphi编程
  1、在Delphi3.0 IDE中,新建工程Project1,在Form1上添加按钮Button1。
  2、在uses子句中添加Registry。
  3、双击Button1,编写Click事件代码。
  procedure TForm1.Button1Click(Sender: Tobject);
  var
   MyRegistry : TRegINIFile;
   Return:string;
  begin
   try
   MyRegistry := TRegINIFile.Create(``);
  MyRegistry.RootKey := HKEY_CLASSES_ROOT;
   Return:=MyRegistry.ReadString (`.gid`,``,`No! Not Found the Key!`);
   MyRegistry.WriteString(Return,``,`这只是一个演示!`);
   MyRegistry.WriteString(Return+`\DefaultIcon`,``,`c:\visio.exe,1`);
   MyRegistry.WriteString(Return+`\shell\open\command`,``,`c:\visio.exe %1`);
   finally
   MyRegistry.Free;
   end;
   ShowMessage(`改变文件打开方式成功!`);
  end;
  4、按F9运行程序,在简体中文Windows95/NT/98、Delphi3.0/4.0环境中调试通过。

上一页  [1] [2] 

打印本文 打印本文 关闭窗口 关闭窗口