IE5이상에서 파일메뉴의 "오프라인으로 작업"항목의 체크여부입니다.
www.delmadang.com 김상경님(softzang@korea.com)의 델파이코드를
빌더로 바꿨습니다.
원래 출처는 이곳인듯 합니다.
http://delphi.about.com/bltip1100.htm
빌더 코드..
//---------------------------------------------------------------------------
typedef BOOL (__stdcall *InetIsOffLineFunc)(DWORD dwFlags);
bool __fastcall FuncAvail(char *_dllname,char * _funcname, InetIsOffLineFunc &_p)
{
bool res = false;
HANDLE _lib;
if(!LoadLibrary(_dllname))
return res;
_lib = GetModuleHandle(_dllname);
if (_lib){
_p = (InetIsOffLineFunc)GetProcAddress(_lib, _funcname);
if (_p)
res = true;
}
return res;
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
/* Call SHELL32.DLL for Win > Win98 otherwise call URL.dll */
InetIsOffLineFunc InetIsOffLine;
if (FuncAvail("URL.DLL", "InetIsOffline", InetIsOffLine))
if (InetIsOffLine(0))
ShowMessage("Not connected!");
else
ShowMessage("Connected!");
}
//델파이 코드
procedure TForm1.Button1Click(Sender: TObject);
function FuncAvail(_dllname, _funcname: string;
var _p: pointer): boolean;
{return True if _funcname exists in _dllname}
var _lib: tHandle;
begin
Result := false;
if LoadLibrary(PChar(_dllname)) = 0 then exit;
_lib := GetModuleHandle(PChar(_dllname));
if _lib <> 0 then
begin
_p := GetProcAddress(_lib, PChar(_funcname));
if _p <> NIL then Result := true;
end;
end;
{
Call SHELL32.DLL for Win > Win98
otherwise call URL.dll
}
{buton code:}
var
InetIsOffline : function(dwFlags: DWORD):
BOOL; stdcall;
begin
if FuncAvail('URL.DLL', 'InetIsOffline',
@InetIsOffline) then
if InetIsOffLine(0) = true then ShowMessage('Not connected')
else ShowMessage('Connected!');
end;