怎样有自己写的程序打开文件并读取? 我写了一个类似记事本的程序,保存文件后怎样双击保存的文件,然后调用这个程序打开读取里面的内容呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 写个注册表文件file.reg,加入系统注册表。如下REGEDITHKEY_CLASSES_ROOT\.文件扩展名 = 文件类型名称HKEY_CLASSES_ROOT\文件扩展名.Document\shell\open\command = 可执行文件名 %1HKEY_CLASSES_ROOT\文件扩展名.Document\shell\open\ddeexec = [open("%1")]HKEY_CLASSES_ROOT\文件扩展名.Document\shell\open\ddeexec\application = 可执行文件名缩写HKEY_CLASSES_ROOT\文件扩展名.Document = 文件类型名称 需要兩個:1.注冊文件關聯;//這一步是為了讓你在雙擊是得到文件的路徑參數;2.將路徑參數傳遞給你自己寫的程序;//這裡你可以在窗體的Create或者Show中判斷paramstr(1)這個參數,得到雙擊的文件名稱,打開之... var lphKey: HKEY; sKeyName: string; sKeyValue: string;begin sKeyName := 'myfile'; sKeyValue := '我的文档'; RegCreateKey(HKEY_CLASSES_ROOT, pchar(sKeyName), lphKey); RegSetValue(lphKey, '', REG_SZ, pchar(sKeyValue), 0); sKeyName := '.xyz'; sKeyValue := 'myfile'; RegCreateKey(HKEY_CLASSES_ROOT, pchar(sKeyName), lphKey); RegSetValue(lphKey, '', REG_SZ, pchar(sKeyValue), 0); sKeyName := 'myfile'; sKeyValue := 'c:\Windows\NotePad.exe %1'; RegCreateKey(HKEY_CLASSES_ROOT, pchar(sKeyName), lphKey); RegSetValue(lphKey, 'shell\open\command', REG_SZ, pchar(sKeyValue), MAX_PATH);end; 请各位请解一下modalresult 如何判断剪贴板不为空? 各位高手,请问如何使DELPHI的窗口不在任务栏显示??? 关于字符串数组的问题 怎样把Rave里面的page设置成A3的横向打印? 关于数据库操作的错误 多重条件查询问题? 如何判断一个目录是否存在?以及如何建立一个新的目录? 如何从内存中释放窗体?? 关于存储过程的输出参数。 江湖救急!!! 主从表中如果从主表得到它的子表?
REGEDIT
HKEY_CLASSES_ROOT\.文件扩展名 = 文件类型名称
HKEY_CLASSES_ROOT\文件扩展名.Document\shell\open\command = 可执行文件名 %1
HKEY_CLASSES_ROOT\文件扩展名.Document\shell\open\ddeexec = [open("%1")]
HKEY_CLASSES_ROOT\文件扩展名.Document\shell\open\ddeexec\application = 可执行文件名缩写HKEY_CLASSES_ROOT\文件扩展名.Document = 文件类型名称
1.注冊文件關聯;//這一步是為了讓你在雙擊是得到文件的路徑參數;
2.將路徑參數傳遞給你自己寫的程序;
//這裡你可以在窗體的Create或者Show中判斷paramstr(1)這個參數,得到雙擊的文件名稱,打開之...
lphKey: HKEY;
sKeyName: string;
sKeyValue: string;
begin
sKeyName := 'myfile';
sKeyValue := '我的文档';
RegCreateKey(HKEY_CLASSES_ROOT, pchar(sKeyName), lphKey);
RegSetValue(lphKey, '', REG_SZ, pchar(sKeyValue), 0);
sKeyName := '.xyz';
sKeyValue := 'myfile';
RegCreateKey(HKEY_CLASSES_ROOT, pchar(sKeyName), lphKey);
RegSetValue(lphKey, '', REG_SZ, pchar(sKeyValue), 0);
sKeyName := 'myfile';
sKeyValue := 'c:\Windows\NotePad.exe %1';
RegCreateKey(HKEY_CLASSES_ROOT, pchar(sKeyName), lphKey);
RegSetValue(lphKey, 'shell\open\command', REG_SZ, pchar(sKeyValue), MAX_PATH);
end;