lerInfo))
return TRUE;//如果是command消息则视类先处理。
return CWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}
void TransparentWnd::OnSetFocus(CWnd* pOldWnd)
{
//如果有视类则视类获得焦点。
if(m_wndView.m_hWnd !=NULL)
m_wndView.SetFocus();
}
下面在CchildView中定义
CShockwaveFlash myflash;
///改变窗口特征
BOOL CChildView::PreCreateWindow(CREATESTRUCT& cs)
{
if (!CWnd::PreCreateWindow(cs))
return FALSE;
cs.dwExStyle |= WS_EX_CLIENTEDGE;
cs.style &= ~WS_BORDER;
cs.lpszClass = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS,
::LoadCursor(NULL, IDC_ARROW), HBRUSH(COLOR_WINDOWTEXT), NULL);
return TRUE;
}
BOOL CChildView::OnEraseBkgnd(CDC* pDC)
{
return TRUE;//不让window自动刷屏
}
//下面进入控制部分
int CChildView ::OnCreate (LPCREATESTRUCT lpCreateStruct)
{
if(CWnd::OnCreate(lpCreateStruct)==-1)
return -1;
myflash.Create(NULL,WS_CHILD|WS_VISIBLE,CRect(0,0,0,0), this, 1024);
SetTimer (1,0,NULL);
SetTimer (2,12000,NULL);
CRect m_rect;
GetClientRect (&m_rect );
myflash.MoveWindow (&m_rect);//使flash 控件占满整个视区域
return 0;
}
char *a = new char [512];
GetCurrentDirectory (100,a);
CString *s=new CString(a);
myflash.LoadMovie (0,*s+CString("\\zf.swf"));//这里一定要为全路径
myflash.Play();//播放FLASH动画
(5)两个高级话题
5.1 在VC中用COM接口对ms agent 进行操作 #include "stdafx.h"
#include <ole2.h>
#include <AgtSvr.h>
#include <AgtSvr_i.c>
#include <tchar.h>
const LPWSTR kpwszCharacter =L"dot.acs";
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
IAgent *pAgent;
if (FAILED(OleInitialize(NULL)))
return -1;
HRESULT hRes=CoCreateInstance (CLSID_AgentServer,
NULL,
CLSCTX_LOCAL_SERVER,
IID_IAgent,
(LPVOID*)&pAgent);
//下面的代码调用IAgent::Load()方法来装入一个动画人物的数据
//由于Agent服务器在自己的内存空间中运行,所以传送的字符串变量需要用SysAllocString()来分配内存
VARIANTARG vPath;
VariantInit(&vPath);
//初始化OLE变量
vPath.vt = VT_BSTR;
//指明变量类型为Unic