Connect the code of the browser shell window

zhaozj2021-02-17  55

// - Connect the code for the browser shell window

// connshell.cpp: defines the entry point for the console application.///

#include "stdafx.h"

// # import "shdocvw.dll" exclude ( "tagREADYSTATE") # import "shdocvw.dll" // # import "shdocvw.dll" rename_namespace ( "SHELL_WINDOW") // using namespace SHELL_WINDOW; #define SHELL_WINDOW SHDocVw

#include using namespace std;

INT Main (int Argc, char * argv []) {cout << "--- Test ---" << endl; // - COM COINITIALIZE (NULL); Do {cout << "--- list all Shell window --- "<< endl;

SHELL_WINDOW :: IShellWindowsPtr msp_SHWinds = NULL; HRESULT hr = msp_SHWinds.CreateInstance (__ uuidof (SHELL_WINDOW :: ShellWindows)); ". FAILED" if (! S_OK = hr || NULL == msp_SHWinds) {cout << << endl; break } Int count = 0; int count = msp_shwinds-> getCount (); for (int i = 0; i Item (va); SHELL_WINDOW :: IWebBrowser2Ptr sp_Browser (sp_Disp); // SHELL_WINDOW :: IWebBrowser2Ptr sp_Browser = sp_Disp; // - OK if (! NULL = sp_Browser) {count ; cout << (char *) sp_Browser- > GetLocationName () << endl;

sp_browser.release ();}} msp_shwinds.release ();

COUT << "--- list count =" << count << "---" << endl; break;} while (false); // - com // counitialize (); // - ?? ? OleunInitialize (); return 0;}

转载请注明原文地址:https://www.9cbs.com/read-28685.html

New Post(0)