写3389自动登录器
分类:web前端

很科学的二个 3389 自动登入器 ! 达成机关登陆 , 代码也比很少

设置asfwriter的profile后录像的asf文件没声音
调用函数如下:
function TMainForm.SetASFWriterProfile(pWriter: TASFWriter; lWidth, lHeight, bitRate: Integer): HRESULT;
var
hr: HRESULT;
pvi: PVideoInfoHeader;
pProfile: IWMProfile;
pProfileMgr: IWMProfileManager;
pStream: IWMStreamConfig;
pStream1: IWMStreamConfig;
pMediaProps: IWMVideoMediaProps;
pMediaType: PWMMediaType;
cbMediaType: Cardinal;
ConfigAsfWriter: IConfigAsfWriter;
begin
{ hr = m_pWMVEncoder->QueryInterface(IID_IConfigAsfWriter, &pConfig);
hr=LoadCustomProfile("D1.prx",&pProfile );
hr=pProfile->GetStream(1,&pStreamConfig);
hr=pStreamConfig->QueryInterface(IID_IWMMediaProps,&pProps);
hr=pProps->GetMediaType(pType,&size);
BITMAPINFOHEADER* pBitmap=(BITMAPINFOHEADER*)&pHeader->bmiHeader;
pBitmap->biWidth=720;
pBitmap->biHeight=576;
hr=pProps->SetMediaType;
hr=pProfile->ReconfigStream(pStreamConfig);
hr=pConfig->ConfigureFilterUsingProfile; }

注:有自然的参谋价值,转存


运维delphi-->Components-->Import Active Control,在列表中找到下边包车型地铁Microsoft Terminal Services Active Client 1.0 Type Library (Version 1.0卡塔尔国,点击install

hr := WMCreateProfileManager(pProfileMgr);
if FAILED then
begin
ShowMessage(format('Error on Call WMCreateProfileManager ', [hr]));
Result := hr;
exit;
end;
hr := pProfileMgr.CreateEmptyProfile(WMT_VER_7_0, pProfile);
if FAILED then
begin
ShowMessage(format('Error on Call pProfileMgr.CreateEmptyProfile ', [hr]));
Result := hr;
exit;
end;
hr := pProfile.SetName;
if FAILED then
begin
ShowMessage(format('Error on Call pProfile.SetName ', [hr]));
Result := hr;
exit;
end;
hr := pProfile.SetDescription('LYSoft WMV ProFiles');
if FAILED then
begin
ShowMessage(format('Error on Call pProfile.SetDescription ', [hr]));
Result := hr;
exit;
end;

*// Code 1

 

亟待先安装这一个控件 !

hr := pProfile.CreateNewStream(WMMEDIATYPE_Video, pStream);//WMMEDIATYPE_Video
if FAILED then
begin
ShowMessage(format('Error on Call pProfile.CreatenewStream ', [hr]));
Result := hr;
exit;
end;

*uses   ActiveX, MSHTML_TLB, ComCtrls, ComObj;

type
 POleVariant = ^OleVariant;
var
 dps: TDispParams absolute Params;
 bHasParams: boolean;
 pDispIds: PDispIdList;
 iDispIdsSize: integer;
begin
 Result := DISP_E_MEMBERNOTFOUND;
 pDispIds := nil;
 iDispIdsSize := 0;
 bHasParams := (dps.cArgs > 0);
 if (bHasParams) then
 begin
   iDispIdsSize := dps.cArgs * SizeOf(TDispId);
   GetMem(pDispIds, iDispIdsSize);
 end;
 try
   if (bHasParams) then BuildPositionalDispIds(pDispIds, dps);
   case DispId of
     102:
       begin
         DoStatusTextChange(dps.rgvarg^[pDispIds^[0]].bstrval);
         Result := S_OK;
       end;
     108:
       begin
         DoProgressChange(dps.rgvarg^[pDispIds^[0]].lval, dps.rgvarg^[pDispIds^[1]].lval);
         Result := S_OK;
       end;
     105:
       begin
         DoCommandStateChange(dps.rgvarg^[pDispIds^[0]].lval, dps.rgvarg^[pDispIds^[1]].vbool);
         Result := S_OK;
       end;
     106:
       begin
         DoDownloadBegin();
         Result := S_OK;
       end;
     104:
       begin
         DoDownloadComplete();
         Result := S_OK;
       end;
     113:
       begin
         DoTitleChange(dps.rgvarg^[pDispIds^[0]].bstrval);
         Result := S_OK;
       end;
     112:
       begin
         DoPropertyChange(dps.rgvarg^[pDispIds^[0]].bstrval);
         Result := S_OK;
       end;
     250:
       begin
         DoBeforeNavigate2(IDispatch(dps.rgvarg^[pDispIds^[0]].dispval), POleVariant(dps.rgvarg^[pDispIds^[1]].pvarval)^, POleVariant(dps.rgvarg^[pDispIds^[2]].pvarval)^, POleVariant(dps.rgvarg^[pDispIds^[3]].pvarval)^, POleVariant(dps.rgvarg^[pDispIds^[4]].pvarval)^, POleVariant(dps.rgvarg^[pDispIds^[5]].pvarval)^, dps.rgvarg^[pDispIds^[6]].pbool^);
         Result := S_OK;
       end;
     251:
       begin
         DoNewWindow2(IDispatch(dps.rgvarg^[pDispIds^[0]].pdispval^), dps.rgvarg^[pDispIds^[1]].pbool^);
         Result := S_OK;
       end;
     252:
       begin
         DoNavigateComplete2(IDispatch(dps.rgvarg^[pDispIds^[0]].dispval), POleVariant(dps.rgvarg^[pDispIds^[1]].pvarval)^);
         Result := S_OK;
       end;
     259:
       begin
         DoDocumentComplete(IDispatch(dps.rgvarg^[pDispIds^[0]].dispval), POleVariant(dps.rgvarg^[pDispIds^[1]].pvarval)^);
         Result := S_OK;
       end;
     253:
       begin
         DoOnQuit();
         Result := S_OK;
       end;
     254:
       begin
         DoOnVisible(dps.rgvarg^[pDispIds^[0]].vbool);
         Result := S_OK;
       end;
     255:
       begin
         DoOnToolBar(dps.rgvarg^[pDispIds^[0]].vbool);
         Result := S_OK;
       end;
     256:
       begin
         DoOnMenuBar(dps.rgvarg^[pDispIds^[0]].vbool);
         Result := S_OK;
       end;
     257:
       begin
         DoOnStatusBar(dps.rgvarg^[pDispIds^[0]].vbool);
         Result := S_OK;
       end;
     258:
       begin
         DoOnFullScreen(dps.rgvarg^[pDispIds^[0]].vbool);
         Result := S_OK;
       end;
     260:
       begin
         DoOnTheaterMode(dps.rgvarg^[pDispIds^[0]].vbool);
         Result := S_OK;
       end;
   end;
 finally
   if (bHasParams) then FreeMem(pDispIds, iDispIdsSize);
 end;
end;

var
proj: ImsKugadpclientAdvancedSettings; //定义密码用
p1: IMsENCOREdpClientAdvancedSettingsDisp; //自定义端口用

// hr := pProfile.CreateNewStream(WMMEDIATYPE_Audio, pStream1);//WMMEDIATYPE_Video
// Get the media properties interface for the new stream.
hr := pStream.QueryInterface(IID_IWMMediaProps, pMediaProps); //IID_IWMVideoMediaProps
if FAILED then
begin
ShowMessage(format('Error on Call pStream.QueryInterface ', [hr]));
Result := hr;
exit;
end;

function GetBrowserForFrame(Doc: IHTMLDocument2; nFrame: Integer): IWebBrowser2;
  //Thanks to Rik Barker
  //returns an interface to the frame's browser
**
var
  pContainer: IOLEContainer;
  enumerator: ActiveX.IEnumUnknown;
  nFetched: PLongInt;
  unkFrame: IUnknown;
  hr: HRESULT;
begin
  Result := nil;
  nFetched := 
nil;
  // Cast the page as an OLE container   pContainer := Doc 
as IOleContainer;
  // Get an enumerator for the frames on the page   hr := pContainer.EnumObjects(OLECONTF_EMBEDDINGS 
or OLECONTF_OTHERS, enumerator);   if hr <> S_OK then
  begin
    pContainer._Release;
    Exit;   
end;
  // Now skip to the frame we're interested in   enumerator.Skip(nFrame);
  // and get the frame as IUnknown   enumerator.Next(1,unkFrame, nFetched);
  // Now QI the frame for a WebBrowser Interface - I'm not  entirely
  // sure this is necessary, but COM never ceases to surprise me   
unkframe.QueryInterface(IID_IWebBrowser2, Result);
end**;

function TIEHelper.GetIDsOfNames(const IID: TGUID; Names: Pointer;
 NameCount, LocaleID: Integer; DispIDs: Pointer): HResult;
begin
 Result := E_NOTIMPL;
end;

begin
if MsRdpClient21.AdvancedSettings.QueryInterface(ImsRdpclientAdvancedSettings, proj) = S_OK then
begin
MsRdpClient21.UserName := 'test';
proj.Set_ClearTextPassword('123456');
if RDform.MsRdpClient21.AdvancedSettings.QueryInterface(IMsRdpClientAdvancedSettingsDisp, p1) = S_OK then
p1.RDPPort := StrToInt(Rport);
end;
MsRdpClient21.Server := '127.0.0.1';
MsRdpClient21.Connect;
....
end;

// Get the media-type structure.
// First, get the size of the media-type structure.
hr := pMediaProps.GetMediaType(nil, cbMediaType);
if FAILED then
begin
ShowMessage(format('Error on Call pMediaProps.GetMediaType ', [hr]));
Result := hr;
exit;
end;

function GetFrameSource(WebDoc: iHTMLDocument2): string;
  //returns frame HTML and scripts as a text string
**
var
  re: integer;
  HTMLel: iHTMLElement;
  HTMLcol: iHTMLElementCollection;
  HTMLlen: Integer;
  ScriptEL: IHTMLScriptElement;
begin
  Result := '';   if Assigned(WebDoc) then
  begin
    HTMLcol := WebDoc.Get_all;
    HTMLlen := HTMLcol.Length;     
for re := 0 to HTMLlen - 1 do
    begin
      HTMLel := HTMLcol.Item(re, 0) as iHTMLElement;       if HTMLEl.tagName = 'HTML' then
        Result := Result + HTMLEl.outerHTML;     end;   end; end**;

function TIEHelper.GetTypeInfo(Index, LocaleID: Integer;
 out TypeInfo): HResult;
begin
 Result := E_NOTIMPL;
 pointer(TypeInfo) := nil;
end;

// Allocate memory for the structure based on the retrieved size.
pMediaType := AllocMem(cbMediatype);
// Retrieve the media-type structure.
hr := pMediaProps.GetMediaType(pMediaType, cbMediaType);
if FAILED then
begin
ShowMessage(format('Error on Call pMediaProps.GetMediaType ', [hr]));
Result := hr;
exit;
end;

function WB_SaveFrameToFile(HTMLDocument: IHTMLDocument2;
  const FileName: TFileName): Boolean;
// Save IHTMLDocument2 to a file
**
var
  PersistFile: IPersistFile; begin
  PersistFile := HTMLDocument as IPersistFile;
  PersistFile.Save(StringToOleStr(FileName), System.True);
end**;

function TIEHelper.GetTypeInfoCount(out Count: Integer): HResult;
begin
 Result := E_NOTIMPL;
 Count := 0;
end;

// Change the video size
pvi := PVideoInfoHeader(pMediaType.pbFormat);
// ShowMessage(format('%d,%d,%d,%d',[pvi.bmiHeader.biWidth,pvi.bmiheader.biHeight,pvi.bmiHeader.biBitCount,pvi.bmiHeader.biSizeImage]));
pvi.bmiHeader.biWidth := lWidth;
pvi.bmiHeader.biHeight := lHeight;
pvi.bmiHeader.biSizeImage := pvi.bmiHeader.biWidth * pvi.bmiHeader.biHeight * pvi.bmiHeader.biBitCount div 8;
pvi.rcSource := RECT(0, 0, lWidth, lHeight);
pvi.rcTarget := RECT(0, 0, lWidth, lHeight);
pvi.dwBitRate := bitRate;
pvi.AvgTimePerFrame := Round(10000000 / 15); // PFS = 15
pvi.bmiHeader.biCompression := WMMEDIASUBTYPE_WMV1.D1;
pMediaType.subtype := WMMEDIASUBTYPE_WMV1;
pMediaProps.SetMaxKeyFrameSpacing;
pMediaProps.SetQuality;
hr := pMediaProps.SetMediaType(pMediaType);
if FAILED then
begin
ShowMessage(format('Error on Call pMediaProps.SetMediaType ', [hr]));
Result := hr;
exit;
end;

function SaveWBFrames(WebBrowser1: TWebBrowser): string;
// return the source for all frames in the browser
**
var
  Webdoc, HTMLDoc: ihtmldocument2;
  framesCol: iHTMLFramesCollection2;
  FramesLen: integer;
  pickFrame: olevariant;
  p: integer;
begin
  try
    WebDoc := WebBrowser1.Document as **IHTMLDocument2;
    Result := GetFrameSource(WebDoc);

function TIEHelper.GetSite(const riid: TIID; out site: IUnknown): HResult;
begin
//  Result := S_OK;
 if Assigned(IE) then result:=IE.QueryInterface(riid, site)
  else
    Result:= E_FAIL;
end;

// Release the media properties interface and delete the structure.
pMediaProps := nil;
FreeMem(pMediaType);
pMediaType := nil;

    *// §§§ Hier kann Result in eine Datei gespeichert werden §§§§  oder  mit
    // WB_SaveFrameToFile(WebDoc,'c:MainPage.html');

function TIEHelper.SetSite(const pUnkSite: IUnknown): HResult;

hr := pStream.SetBitrate;
if FAILED then
begin
ShowMessage(format('Error on Call pStream.SetBitrate ', [hr]));
Result := hr;
exit;
end;

    //Handle multiple or single frames
    *FramesCol := WebDoc.Get_frames;
    FramesLen := FramesCol.Get_length;
    if FramesLen > 0 then
      for 
p := 0 to FramesLen - 1 do
      begin         
pickframe := p;
        HTMLDoc   := WebBrowser1.Document as iHTMLDocument2;

 

pStream.SetBufferWindow($FFFFFFFF);
// Set the stream number.
hr := pStream.SetStreamNumber;
if FAILED then
begin
ShowMessage(format('Error on Call pStream.SetStreamNumber ', [hr]));
Result := hr;
exit;
end;

        WebDoc := GetBrowserForFrame(HTMLDoc, pickframe).document as iHTMLDocument2;
        if WebDoc <> nil then
        begin           
Result := GetFrameSource(WebDoc);
          WB_SaveFrameToFile(WebDoc, 'c:Frame' + IntToStr(p) + '.html');
          *// ShowMessage(HTMLDoc.Get_parentWindow.Get_name);
          // ShowMessage(HTMLDoc.Get_parentWindow.Parent.Get_document.nameProp);

// Include the new stream in the profile.
hr := pProfile.AddStream;
if FAILED then
begin
ShowMessage(format('Error on Call pProfile.AddStream ', [hr]));
Result := hr;
exit;
end;

        *end;
      end;
  except     Result := 'No Source Available';
  end;
end;

pProfile.ReconfigStream;
pStream := nil;

*// Test:

hr := pWriter.QueryInterface(IID_IConfigAsfWriter, ConfigAsfWriter);
if FAILED then
begin
ShowMessage(format('Error on Call WMCreateProfileManager ', [hr]));
Result := hr;
exit;
end;
hr := ConfigAsfWriter.ConfigureFilterUsingProfile;
if Failed then
begin
ShowMessage(format('Error on Call pWriter.ConfigureFilterUsingProfile ', [hr]));
Result := hr;
exit;
end;
ConfigAsfWriter := nil;

*procedure TForm1.Button1Click(Sender: TObject);
begin   SaveWBFrames(Webbrowser1);
end;

// TODO: Save the custom profile to a string, and save the string to a file.

// Code 2
**
uses
  **ActiveX;

// Release remaining interfaces.
pProfile := nil;
pProfileMgr := nil;
Result := S_OK;
end;

function TForm1.GetFrame(FrameNo: Integer): IWebbrowser2;
var   OleContainer: IOleContainer;
  enum: IEnumUnknown;
  unk: IUnknown;
  Fetched: PLongint;
begin
  while 
Webbrowser1.ReadyState <> READYSTATE_COMPLETE do     Application.ProcessMessages;
  if Assigned(Webbrowser1.document) then
  begin     
Fetched := nil;
    OleContainer := Webbrowser1.Document as IOleContainer;
    OleContainer.EnumObjects(OLECONTF_EMBEDDINGS, Enum);
    Enum.Skip(FrameNo);
    Enum.Next(1, Unk, Fetched);
    Result := Unk as IWebbrowser2;
  end
  else     
Result := nil;
end;

借问怎么样踏向音频流呢

// Load sample page
// Testseite laden
**
procedure TForm1.Button1Click(Sender: TObject); begin
  Webbrowser1.Navigate(''); end**;

// Save all frames in single files
// Alle Frameseiten in einzelne Dateien speichern
**
procedure TForm1.Button2Click(Sender: TObject); var
  IpStream: IPersistStreamInit;
  AStream: TMemoryStream;
  iw: IWebbrowser2;
  i: Integer;
  sl: TStringList;
begin
  for i := 0 to Webbrowser1.OleObject.Document.frames.Length - 1 do
  begin
    iw := GetFrame(i);
    AStream := TMemoryStream.Create;     
try
      IpStream := iw.document as IPersistStreamInit;       if Succeeded(IpStream.save(TStreamadapter.Create(AStream), True)) then
      begin
        AStream.Seek(0, 0);
        sl := TStringList.Create;
        sl.LoadFromStream(AStream);
        sl.SaveToFile('c:frame' + IntToStr(i) + '.txt');
        //  memo1.Lines.LoadFromStream(AStream);         sl.Free;       
end;     except
    end;
    AStream.Free;   
end; end**;

end.

本文由10bet手机官网发布于web前端,转载请注明出处:写3389自动登录器

上一篇:DBGridEh导出功能详解,用TIdFtp控件实现FTP协议 下一篇:没有了
猜你喜欢
热门排行
精彩图文