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操作,很多人也许看了我的博客,会发现网站上有很多的人总结得比我要好,这点我承认,因为自己能力有限,但是,从这篇博客起,我会参照以前大神们写的博客,添加大神们写 ...
随机推荐
- 【转】Linux 中清空或删除大文件内容的五种方法(truncate 命令清空文件)
原文: http://www.jb51.net/article/100462.htm truncate -s 0 access.log -------------------------------- ...
- Android开发Tips(2)
欢迎Follow我的GitHub, 关注我的CSDN. 我会介绍关于Android的一些有趣的小知识点. 上一篇. 1. Dagger2的开发顺序 Module -> Component -&g ...
- HDU4911:Inversion
Problem Description bobo has a sequence a1,a2,-,an. He is allowed to swap two adjacent numbers for n ...
- OpenSSL Heartbleed "心脏滴血"漏洞简单攻击示例
转自:http://www.lijiejie.com/openssl-heartbleed-attack/ OpenSSL Heartbleed漏洞的公开和流行让许多人兴奋了一把,也让另一些人惊慌了一 ...
- Laravel之备忘项(不定期更新)
1.自定义字段验证错误信息 $this->validate($request, ['name' => 'required|max:50'], ['name.required' => ...
- Android SDK安装时出错“android Failed to rename directory”的解决方法
Android SDK安装时出错"android Failed to rename directory"的解决的方法 安装Android SDK时遇到Failed to r ...
- bzoj2115【WC2001】Xor
2115: [Wc2011] Xor Time Limit: 10 Sec Memory Limit: 259 MB Submit: 2059 Solved: 856 [Submit][Statu ...
- redmine安装笔记
切换到redmine安装目录 对所有ip开放启动命令,并且注册为后台运行 nohup ruby bin/rails server webrick -e production -b 0.0.0.0 -p ...
- vs2012_error C2061: 语法错误: 标识符“uint64_t”
加入头文件#include <stdint.h>
- bootstrap之PressKeyCode&&LongPressKeyCode
PressKeyCode package io.appium.android.bootstrap.handler; import com.android.uiautomator.core.UiDevi ...