c++操作flash
c++操作falsh,忘了原文在哪了,自己尝试了,直接贴代码
// SDK版本
////////////////////////////////////////////////////////////////////////////////
// Use swflash.ocx to play flash
// if it works, it is written by masterz, otherwise I don't know who writes it(*_*)
////////////////////////////////////////////////////////////////////////////////
//#include "stdafx.h"
//#import "c:\windows\system32\macromed\flash\swflash.ocx"
#import "C:\WINDOWS\system32\Macromed\Flash\Flash32_11_8_800_94.ocx"
#include <atlbase.h>
CComModule _Module;
#include <atlwin.h>
#include <windows.h>
#include "stdio.h"
#pragma comment(lib,"atl")
#define ODS(x) OutputDebugString(x)
#define MAX_LOADSTRING 100 // Global Variables: HINSTANCE hInst; // current instance
TCHAR szTitle[MAX_LOADSTRING]; // The title bar text
TCHAR szWindowClass[MAX_LOADSTRING]; // The title bar text
CAxWindow m_container;
using namespace ShockwaveFlashObjects;
IShockwaveFlash* shwaveflash; HWND heditfilepath; // Foward declarations of functions included in this code module:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
MSG msg;
// Initialize global strings
wsprintf(szTitle, _T("use flash control in sdk exe"));
wsprintf(szWindowClass, _T("flashinsdk"));
MyRegisterClass(hInstance);
CoInitialize(NULL);
// Perform application initialization:
if (!InitInstance (hInstance, nCmdShow))
return FALSE;
while (GetMessage(&msg, NULL, , ))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
CoUninitialize();
return msg.wParam;
} // FUNCTION: MyRegisterClass()
// PURPOSE: Registers the window class.
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = (WNDPROC)WndProc;
wcex.cbClsExtra = ;
wcex.cbWndExtra = ;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+);
wcex.lpszMenuName = NULL;//(LPCSTR)IDC_FLSH;
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
return RegisterClassEx(&wcex);
} // FUNCTION: InitInstance(HANDLE, int)
// PURPOSE: Saves instance handle and creates main window
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hWnd;
hInst = hInstance; // Store instance handle in our global variable
AtlAxWinInit();
hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, , CW_USEDEFAULT, , NULL, NULL, hInstance, NULL);
if (!hWnd)
return FALSE;
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return TRUE;
} LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
TCHAR szHello[MAX_LOADSTRING];
wsprintf(szHello, _T("use flash control in sdk"));
HWND hbtnstart;
RECT rc;
switch (message)
{
case WM_CREATE:
GetClientRect(hWnd, &rc );
rc.top = ;
m_container.Create( hWnd, rc, _T("{D27CDB6E-AE6D-11cf-96B8-444553540000}"),WS_CHILD |WS_VISIBLE |WS_HSCROLL |WS_VSCROLL );//create a browser control
hbtnstart=CreateWindow(_T("BUTTON"), _T("play"), WS_CHILD|WS_VISIBLE,,,,,hWnd,(HMENU)0x100,hInst,);
heditfilepath=CreateWindow(_T("EDIT"), _T("filepath"),WS_CHILD |WS_VISIBLE |WS_BORDER,,,,,hWnd,(HMENU)0x101,hInst,);
SetWindowText(heditfilepath, _T("E:\\test\\c++\\flashocx\\Debug\\loginui.swf"));
m_container.QueryControl( __uuidof(IShockwaveFlash), reinterpret_cast<void**>(&shwaveflash) );
break;
case WM_SIZING:
GetClientRect(hWnd, &rc );
rc.top = ;
m_container.MoveWindow(&rc,true);
shwaveflash->SetZoomRect( , , rc.right - rc.left, rc.bottom - rc.top );
break;
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case 0x100:
{
ODS(_T("0x100"));
wchar_t buf[];
GetWindowText(heditfilepath, (LPWSTR)buf,);
_bstr_t bstr((wchar_t*)buf);
//ODS(buf);
//bstr=_bstr_t(_T("c:\\2.1.swf"));
//bstr=_bstr_t(_T("E:\\test\\c++\\flashocx\\Debug\\loginui.swf"));
if(shwaveflash->put_Movie(bstr)!=S_OK){// you have to change the path here
ODS(_T("load movie error"));
}else{
shwaveflash->Play();
shwaveflash->SetVariable(_bstr_t(_T("user")), _bstr_t(_T("testuser")));
shwaveflash->SetVariable(_bstr_t(_T("password")), _bstr_t(_T("password")));
GetClientRect(hWnd, &rc );
shwaveflash->SetZoomRect( , , rc.right - rc.left, rc.bottom - rc.top );
shwaveflash->PutMenu( false );
}
}
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
RECT rt;
GetClientRect(hWnd, &rt);
DrawText(hdc, szHello, strlen((const char*)szHello), &rt, DT_CENTER);
EndPaint(hWnd, &ps);
break;
case WM_DESTROY:
PostQuitMessage();
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return ; }
下面是尝试的swf
http://files.cnblogs.com/marcher/loginui.swf
c++操作flash的更多相关文章
- C#操作Flash动画
对于在C#开发的过程中没有接触过Flash相关开发的人员来说,没有系统的资料进行学习,那么这篇文档针对于初学者来说是很好的学习DEMO. 本文章中的DEMO实现了C#的COM控件库中本来就带有对fla ...
- STM32F10X SPI操作flash MX25L64读写数据(转)
源:STM32F10X SPI操作flash MX25L64读写数据 前一段时间在弄SPI,之前没接触过嵌入式外围应用,就是单片机也只接触过串口通信,且也是在学校的时候了.从离开手机硬件测试岗位后,自 ...
- selenium自动化过程中如何操作Flash动画
最近在看python的爬虫框架(scrapy),一个词概括就是:"酸爽"!等把selenium自动化版块讲完后,打算写一写关于scrapy相关的知识,打算从源码角度解析下scrap ...
- SPI操作flash MX25L64读写数据
STM32F10X SPI操作flash MX25L64读写数据 简单的一种应用,ARM芯片作为master,flash为slaver,实现单对单通信.ARM主控芯片STM32F103,flash芯片 ...
- Selenium+Java - 结合sikuliX操作Flash网页
前言 前天被一个Flash的轮播图,给玩坏了,无法操作,后来请教了下crazy总拿到思路,今天实践了下,果然可以了,非常感谢! 模拟场景 打开百度地图 切换城市到北京 使用测距工具 测量 奥林匹克森林 ...
- Delphi 操作Flash D7~XE10都有 导入Activex控件 shockwave
http://www.cnblogs.com/devcjq/articles/2906224.html Flash是Macromedia公司出品的,用在互联网上动态的.可互动的shockwave.它的 ...
- STM32的SPI2操作Flash
关于STM32F107的SPI标志 SPI_I2S_FLAG_BSY和SPI_I2S_FLAG_TXE的疑问 http://www.openedv.com/posts/list/23579.htm ...
- selenium结合sikuliX操作Flash网页
sikuli的官网地址:http://www.sikuli.org 首先下载sikuliX的jar包:https://launchpad.net/sikuli/sikulix/1.1.0 java-d ...
- MSP430 flash的操作
今天顺便研究了一下msp430的flash操作,很多人也许看了我的博客,会发现网站上有很多的人总结得比我要好,这点我承认,因为自己能力有限,但是,从这篇博客起,我会参照以前大神们写的博客,添加大神们写 ...
随机推荐
- ANGULARJS: UNDERSTANDING DIRECTIVE SCOPE
https://www.3pillarglobal.com/insights/angularjs-understanding-directive-scope --------------------- ...
- 用Jmeter对数据库执行压力测试
转载:http://www.cnblogs.com/chengtch/p/6198900.html 在我看来压力测试的压测对象可以分为UI,接口及数据库三个部分吧,对界面及接口进行压测还算熟悉, 定位 ...
- html 上下左右都居中
给要居中的图片或者链接所在的div 设置例如以下属性 width: px; height: wd=px&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqI ...
- 【Excle数据透视表】如何在组的顶部显示分类汇总
调整前 调整后 例 ...
- asp.net core mvc视频A:笔记3-1.视图基本用法
常用介绍 注意:ViewBag是对View的封装,所以如果两者键值(Key)是一样的话,后者会覆盖前者. 新建项目,添加空控制器 小技巧-快速添加视图 控制器方法,使用ViewData和ViewBag ...
- asp.net core mvc视频A:笔记2-1.控制器定义
方式一:以Controller结尾 方式二:不以Controller结尾 思考 默认路由规则为 运行示例(这里不需要写testcontroller,只写test就可以了) 同理测试test类中的控制器 ...
- Quartus和ISE调用Synplify进行综合的问题
分别尝试采用Quartus和ISE调用第三方综合软件Synplify进行综合. [软件版本] Quartus II 13.0 (SP).ISE 14.4 .Synplify 201303. [问题描述 ...
- 常见Linux/Unix开发辅助命令什锦
很多零碎命令集锦: 1. 怎样通过命令下载ftp文件 read -s -p "Your passwd: " Passwd; wget --user=YourUserName --p ...
- python单元测试unittest实例详解
转自:http://blog.csdn.net/five3/article/details/7104466 单元测试作为任何语言的开发者都应该是必要的,因为时隔数月后再回来调试自己的复杂程序时,其实也 ...
- Junit 内部解密之二: TestResult + TestListener + Assert
转自:http://blog.sina.com.cn/s/blog_6cf812be0100wbhw.html 之前我们看到了Test接口里面的run方法有个TestResult的参数,不错,这个类就 ...