/* Simple.c
This is a Win32 C application (ie, no MFC, WTL, nor even any C++ -- just plain C) that demonstrates
how to embed a browser "control" (actually, an OLE object) in your own window (in order to display a
web page, or an HTML file on disk).
This example opens two windows, each containing a browser object. The first window displays an HTML
string in memory. The second window displays Microsoft's web site. We also disable the pop-up context
menu, and resize the browser to fill our window.
This is very loosely based upon a C++ example written by Chris Becke. I used that to learn the minimum
of what I needed to know about hosting the browser object. Then I wrote this example from the ground up
in C.
This requires IE 5.0 (or better) -- due to the IDocHostUIHandler interface, or a browser that supports
the same level of OLE in-place activation.
*/
#include <windows.h>
#include <exdisp.h> // Defines of stuff like IWebBrowser2. This is an include file with Visual C 6 and above
#include <mshtml.h> // Defines of stuff like IHTMLDocument2. This is an include file with Visual C 6 and above
#include <mshtmhst.h> // Defines of stuff like IDocHostUIHandler. This is an include file with Visual C 6 and above
#include <crtdbg.h> // for _ASSERT()
//#include "config.h"
//#include "browser.h"
// A running count of how many windows we have open that contain a browser object
unsigned char WindowCount = 0;
// The class name of our Window to host the browser. It can be anything of your choosing.
static const char ClassName[] = "EmbeddedBrowser";
// This is used by DisplayHTMLStr(). It can be global because we never change it.
static const SAFEARRAYBOUND ArrayBound = {1, 0};
// Our IStorage functions that the browser may call
HRESULT STDMETHODCALLTYPE Storage_QueryInterface(IStorage FAR* This, REFIID riid, LPVOID FAR* ppvObj);
HRESULT STDMETHODCALLTYPE Storage_AddRef(IStorage FAR* This);
HRESULT STDMETHODCALLTYPE Storage_Release(IStorage FAR* This);
HRESULT STDMETHODCALLTYPE Storage_CreateStream(IStorage FAR* This, const WCHAR *pwcsName, DWORD grfMode, DWORD reserved1, DWORD reserved2, IStream **ppstm);
HRESULT STDMETHODCALLTYPE Storage_OpenStream(IStorage FAR* This, const WCHAR * pwcsName, void *reserved1, DWORD grfMode, DWORD reserved2, IStream **ppstm);
HRESULT STDMETHODCALLTYPE Storage_CreateStorage(IStorage FAR* This, const WCHAR *pwcsName, DWORD grfMode, DWORD reserved1, DWORD reserved2, IStorage **ppstg);
HRESULT STDMETHODCALLTYPE Storage_OpenStorage(IStorage FAR* This, const WCHAR * pwcsName, IStorage * pstgPriority, DWORD grfMode, SNB snbExclude, DWORD reserved, IStorage **ppstg);
HRESULT STDMETHODCALLTYPE Storage_CopyTo(IStorage FAR* This, DWORD ciidExclude, IID const *rgiidExclude, SNB snbExclude,IStorage *pstgDest);
HRESULT STDMETHODCALLTYPE Storage_MoveElementTo(IStorage FAR* This, const OLECHAR *pwcsName,IStorage * pstgDest, const OLECHAR *pwcsNewName, DWORD grfFlags);
HRESULT STDMETHODCALLTYPE Storage_Commit(IStorage FAR* This, DWORD grfCommitFlags);
HRESULT STDMETHODCALLTYPE Storage_Revert(IStorage FAR* This);
HRESULT STDMETHODCALLTYPE Storage_EnumElements(IStorage FAR* This, DWORD reserved1, void * reserved2, DWORD reserved3, IEnumSTATSTG ** ppenum);
HRESULT STDMETHODCALLTYPE Storage_DestroyElement(IStorage FAR* This, const OLECHAR *pwcsName);
HRESULT STDMETHODCALLTYPE Storage_RenameElement(IStorage FAR* This, const WCHAR *pwcsOldName, const WCHAR *pwcsNewName);
HRESULT STDMETHODCALLTYPE Storage_SetElementTimes(IStorage FAR* This, const WCHAR *pwcsName, FILETIME const *pctime, FILETIME const *patime, FILETIME const *pmtime);
HRESULT STDMETHODCALLTYPE Storage_SetClass(IStorage FAR* This, REFCLSID clsid);
HRESULT STDMETHODCALLTYPE Storage_SetStateBits(IStorage FAR* This, DWORD grfStateBits, DWORD grfMask);
HRESULT STDMETHODCALLTYPE Storage_Stat(IStorage FAR* This, STATSTG * pstatstg, DWORD grfStatFlag);
// Our IStorage VTable. This is the array of pointers to the above functions in our C
// program that someone may call in order to store some data to disk. We must define a
// particular set of functions that comprise the IStorage set of functions (see above),
// and then stuff pointers to those functions in their respective 'slots' in this table.
// We want the browser to use this VTable with our IStorage structure (object).
IStorageVtbl MyIStorageTable = {Storage_QueryInterface,
Storage_AddRef,
Storage_Release,
Storage_CreateStream,
Storage_OpenStream,
Storage_CreateStorage,
Storage_OpenStorage,
Storage_CopyTo,
Storage_MoveElementTo,
Storage_Commit,
Storage_Revert,
Storage_EnumElements,
Storage_DestroyElement,
Storage_RenameElement,
Storage_SetElementTimes,
Storage_SetClass,
Storage_SetStateBits,
Storage_Stat};
// Our IStorage structure. NOTE: All it contains is a pointer to our IStorageVtbl, so we can easily initialize it
// here instead of doing that programmably.
IStorage MyIStorage = { &MyIStorageTable };
// Our IOleInPlaceFrame functions that the browser may call
HRESULT STDMETHODCALLTYPE Frame_QueryInterface(IOleInPlaceFrame FAR* This, REFIID riid, LPVOID FAR* ppvObj);
HRESULT STDMETHODCALLTYPE Frame_AddRef(IOleInPlaceFrame FAR* This);
HRESULT STDMETHODCALLTYPE Frame_Release(IOleInPlaceFrame FAR* This);
HRESULT STDMETHODCALLTYPE Frame_GetWindow(IOleInPlaceFrame FAR* This, HWND FAR* lphwnd);
HRESULT STDMETHODCALLTYPE Frame_ContextSensitiveHelp(IOleInPlaceFrame FAR* This, BOOL fEnterMode);
HRESULT STDMETHODCALLTYPE Frame_GetBorder(IOleInPlaceFrame FAR* This, LPRECT lprectBorder);
HRESULT STDMETHODCALLTYPE Frame_RequestBorderSpace(IOleInPlaceFrame FAR* This, LPCBORDERWIDTHS pborderwidths);
HRESULT STDMETHODCALLTYPE Frame_SetBorderSpace(IOleInPlaceFrame FAR* This, LPCBORDERWIDTHS pborderwidths);
HRESULT STDMETHODCALLTYPE Frame_SetActiveObject(IOleInPlaceFrame FAR* This, IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName);
HRESULT STDMETHODCALLTYPE Frame_InsertMenus(IOleInPlaceFrame FAR* This, HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths);
HRESULT STDMETHODCALLTYPE Frame_SetMenu(IOleInPlaceFrame FAR* This, HMENU hmenuShared, HOLEMENU holemenu, HWND hwndActiveObject);
HRESULT STDMETHODCALLTYPE Frame_RemoveMenus(IOleInPlaceFrame FAR* This, HMENU hmenuShared);
HRESULT STDMETHODCALLTYPE Frame_SetStatusText(IOleInPlaceFrame FAR* This, LPCOLESTR pszStatusText);
HRESULT STDMETHODCALLTYPE Frame_EnableModeless(IOleInPlaceFrame FAR* This, BOOL fEnable);
HRESULT STDMETHODCALLTYPE Frame_TranslateAccelerator(IOleInPlaceFrame FAR* This, LPMSG lpmsg, WORD wID);
// Our IOleInPlaceFrame VTable. This is the array of pointers to the above functions in our C
// program that the browser may call in order to interact with our frame window that contains
// the browser object. We must define a particular set of functions that comprise the
// IOleInPlaceFrame set of functions (see above), and then stuff pointers to those functions
// in their respective 'slots' in this table. We want the browser to use this VTable with our
// IOleInPlaceFrame structure.
IOleInPlaceFrameVtbl MyIOleInPlaceFrameTable = {Frame_QueryInterface,
Frame_AddRef,
Frame_Release,
Frame_GetWindow,
Frame_ContextSensitiveHelp,
Frame_GetBorder,
Frame_RequestBorderSpace,
Frame_SetBorderSpace,
Frame_SetActiveObject,
Frame_InsertMenus,
Frame_SetMenu,
Frame_RemoveMenus,
Frame_SetStatusText,
Frame_EnableModeless,
Frame_TranslateAccelerator};
// We need to return an IOleInPlaceFrame struct to the browser object. And one of our IOleInPlaceFrame
// functions (Frame_GetWindow) is going to need to access our window handle. So let's create our own
// struct that starts off with an IOleInPlaceFrame struct (and that's important -- the IOleInPlaceFrame
// struct *must* be first), and then has an extra data field where we can store our own window's HWND.
//
// And because we may want to create multiple windows, each hosting its own brows
没有合适的资源?快使用搜索试试~ 我知道了~
Mediacoder
共1214个文件
svn-base:659个
h:112个
htm:74个
3星 · 超过75%的资源 需积分: 9 29 下载量 43 浏览量
2008-09-23
18:19:57
上传
评论
收藏 7.38MB RAR 举报
温馨提示
开源转码工具开源转码工具开源转码工具开源转码工具开源转码工具开源转码工具开源转码工具开源转码工具开源转码工具开源转码工具开源转码工具开源转码工具开源转码工具开源转码工具开源转码工具开源转码工具开源转码工具开源转码工具开源转码工具开源转码工具开源转码工具开源转码工具开源转码工具开源转码工具开源转码工具开源转码工具
资源推荐
资源详情
资源评论
收起资源包目录
Mediacoder (1214个子文件)
main.aps 978KB
mcgui.aps 234KB
MediaStudioSetup.vdproj.bak 229KB
audioencoders.cpp.bak 52KB
menc.cpp.bak 26KB
audiosources.cpp.bak 20KB
mccore.vcproj.bak 19KB
containers.cpp.bak 10KB
processwrapper.cpp.bak 4KB
Q-Studio.def.bak 1KB
release.bat 104B
release-studio.bat 101B
logo.bmp 329KB
quiptellogo.bmp 329KB
psp.bmp 120KB
skin_back.bmp 106KB
skin.bmp 100KB
skin.bmp 93KB
preview.bmp 69KB
skin.bmp 29KB
preview1.bmp 24KB
devnav-phone.bmp 7KB
devnav-pda.bmp 7KB
devnav-dmp.bmp 7KB
devnav-other.bmp 7KB
devnav-game.bmp 7KB
devnav-disc.bmp 6KB
qcif.bmp 5KB
skin_remove.bmp 5KB
skin_about_hover.bmp 5KB
skin_about.bmp 5KB
skin_removeall.bmp 5KB
skin_remove_hover.bmp 5KB
skin_addfile_hover.bmp 5KB
skin_addfile.bmp 5KB
skin_removeall_hover.bmp 5KB
stop.bmp 5KB
start.bmp 5KB
play.bmp 5KB
addfolder.bmp 5KB
addfile.bmp 5KB
remove.bmp 5KB
clear.bmp 5KB
skin_convert.bmp 3KB
skin_stop.bmp 3KB
skin_play.bmp 3KB
skin_play_hover.bmp 3KB
skin_preview_hover.bmp 3KB
skin_preview.bmp 3KB
skin_stop_hover.bmp 3KB
skin_convert_hover.bmp 3KB
stopplay.bmp 3KB
devicebutton.bmp 3KB
addtrack.bmp 2KB
skip.bmp 2KB
preference.bmp 2KB
devicelogo.bmp 2KB
logo.bmp 2KB
skin_menu.bmp 2KB
skin_browse.bmp 2KB
pause.bmp 2KB
skin_donate.bmp 832B
skin_open.bmp 784B
logo.bmp 756B
logo.bmp 630B
logo.bmp 630B
logo.bmp 556B
skin_close.bmp 198B
skin_minimize.bmp 198B
embedweb.c 79KB
processpil.c 13KB
httpget.c 10KB
winamphelper.c 9KB
common.c 7KB
audiofilters.c 2KB
cpuinfo.c 696B
mcres.c 525B
transcode.cpp 95KB
optiondialogs.cpp 55KB
audioencoders.cpp 53KB
mcpref.cpp 50KB
startui.cpp 39KB
videoencoders.cpp 39KB
skinnedui.cpp 29KB
menc.cpp 27KB
windowhandle.cpp 25KB
deviceplugins.cpp 24KB
preference.cpp 21KB
audiosources.cpp 20KB
discnav.cpp 18KB
mediatools.cpp 18KB
filelist.cpp 16KB
commondialogs.cpp 15KB
devicehelper.cpp 15KB
webui.cpp 14KB
mencoderopts.cpp 14KB
paramlist.cpp 13KB
containers.cpp 10KB
audiodialogs.cpp 10KB
cropper.cpp 8KB
共 1214 条
- 1
- 2
- 3
- 4
- 5
- 6
- 13
资源评论
- dukong1232013-04-28很不错,可以分析视频文件。
andy1976
- 粉丝: 3
- 资源: 17
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功