flex中调用dll,测试可用


flex中调用dll,可以让大家方便的控制各种硬件设备等
资源截图
代码片段和文件信息
// MyTestDll.cpp : Defines the initialization routines for the DLL.
//

#include “stdafx.h“
#include “MyTestDll.h“

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


/////////////////////////////////////////////////////////////////////////////
// CMyTestDllApp

BEGIN_MESSAGE_MAP(CMyTestDllApp CWinApp)
//{{AFX_MSG_MAP(CMyTestDllApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
//    DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMyTestDllApp construction

CMyTestDllApp::CMyTestDllApp()
{
// TODO: add construction code here
// Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CMyTestDllApp object




// ===============================================================
CMyTestDllApp theApp;

#pragma comment(lib “FlashRuntimeExtensions.lib“)
FREContext context;

// ===============================================================
// 播放本DLL内的WAV声音资源,默认异步操作
// ===============================================================
#include 
#pragma comment(lib “Winmm.lib“)
BOOL PlayWavRes(char *pFile BOOL bAsyn)
{
    HMODULE hMod = theApp.m_hInstance;
    int nFileLen = strlen(pFile);
    int nSndIdx = 0;
    BOOL bRet;
    
    if (nFileLen > 3)
    {
        DWORD dwFlag = (SND_FILENAME | SND_NODEFAULT);
        dwFlag |= (bAsyn ? SND_SYNC : SND_ASYNC);
        bRet = PlaySound((LPCTSTR)pFile NULL dwFlag);
    }
    else
    {
        nSndIdx = atoi(pFile) + 1000;
        DWORD dwFlag = (SND_RESOURCE | SND_NODEFAULT);
        dwFlag |= (bAsyn ? SND_SYNC : SND_ASYNC);
        if(!hMod) hMod = GetModuleHandle(NULL); // NULL则取EXE的句柄
        bRet = PlaySound((LPCTSTR)nSndIdx hMod dwFlag);
    }
    
    return bRet;
}


// ===============================================================
// 转换中文
// ===============================================================
void utf8_to_ansi(char* src char* &dest) 
{
    int wcsLen = ::MultiByteToWideChar(CP_UTF8 NULL src strlen(src) NULL 0);//测试转换
    wchar_t* wszString = new wchar_t[wcsLen + 1];
    ::MultiByteToWideChar(CP_UTF8 NULL src strlen(src) wszString wcsLen);  //utf8 转Unicode
    wszString[wcsLen] = ‘‘;
    
    int ansiLen = ::WideCharToMultiByte(CP_ACP NULL wszString wcslen(wszString) NULL 0 NULL NULL);
    dest = new char[ansiLen + 1];   //unicode版对应的strlen是wcslen
    ::WideCharToMultiByte(CP_ACP NULL wszString wcslen(wszString) dest ansiLen NULL NULL);
    dest[ansiLen] = ‘‘;
    delete [] wszString;
}

// ===============================================================
// 获取Char*长度
// ===============================================================
int getCharLength(c

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      20427  2012-03-16 03:37  FlexANEDll_TestPrj1_MyTestDllFlashRuntimeExtensions.h

     文件       8614  2012-03-16 03:38  FlexANEDll_TestPrj1_MyTestDllFlashRuntimeExtensions.lib

     文件        340  2013-08-30 17:10  FlexANEDll_TestPrj1_MyTestDllMyTestDll.clw

     文件       5917  2013-08-30 17:45  FlexANEDll_TestPrj1_MyTestDllMyTestDll.cpp

     文件        230  2013-08-30 17:26  FlexANEDll_TestPrj1_MyTestDllMyTestDll.def

     文件       4263  2013-08-30 17:45  FlexANEDll_TestPrj1_MyTestDllMyTestDll.dsp

     文件        541  2013-08-30 17:10  FlexANEDll_TestPrj1_MyTestDllMyTestDll.dsw

     文件       2065  2013-08-30 17:36  FlexANEDll_TestPrj1_MyTestDllMyTestDll.h

     文件      50176  2013-08-30 17:45  FlexANEDll_TestPrj1_MyTestDllMyTestDll.ncb

     文件      53760  2013-08-30 17:45  FlexANEDll_TestPrj1_MyTestDllMyTestDll.opt

     文件       1836  2013-08-30 17:45  FlexANEDll_TestPrj1_MyTestDllMyTestDll.plg

     文件       3083  2013-08-30 17:10  FlexANEDll_TestPrj1_MyTestDllMyTestDll.rc

     文件       2603  2013-08-30 17:10  FlexANEDll_TestPrj1_MyTestDllReadMe.txt

     文件      24576  2013-08-30 17:45  FlexANEDll_TestPrj1_MyTestDllReleaseMyTestDll.dll

     文件       2152  2013-08-30 17:45  FlexANEDll_TestPrj1_MyTestDllReleaseMyTestDll.lib

     文件        401  2013-08-30 17:10  FlexANEDll_TestPrj1_MyTestDll
esMyTestDll.rc2

     文件        381  2013-08-30 17:10  FlexANEDll_TestPrj1_MyTestDllResource.h

     文件        211  2013-08-30 17:10  FlexANEDll_TestPrj1_MyTestDllStdAfx.cpp

     文件       1447  2013-08-30 17:10  FlexANEDll_TestPrj1_MyTestDllStdAfx.h

     文件       1710  2013-08-31 17:25  FlexANEDll_TestPrj2_MyLibrary.actionscriptProperties

     文件        304  2013-08-31 17:25  FlexANEDll_TestPrj2_MyLibrary.flexLibProperties

     文件        475  2013-08-31 17:24  FlexANEDll_TestPrj2_MyLibrary.project

     文件         88  2013-08-31 17:24  FlexANEDll_TestPrj2_MyLibrary.settingsorg.eclipse.core.resources.prefs

     文件       2104  2013-08-31 17:30  FlexANEDll_TestPrj2_MyLibraryinMyLibrary.swc

     文件        418  2013-08-31 17:29  FlexANEDll_TestPrj2_MyLibrarysrccomMyDllTestMyDllAs.as

     文件       1642  2013-08-25 17:09  FlexANEDll_TestPrj3_MyANEPack2.p12

     文件        479  2013-08-31 17:31  FlexANEDll_TestPrj3_MyANEPackextension.xml

     文件       1267  2013-08-31 17:30  FlexANEDll_TestPrj3_MyANEPacklibrary.swf

     文件       2104  2013-08-31 17:30  FlexANEDll_TestPrj3_MyANEPackMyLibrary.swc

     文件       9584  2013-08-31 17:33  FlexANEDll_TestPrj3_MyANEPackMyTestDll.ane

............此处省略49个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)