---
title: "Flex3 做界面与 VC交互"
author: "cwsot"
date: "2012-07-02T10:22:52Z"
tags: []
categories: ["非技术"]
slug: "flex3-vc"
draft: false
lastmod: "2012-07-02T10:22:52Z"
id: 1573717
url: "https://cwsot.iteye.com/blog/1573717"
---

Flex3 代码  width="400" height="290" creationComplete="init()" xmlns:local="*" borderColor="#063D64"> width="350" fontWeight="bold" height="21" id="title"/> width="21" height="21" click="minsizeHandle()"/> width="21" height="21" click="closeHandle()"/> width="100%" height="80" source="@Embed('xx.jpg')" />   width="198" id="login_user"/> width="198" id="login_pass" displayAsPassword="true"/> width="236" id="checkbox_remote"/> width="100%" height="1"/> width="70" click="loginHandle()"/> width="70" click="logoutHandle()"/> width="380" id="tip"/> width="100%"/>      新建一个对话框工程，添加ShockwaveFlash控件，为控件创建一个实例成员和交互代码 ShockwaveFlash m_FlashCtrl; //对话框初始化swf CString szFlashPath(m_FlashCtrl.GetModulePath()); szFlashPath += "test.swf"; m_FlashCtrl.LoadMovie(0, szFlashPath); MoveWindow(0, 0, 400, 290); m_FlashCtrl.MoveWindow(0, 0, 400, 290); //消息映射，与flash交互 BEGIN_EVENTSINK_MAP(CUIShowDlg, CDialog) ON_EVENT(CUIShowDlg, IDC_FLASH, 150, OnFsCommand, VTS_BSTR VTS_BSTR) END_EVENTSINK_MAP() void CUIShowDlg::OnFsCommand(LPCTSTR command, LPCTSTR args) { if( ! strcmp(command, "login") ) { CString strCmd = "Helloworld"; m_FlashCtrl.CallFunction(strCmd.GetBuffer(0)); } else if( ! strcmp(command, "logout") ) { } else if( ! strcmp(command, "title") ) { if( ! strcmp(args, "mouseDown") ) { SendMessage(WM_NCLBUTTONDOWN, HTCAPTION, 0); } } else if( ! strcmp(command, "close") ) { this->EndDialog(0); } else if( ! strcmp(command, "minsize") ) { this->ShowWindow(SW_SHOWMINIMIZED); } else { } }