1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119:
| program starter;
{$APPTYPE GUI}
uses Windows, SysUtils, TlHelp32, Variants, ComObj, ActiveX, ShDocVw, ShellAPI;
function IsTaskbarAutoHideOn : boolean; var ABData : TAppBarData; begin ABData.cbSize := sizeof(ABData); Result :=(SHAppBarMessage(ABM_GETSTATE, ABData) and ABS_AUTOHIDE) > 0; end;
var hProcess, FSnapshotHandle : THandle; FProcessEntry32 : TProcessEntry32; IE : IWebBrowser2; Flags, TargetFrameName, PostData, Headers : OleVariant; ExePath, HtmlPath : String;
Begin if not IsTaskbarAutoHideOn then ShowWindow(FindWindow('Shell_TrayWnd', nil), SW_HIDE); try if ParamStr(1) <> '' then ExePath := ParamStr(1) else ExePath := DEFAULTEXE; if ParamStr(2) <> '' then HtmlPath := ParamStr(2) else HtmlPath := ExtractFilePath(ParamStr(0))+DEFAULTHTML; if FileExists(ExePath) then if FileExists(HtmlPath) then begin keybd_event(VK_LWIN, 0, 0, 0); keybd_event(68, 0, 0, 0); keybd_event(68, 0, KEYEVENTF_KEYUP, 0); keybd_event(VK_LWIN, 0,KEYEVENTF_KEYUP, 0); CoInitialize(NIL); try IE := CreateOleObject('InternetExplorer.Application') as IWebBrowser2; IE.MenuBar := False; IE.AddressBar := false; IE.Resizable := false; IE.StatusBar := false; IE.ToolBar := 0; IE.FullScreen := True; Flags := 8; IE.Navigate(HtmlPath,Flags,TargetFrameName,PostData,Headers); EnableWindow(IE.HWND,FALSE); IE.Visible := True; ShellExecute(0, 'open', PChar(ExePath), NIL, '', SW_SHOW); FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS or TH32CS_SNAPMODULE, 0); try FProcessEntry32.dwSize := Sizeof(FProcessEntry32); if Process32First(FSnapshotHandle, FProcessEntry32) then repeat if (UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) = UpperCase(ExtractFileName(ExePath))) or (UpperCase(FProcessEntry32.szExeFile) = UpperCase(ExePath)) then begin hProcess := OpenProcess(PROCESS_ALL_ACCESS, BOOL(0), FProcessEntry32.th32ProcessID); if hProcess <> INVALID_HANDLE_VALUE AND 0 then try WaitForSingleObject(hProcess,INFINITE); finally CloseHandle(hProcess); end; Break; end; until not Process32Next(FSnapshotHandle, FProcessEntry32); finally CloseHandle(FSnapshotHandle); end; finally Flags := unassigned; TargetFrameName := unassigned; PostData := unassigned; Headers := unassigned; IE.Quit; end; CoUnInitialize; end; finally if not IsTaskbarAutoHideOn then ShowWindow(FindWindow('Shell_TrayWnd', nil), SW_SHOW); end; End. |