uses ShellApi;
ShellExecute(Handle,'Open',pChar('MailTo:[email protected]'),nil,nil,SW_SHOWNORMAL);
ShellExecute(Handle,'Open',pChar('MailTo:[email protected]'),nil,nil,SW_SHOWNORMAL);
解决方案 »
- 关于重复键
- 如何用WordApplication1和WordDocument1设置word文档安全性?
- 怎样用Delphi构建一个先进先出的队列,在线等 ,急急!请高手进来解答下
- 哪位兄弟有photoshop样式的 PageControl/TabControl?
- 新手提问一个有关多个edit输入的问题
- 如何正确安装控件。
- 我想做这样的效果,当鼠标点击屏幕就记录下当前的坐标,高手请帮忙
- 如何保存image控件上某块位置上的图像到本地?
- dbgrid的问题,请帮忙!
- delphi5的双语还要比delphi7要好么?
- 我在自学Delphi,可是有许多不懂的地方,想多多的练习实例,可是没有呀,请问哪位大侠知道有下载的吗?
- 我想知道怎样才可以将Quickrep中的数据导入EXcel
//从注册表中找出有关系统默认浏览器的信息****************************************
//==============================================================================
function GetBrowser:string;
const Extension: array[0..3] of string = ('.HTM', '.HTML', '.SHTML', '.SHTM');
var
i: byte;
Hkey1,Hkey2: Hkey;
Typ,Taille: integer;
Temp: array[0..1024] of char;
Tempstr: string;
//****************************************************************************
procedure Arrange;
var j:word;
begin
Tempstr:=StrPas(Temp);
j:=1;
repeat
if Tempstr[j] <> '%' then Inc(j) else Delete(Tempstr,j,2);
until j>=Length(Tempstr);
RegCloseKey(Hkey2);
GetBrowser := Tempstr;
end;
begin
i:=0;
repeat
if RegOpenKeyEx(Hkey_CLASSES_ROOT, pchar(Extension[i]), 0, KEY_ALL_ACCESS, Hkey1) = 0 then
begin
if RegQueryValueEx(Hkey1, nil, nil, @Typ, nil, @Taille) = ERROR_SUCCESS then
begin
RegQueryValueEx(Hkey1, nil, nil, nil, @Temp, @Taille);
if Temp<>'' then
if RegOpenKeyEx(Hkey_CLASSES_ROOT, pchar(Temp+'\shell\open\command'), 0, key_all_access, Hkey2) = ERROR_SUCCESS then
begin
if RegQueryValueEx(Hkey2, nil, nil, @Typ, nil, @Taille) = ERROR_SUCCESS then
begin
RegQueryValueEx(Hkey2, nil, nil, nil, @Temp, @Taille);
if Temp <> '' then
begin
Arrange;
Exit;
end;
end;
RegCloseKey(Hkey2);
end;
if RegOpenKeyEx(Hkey1, 'shell\open\command', 0, KEY_ALL_ACCESS, Hkey2) = ERROR_SUCCESS then
begin
if RegQueryValueEx(Hkey2, nil, nil, @Typ, nil, @Taille) = ERROR_SUCCESS then
begin
RegQueryValueEx(Hkey2, nil, nil, nil, @Temp, @Taille);
if Temp<>'' then
begin
Arrange;
Exit;
end;
end;
end;
end;
RegCloseKey(Hkey1);
end;
inc(i);
until i = 4;
Result := '';
end;//==============================================================================
//检索Windows默认的Internet浏览器的执行文件名及有关参数*************************
//==============================================================================
function GetBrowserNameAndParam(var Param: string): string;
var Temp:string;
i:word;
begin
Temp:=UpperCase(GetBrowser);
if Temp<>'' then
begin
i:=Length(Temp)+1;
repeat
Dec(i);
Param:=Copy(Temp,i-3,4);
until (Param='.EXE') or (Param='.BAT') or (Param='.COM');
if i<length(Temp) then
begin
Param:=Trim(Copy(Temp,i+1,Length(Temp)-(i)));
while (Param<>'') and (Param[1]='"') do Delete(Param,1,1);
Delete(Temp,i+1,Length(Temp)-(i));
end else Param:='';
if Temp[1]='"' then Delete(Temp,1,1);
end;
Result := Temp;
end;//==============================================================================
//执行Internet浏览器发送E_Mail及有关参数****************************************
//==============================================================================
function GotoWeb(hwnd: HWND; Kind: integer; BrowserName: string; Param: string; Address: string; nShowCmd: integer): Boolean;
begin
if BrowserName <> ''
then begin{Web:=0,EMail:=1}
if Kind=0 then Result := not (ShellExecute(hwnd, nil, PChar(BrowserName), PChar(Param + ' '+ Address), nil, nShowCmd)<33)
{shellexecute函数如返回值等于或小于32则表示发生一个错误,详细情况请参阅Win32手册}
else if Kind=1 then Result := not (ShellExecute(hwnd, nil, PChar(BrowserName), PChar(Param + ' mailto:'+ Address), nil, nShowCmd)<33)
else Result := false;
end
else Result := false;
end;
然后在需要的地方调用这个就可以了
ShellExecute(Handle,'Open',pChar('MailTo:[email protected]'),nil,nil,SW_SHOWNORMAL);
ShellApi;
~~~~~~~~~
...
...
procedure Taboutform.Label7Click(Sender: TObject);
begin
shellexecute(handle,nil,pchar('mailto:'+label7.caption),nil,nil,sw_shownormal);
end;