首页 > 代码库 > brower plugin

brower plugin

1,文件player.h
#include "PluginWindowWin.h"
...
public:
HWND m_HWND;

2,文件player.cpp
bool player::onWindowAttached(FB::AttachedEvent *evt, FB::PluginWindow * win)

{

FB::PluginWindowWin *wnd = dynamic_cast<FB::PluginWindowWin*>(win);

HWND hWnd=wnd->getHWND();

m_HWND=hWnd;

return false;

}


bool player::onWindowDetached(FB::DetachedEvent *evt, FB::PluginWindow *)

{

HDC hDC=GetDC(m_HWND);

ReleaseDC(m_HWND,hDC);

return false;

}

3,文件playerAPI.cpp
FB::variant playerAPI::echo(const FB::variant& msg)

{

playerPtr player=getPlugin();

HWND hWnd=player->m_HWND;
/*
HDC hDC=::GetWindowDC(hWnd);//GetDC(hWnd);

HBITMAP m_hBitmap=
(HBITMAP)::LoadImage(NULL,_T("D:\\test.bmp"),IMAGE_BITMAP,0,0,LR_LOADFROMFILE);

HDC hdcMem=CreateCompatibleDC(hDC);
SelectObject(hdcMem, m_hBitmap);
BitBlt(hDC,0,0,640,352,hdcMem,0,0,SRCCOPY);

DeleteDC(hdcMem);
*/


CHANNEL_CLIENTINFO channelInfo;
memset(&channelInfo, 0, sizeof(CHANNEL_CLIENTINFO));

sprintf(channelInfo.host, "%s", "172.18.190.102");

channelInfo.port = 554;

channelInfo.protocol = PROTOCOL_RTSP_TCP;

channelInfo.channel=0;

channelInfo.model = 0x00;
channelInfo.tryRGBfirst = 1;
channelInfo.tryOverlay = 0;
strcpy(channelInfo.username, "admin");
strcpy(channelInfo.password, "admin");

NET_Startup();

HANDLE m_hLiveRTSP = NET_ClientStart(&channelInfo, NULL);
NET_ClientSetWnd(m_hLiveRTSP, hWnd);

 

static int n(0);

fire_echo("So far, you clicked this many times: ", n++);

// return "foobar";

return msg;

}