EDA驿站

去浮躁,求真知;重实干,勤与研

  博客园  :: 首页  :: 新随笔  ::  ::  :: 管理

自动调用浏览器或邮件程序

自动调用浏览器或邮件程序
Windows 提供了ShellExecute函数,用来调用外部程序或与某程序关联的文件。

其原型如下:

HINSTANCE ShellExecute(
HWND hwnd, // handle to parent window

LPCTSTR lpOperation, // pointer to string that specifies operation to perform

LPCTSTR lpFile, // pointer to filename or folder name string

LPCTSTR lpParameters, // pointer to string that specifies executable-file parameters

LPCTSTR lpDirectory, // pointer to string that specifies default directory

INT nShowCmd // whether file is shown when opened

);

如若要自动浏览器程序访问我的主页,程序代码如下:

ShellExecute(Handle,NULL,"http://lmq.4y.com.cn",NULL,NULL,SW_SHOWNORMAL);

若要启动系统默认邮件程序,给我写信,程序代码如下:

ShellExecute(Handle,NULL,"mailto:lmq@4y.com.cn",NULL,NULL,SW_SHOWNORMAL);

posted on 2004-05-20 18:07  易学  阅读(502)  评论(0)    收藏  举报