可以把AVI放到资源中并播放出来吗?
问题点数:20、回复次数:8Top
1 楼dfq19(dfq)回复于 2001-09-16 17:03:06 得分 0
一个最简单的方法是创建一个临时文件,下面地址有关于播放jpg,tiff等格式资源的例子,
用的方法就是创建临时文件,速度还不错,这一方法对于任何资源都有效,只要有播放该资源文件
的函数即可播放该资源
http://www.codeproject.com/bitmap/cximage.aspTop
2 楼LZLZ(柳州浪子)回复于 2001-09-16 17:05:41 得分 0
当然可以
Top
3 楼emmai(WaTaXiWaWaTaXi)回复于 2001-09-16 17:08:50 得分 0
gzTop
4 楼Brunhild()回复于 2001-09-18 09:02:47 得分 0
upTop
5 楼111222(www.111222.cn)回复于 2001-09-18 09:37:11 得分 0
CAnimateCtrl ani;
ani.Create(WS_CHILD |WS_VISIBLE ,CRect(0,0,15,15),this/*parent CWnd*/,IDC_MY_ANI);
ani.Play(0.,-1,-1);
.......
Top
6 楼Colorstone(不偏不倚谓之正)回复于 2001-09-18 10:54:55 得分 0
把Email发到fu-xu@163.com,我发一份源代码给你(标题写明:play wav resource)Top
7 楼Colorstone(不偏不倚谓之正)回复于 2001-09-18 11:00:52 得分 0
This code was contributed by Anthony Petruso.
Well, this doesn't really deal with MFC, but its useful knowledge if you don't know how..
Parts of this code I ripped from VC++ 4.1 help, but it was outdated and didn't come close to working.
First of all you need to add the wave files to the .rc file manually like so:
<NameOfSound> WAVE <Location of WAVE.>
Example being
Cool WAVE C:\projects\sounds\cool.wav
Then you need to add this function declarion to the class you plan on using..
BOOL PlayResource(LPSTR lpName)
{
BOOL bRtn;
LPSTR lpRes;
HANDLE hRes;
HRSRC hResInfo;
HINSTANCE Nl=AfxGetInstanceHandle();
/* Find the WAVE resource. */
hResInfo= FindResource(Nl,lpName,"WAVE");
if(hResInfo == NULL)
return FALSE;
/* Load the WAVE resource. */
hRes = LoadResource(Nl,hResInfo);
if (hRes == NULL)
return FALSE;
/* Lock the WAVE resource and play it. */
lpRes=(LPSTR)LockResource(hRes);
if(lpRes==NULL)
return FALSE;
bRtn = sndPlaySound(lpRes, SND_MEMORY | SND_SYNC);
if(bRtn == NULL)
return FALSE;
/* Free the WAVE resource and return success or failure. */
FreeResource(hRes);
return TRUE;
}
Then to play the sound you simply use:
PlayResource("<soundname>");
Example being
PlayResource("Cool");
Top
8 楼caogp()回复于 2001-11-02 18:47:18 得分 20
topTop




