• 大小: 3.09MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-27
  • 语言: 其他
  • 标签: flex  dll  ane  

资源简介

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] = ‘\0‘;
    
    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] = ‘\0‘;
    delete [] wszString;
}

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

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

     文件      20427  2012-03-16 03:37  FlexANEDll_TestPrj\01_MyTestDll\FlashRuntimeExtensions.h

     文件       8614  2012-03-16 03:38  FlexANEDll_TestPrj\01_MyTestDll\FlashRuntimeExtensions.lib

     文件        340  2013-08-30 17:10  FlexANEDll_TestPrj\01_MyTestDll\MyTestDll.clw

     文件       5917  2013-08-30 17:45  FlexANEDll_TestPrj\01_MyTestDll\MyTestDll.cpp

     文件        230  2013-08-30 17:26  FlexANEDll_TestPrj\01_MyTestDll\MyTestDll.def

     文件       4263  2013-08-30 17:45  FlexANEDll_TestPrj\01_MyTestDll\MyTestDll.dsp

     文件        541  2013-08-30 17:10  FlexANEDll_TestPrj\01_MyTestDll\MyTestDll.dsw

     文件       2065  2013-08-30 17:36  FlexANEDll_TestPrj\01_MyTestDll\MyTestDll.h

     文件      50176  2013-08-30 17:45  FlexANEDll_TestPrj\01_MyTestDll\MyTestDll.ncb

     文件      53760  2013-08-30 17:45  FlexANEDll_TestPrj\01_MyTestDll\MyTestDll.opt

     文件       1836  2013-08-30 17:45  FlexANEDll_TestPrj\01_MyTestDll\MyTestDll.plg

     文件       3083  2013-08-30 17:10  FlexANEDll_TestPrj\01_MyTestDll\MyTestDll.rc

     文件       2603  2013-08-30 17:10  FlexANEDll_TestPrj\01_MyTestDll\ReadMe.txt

     文件      24576  2013-08-30 17:45  FlexANEDll_TestPrj\01_MyTestDll\Release\MyTestDll.dll

     文件       2152  2013-08-30 17:45  FlexANEDll_TestPrj\01_MyTestDll\Release\MyTestDll.lib

     文件        401  2013-08-30 17:10  FlexANEDll_TestPrj\01_MyTestDll\res\MyTestDll.rc2

     文件        381  2013-08-30 17:10  FlexANEDll_TestPrj\01_MyTestDll\Resource.h

     文件        211  2013-08-30 17:10  FlexANEDll_TestPrj\01_MyTestDll\StdAfx.cpp

     文件       1447  2013-08-30 17:10  FlexANEDll_TestPrj\01_MyTestDll\StdAfx.h

     文件       1710  2013-08-31 17:25  FlexANEDll_TestPrj\02_MyLibrary\.actionscriptProperties

     文件        304  2013-08-31 17:25  FlexANEDll_TestPrj\02_MyLibrary\.flexLibProperties

     文件        475  2013-08-31 17:24  FlexANEDll_TestPrj\02_MyLibrary\.project

     文件         88  2013-08-31 17:24  FlexANEDll_TestPrj\02_MyLibrary\.settings\org.eclipse.core.resources.prefs

     文件       2104  2013-08-31 17:30  FlexANEDll_TestPrj\02_MyLibrary\bin\MyLibrary.swc

     文件        418  2013-08-31 17:29  FlexANEDll_TestPrj\02_MyLibrary\src\com\MyDllTest\MyDllAs.as

     文件       1642  2013-08-25 17:09  FlexANEDll_TestPrj\03_MyANEPack\2.p12

     文件        479  2013-08-31 17:31  FlexANEDll_TestPrj\03_MyANEPack\extension.xml

     文件       1267  2013-08-31 17:30  FlexANEDll_TestPrj\03_MyANEPack\library.swf

     文件       2104  2013-08-31 17:30  FlexANEDll_TestPrj\03_MyANEPack\MyLibrary.swc

     文件       9584  2013-08-31 17:33  FlexANEDll_TestPrj\03_MyANEPack\MyTestDll.ane

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

评论

共有 条评论