在DirectX9里提供的一个例子
#include <dshow.h>
void main(void)
{
IGraphBuilder *pGraph = NULL;
IMediaControl *pControl = NULL;
IMediaEvent *pEvent = NULL; // Initialize the COM library.
HRESULT hr = CoInitialize(NULL);
if (FAILED(hr))
{
printf("ERROR - Could not initialize COM library");
return;
} // Create the filter graph manager and query for interfaces.
hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
IID_IGraphBuilder, (void **)&pGraph);
if (FAILED(hr))
{
printf("ERROR - Could not create the Filter Graph Manager.");
return;
} hr = pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);
hr = pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent); // Build the graph. IMPORTANT: Change this string to a file on your system.
hr = pGraph->RenderFile(L"C:\\Example.avi", NULL);
if (SUCCEEDED(hr))
{
// Run the graph.
hr = pControl->Run();
if (SUCCEEDED(hr))
{
// Wait for completion.
long evCode;
pEvent->WaitForCompletion(INFINITE, &evCode); // Note: Do not use INFINITE in a real application, because it
// can block indefinitely.
}
}
pControl->Release();
pEvent->Release();
pGraph->Release();
CoUninitialize();
}编译时会出错。
directshow1.obj : error LNK2001: unresolved external symbol _IID_IMediaEvent
directshow1.obj : error LNK2001: unresolved external symbol _IID_IMediaControl
directshow1.obj : error LNK2001: unresolved external symbol _CLSID_FilterGraph
directshow1.obj : error LNK2001: unresolved external symbol _IID_IGraphBuilderinclude和lib的路径已设好了。
请问还有可能哪里出错,谢谢
#include <dshow.h>
void main(void)
{
IGraphBuilder *pGraph = NULL;
IMediaControl *pControl = NULL;
IMediaEvent *pEvent = NULL; // Initialize the COM library.
HRESULT hr = CoInitialize(NULL);
if (FAILED(hr))
{
printf("ERROR - Could not initialize COM library");
return;
} // Create the filter graph manager and query for interfaces.
hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
IID_IGraphBuilder, (void **)&pGraph);
if (FAILED(hr))
{
printf("ERROR - Could not create the Filter Graph Manager.");
return;
} hr = pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);
hr = pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent); // Build the graph. IMPORTANT: Change this string to a file on your system.
hr = pGraph->RenderFile(L"C:\\Example.avi", NULL);
if (SUCCEEDED(hr))
{
// Run the graph.
hr = pControl->Run();
if (SUCCEEDED(hr))
{
// Wait for completion.
long evCode;
pEvent->WaitForCompletion(INFINITE, &evCode); // Note: Do not use INFINITE in a real application, because it
// can block indefinitely.
}
}
pControl->Release();
pEvent->Release();
pGraph->Release();
CoUninitialize();
}编译时会出错。
directshow1.obj : error LNK2001: unresolved external symbol _IID_IMediaEvent
directshow1.obj : error LNK2001: unresolved external symbol _IID_IMediaControl
directshow1.obj : error LNK2001: unresolved external symbol _CLSID_FilterGraph
directshow1.obj : error LNK2001: unresolved external symbol _IID_IGraphBuilderinclude和lib的路径已设好了。
请问还有可能哪里出错,谢谢
解决方案 »
- 关于列表控件的问题,麻烦大人们看看
- 请教完成端口,如何解除最大的连接限制
- 请教将一个YUV文件转化成一张图片
- 聊天程序界面用MFC对话框 调用SOCKET API
- 请问如果我想实现点击一子菜单项时获得该菜单项的名称以及其父菜单项的标题,我该怎么做?
- 如何将BYTE转换成CString?
- socket client OnReceive的处理(急急急)
- 例如:2003年5月15日如何转换为time_t类型的时间值?
- 在线等待:A,B两台机子在不同的局域网内上网,互相访问对方机子?(彼此知道对方外网的IP也可以)!
- 一个比较奇怪的问题?
- 如何对一个16位的双声道的wave文件进行分贝计算得到它的平均分贝数值?
- 续WINMAIN.CPP文件执行第2贴
________________要放到其他路径之前。
#pragma comment(lib,"Strmiids.lib")
D:\DXSDK\Lib
D:\DXSDK\SAMPLES\C++\DIRECTSHOW\BASECLASSES\DEBUG
D:\DXSDK\SAMPLES\C++\DIRECTSHOW\BASECLASSES\RELEASE
include里:
D:\DXSDK\INCLUDE
d:\DXSDK\SAMPLES\C++\DIRECTSHOW\BASECLASSES都加好了
路径添加了只是表示要在这个路径里边去搜索.h和.lib文件,但是编译器不知道你需要使用哪个.h和.lib文件。
#pragma comment(lib,"Strmiids.lib")
就是指定需要连接的lib文件,就像
#include <dshow.h>
指定需要包含的头文件一个道理。
所以问下,谢谢各位