我添加了一个Label,我想鼠标点击label时,能够自动打开用户本地发邮件的软件,并写上地址,如同html中的:"Emailto:[email protected]"功能,谢谢!

解决方案 »

  1.   

    兄弟,FOLLOW ME!
    USES SHELLAPI;ShellExecute((self.Owner as TForm).handle,nil,pchar('mailto:'),nil,nil,sw_shownormal);
    GOD BLESS YOU
      

  2.   

    同意楼上的,使用 api函数啊记得  USES SHELLAPI;
      

  3.   

    uses shellapi;shellexecute(handle,nil,'mailto:[email protected]',nil,nil,sw_show);
      

  4.   

    procedure SendOutlookMail;
    const
      olMailItem = 0;
    var
      Outlook: OleVariant;
      vMailItem: variant;
    begin
      {try
    //    Outlook := GetActiveOleObject('Outlook.Application');
      except
        Outlook := CreateOleObject('Outlook.Application');
      end;
      }
      Outlook := CreateOleObject('Outlook.Application');
      vMailItem := Outlook.CreateItem(olMailItem);
      vMailItem.Recipients.Add('[email protected]');
      vMailItem.Subject := 'test email';
      vMailItem.Body := 'This is a test';
      //vMailItem.Attachments.Add('C:\temp\sample.txt');
      vMailItem.Send;  VarClear(Outlook);
    end;
      

  5.   

    uses中添加shellapi;ShellExecute(handle,nil,'mailto:[email protected]',nil,nil, sw_shownormal);
    shellexecute(Handle,'open','help.txt',0,0,SW_Show)
    shellexecute(Handle,'open','fg.chm',0,0,SW_Show)
      要实现这个功能,要使用shellexecute函数来实现,
    ShellExecute(handle,nil,pchar('http://www.yahoo.com'),nil,nil, sw_shownormal);
    第一个参数是父窗口的句柄
    第二个参数为打开方式
    第三个参数为文件的全路径
    第四个参数为文件参数
    第五个参数为执行文件开始运行时的初始目录
    第六个参数为执行文件的运行方式
    SW_HIDE 隐藏窗口,活动状态给令一个窗口 
    SW_MINIMIZE 最小化窗口,活动状态给令一个窗口 
    SW_RESTORE 用原来的大小和位置显示一个窗口,同时令其进入活动状态 
    SW_SHOW 用当前的大小和位置显示一个窗口,同时令其进入活动状态 
    SW_SHOWMAXIMIZED 最大化窗口,并将其激活 
    SW_SHOWMINIMIZED 最小化窗口,并将其激活 
    SW_SHOWMINNOACTIVE 最小化一个窗口,同时不改变活动窗口 
    SW_SHOWNA 用当前的大小和位置显示一个窗口,不改变活动窗口 
    SW_SHOWNOACTIVATE 用最近的大小和位置显示一个窗口,同时不改变活动窗口 
    SW_SHOWNORMAL 与SW_RESTORE相同