用 delphi 打开网页
uses ShellAPI;
procedure TForm1.Button1Click(Sender: TObject);
begin
//用IE打开
ShellExecute(Handle, 'open', 'IExplore.EXE', 'about:blank', nil, SW_SHOWNORMAL);
//用火狐打开
ShellExecute(Handle, 'open', 'firefox.exe', 'about:blank', nil, SW_SHOWNORMAL);
//用默认浏览器打开
ShellExecute(Handle, 'open', 'Explorer.exe', 'about:blank', nil, SW_SHOWNORMAL);
end;
//另一种调用IE打开的方法
uses ComObj;
procedure TForm1.Button1Click(Sender: TObject);
procedure OpenInIE(aURL: string);
var
IE: Variant;
begin
IE := CreateOleObject('InternetExplorer.Application');
IE.Visible := true;
IE.Navigate(aURL);
end;
begin
OpenInIE('www.132435.com');
end;
//第二种方法可以有更多控制
procedure TForm1.Button1Click(Sender: TObject);
procedure OpenInIE(aURL: string); //need uses ComObj;
var
IE: Variant;
begin
IE := CreateOleObject('InternetExplorer.Application');
IE.Visible := true; //可见
IE.left := 0;
IE.top := 0;
IE.height := 600; //高度
IE.width := 800; //宽度
IE.menubar := 0; //取消菜单栏
IE.addressbar := 0; //取消地址栏
IE.toolbar := 0; //取消工具栏
IE.statusbar := 0; //取消状态栏
//IE.resizable := 0; //不允许用户改变窗口大小
IE.Navigate(aURL);
end;
begin
OpenInIE('www.132435.com/blog');
end;
相关文档:
查找另外一个窗口的句柄: handle := FindWindow(nil,PChar('窗口的标题'));//查到窗体句柄
查找子窗体:childHandle := FindWindowEx(handle,0,'子窗体类','子窗体标题');
另外有个枚举子窗体的API,EnumChildWindows(主创体句柄,@回调函数,用户参数);
用这个函数需要自己写一个回调的函数,比如:
function EnumChil ......
首先用Notepad或Resource workshop 4.5建立RC文件。 结构如下 /****************************************************************************
rcdemo.rc
produced by Borland Resource Workshop
*****************************************************************************/
# ......
DELPHI中操作ACCESS数据库(建立.mdb文件,压缩数据库)
以下代码在WIN2K,D6,MDAC2.6下测试通过,
编译好的程序在WIN98第二版无ACCESS环境下运行成功.
//声明连接字符串
Const
SConnectionString
= 'Provider=M ......
uses WinInet;
procedure TForm1.Button1Click(Sender: TObject);
begin
if InternetGetConnectedState(nil, 0) then
ShowMessage('已连接')
else
ShowMessage('已断开');
end; ......