|
Yes I have installed it. can I know how to declare interface for my compiler. when it works for u it should work for me also. but it is not working.Please help me.
S.Yamini
|
|
|
|
|
I think its better yo show your code so if I know I answer to you of if other people knows then they answer to you.
|
|
|
|
|
#if !defined(AFX_CAPTUREVIDEO_H__057736B5_B61B_4850_8D82_E181E0B25B61__INCLUDED_)
#define AFX_CAPTUREVIDEO_H__057736B5_B61B_4850_8D82_E181E0B25B61__INCLUDED_
//--------------------------------------------------------------------------//
// Copyright DILLIP KUMAR KARA 2004
// You may do whatever you want with this code, as long as you include this
// copyright notice in your implementation files.
// Comments and bug Reports: codeguru_bank@yahoo.com
//--------------------------------------------------------------------------//
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// CaptureVideo.h : header file
#include <atlbase.h>
#include <windows.h>
#include <dshow.h>
//
enum PLAYSTATE {STOPPED, PAUSED, RUNNING, INIT};
#define WM_GRAPHNOTIFY WM_USER+1
#ifndef SAFE_RELEASE
#define SAFE_RELEASE( x ) \
if ( NULL != x ) \
{ \
x->Release( ); \
x = NULL; \
}
#endif
/////////////////////////////////////////////////////////////////////////////
// CCaptureVideo window
class CCaptureVideo : public CWnd
{
// Construction
public:
CCaptureVideo();
// Attributes
public:
void StopCapture();
void StartTVTuner();
void StartWebcam();
void StartCompositeVideo();
void StartSVideo();
void RemoveGraphFromRot(DWORD pdwRegister);
void UnIntializeVideo();
HRESULT InitializeVideo(HWND hWnd);
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CCaptureVideo)
//}}AFX_VIRTUAL
// Implementation
public:
void ResizeVideoWindow();
virtual ~CCaptureVideo();
// Generated message map functions
protected:
//{{AFX_MSG(CCaptureVideo)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
afx_msg HRESULT OnGraphNotify(WPARAM wp , LPARAM lp);
DECLARE_MESSAGE_MAP()
protected:
void ResizeVideoWindowMoniker();
void CloseInterfacesMoniker();
//----------------For Webcam-----------------//
void RemoveGraphFromRotMoniker(DWORD pdwRegister);
HRESULT AddGraphToRotMoniker(IUnknown *pUnkGraph, DWORD *pdwRegister);
HRESULT SetupVideoWindowMoniker();
HRESULT HandleGraphEventMoniker();
HRESULT FindCaptureDeviceMoniker(IMoniker** ppMoniker);
HRESULT AddCaptureMonikerToGraph(IMoniker* pMoniker);
HRESULT CaptureVideoByMoniker();
HRESULT GetInterfacesMoniker();
//------------------Video--------------------//
void DisplayMesg(TCHAR* szFormat, ...);
LRESULT ClearInterfaces(WPARAM wp, LPARAM lp);
void CloseInterfaces();
HRESULT AddGraphToRot(IUnknown* pUnkGraph, DWORD* pdwRegister);
HRESULT CaptureVideo();
HRESULT HandleGraphEvent();
HRESULT ChangePreviewState(int nShow);
HRESULT SetupVideoWindow();
HRESULT FindCaptureDevice(IBaseFilter** ppSrcFilter);
HRESULT GetInterfaces();
private:
UINT chSVideo, chCompVideo , chWebCam , chFullScreen , chAlwaysOnTop ;
int nVSourceCount;
int nAnalogCount;
CBrush m_emptyBrush;
DWORD m_dwGraphRegister;
BOOL bDevCheck;
HWND m_hApp;
//------------------Video--------------------//
IVideoWindow* m_pVW ;
IMediaControl* m_pMC ;
IMediaEventEx* m_pME ;
IGraphBuilder* m_pGraph ;
ICaptureGraphBuilder2* m_pCapture ;
IBaseFilter* pSrcF;
PLAYSTATE m_psCurrent;
//----------------For Webcam-----------------//
IVideoWindow* m_pVWMoniker ;
IMediaControl* m_pMCMoniker ;
IMediaEventEx* m_pMEMoniker ;
ICaptureGraphBuilder2* m_pCaptureMoniker ;
IFilterGraph2* m_pFilterGraph ;// IFilterGraph2 provides AddSourceFileForMoniker()
BOOL bVideo , bWebCam;
int vType;
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_CAPTUREVIDEO_H__057736B5_B61B_4850_8D82_E181E0B25B61__INCLUDED_)
I have copied my header file code but I am getting error only for ICaptureGraphBuilder2
S.Yamini
|
|
|
|
|
First I cant see any ICreateDevEnum on your code and second dont need to post all code and when post a code use of pre tag and can you show your declare of this interface on your cpp file,please.
|
|
|
|
|
'ICaptureGraphBuilder2' : missing storage-class or type specifiers
is the error i am getting in the before code i sent u. Can i know what do u mean by declare of the interface.Sorry I am new to directx
Cpp file
#include "stdafx.h"
#include "LiveVideo.h"
#include "CaptureVideo.h"
HRESULT hr;
if(m_pGraph == NULL){
// Create the filter graph
hr = CoCreateInstance (CLSID_FilterGraph, NULL, CLSCTX_INPROC,
IID_IGraphBuilder, (void **) &m_pGraph);
if (FAILED(hr))
return hr;
}
else
return E_FAIL ;
if(m_pCapture == NULL) {
// Create the capture graph builder
hr = CoCreateInstance (CLSID_CaptureGraphBuilder2 , NULL, CLSCTX_INPROC,
IID_ICaptureGraphBuilder2, (void **) &m_pCapture);
if (FAILED(hr))
return hr;
}
else
return E_FAIL ;
S.Yamini
|
|
|
|
|
R u adding dshow.lib in the project settings. I am new to directx. I have added dshow.h and the other three lib in the project settings and downloaded the directx. What else I can do to solve the error
error C2501: 'ICaptureGraphBuilder2' : missing storage-class or type specifiers
S.Yamini
|
|
|
|
|
You must include dshow.h on your code and import lib files to your project.
|
|
|
|
|
DirectBlow? Have fun. Good luck. Sucks to be you.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Deja vu? Didn't I see this post twice yesterday?
Where are you getting these header files from?
You need the DirectShow SDK. It's part of the platform SDK.
Once you've installed that, make sure your build environment is setup properly.
This is explained in the documentation: Setting Up the Build Environment[^]
ICaptureGraphBuilder2 is defined in strmif.h, which is included by dshow.h.
Compiler errors really should be the least of your problems when using DirectShow.
Mark Salsbery
Microsoft MVP - Visual C++
This episode brought to you by the number 3
|
|
|
|
|
Thank You for ur reply.
I am new to directshow.I am trying to write an application to capture video from web cam.
I am getting ICaptureGraphBuilder2 undeclared identifier.
I have added the Dshow.h to my code
I have added the Quartz.lib Strmiids.lib strmbasd.lib wmvcore.lib wmstub.lib
in the project settings
But when i compile my code I am getting the following errors:
D:\DownLoad\LiveVideo\CaptureVideo.cpp(10) : warning C4651: '/D_MBCS __cplusplus' specified for precompiled header but not for current compile
d:\download\livevideo\capturevideo.h(114) : error C2143: syntax error : missing ';' before '*'
d:\download\livevideo\capturevideo.h(114) : error C2501: 'ICaptureGraphBuilder2' : missing storage-class or type specifiers
d:\download\livevideo\capturevideo.h(114) : error C2501: 'm_pCapture' : missing storage-class or type specifiers
d:\download\livevideo\capturevideo.h(122) : error C2143: syntax error : missing ';' before '*'
d:\download\livevideo\capturevideo.h(122) : error C2501: 'ICaptureGraphBuilder2' : missing storage-class or type specifiers
d:\download\livevideo\capturevideo.h(122) : error C2501: 'm_pCaptureMoniker' : missing storage-class or type specifiers
D:\DownLoad\LiveVideo\CaptureVideo.cpp(33) : error C2065: 'm_pCapture' : undeclared identifier
D:\DownLoad\LiveVideo\CaptureVideo.cpp(40) : error C2065: 'm_pCaptureMoniker' : undeclared identifier
D:\DownLoad\LiveVideo\CaptureVideo.cpp(104) : error C2065: 'CLSID_CaptureGraphBuilder2' : undeclared identifier
D:\DownLoad\LiveVideo\CaptureVideo.cpp(105) : error C2065: 'IID_ICaptureGraphBuilder2' : undeclared identifier
D:\DownLoad\LiveVideo\CaptureVideo.cpp(315) : error C2065: 'LONG_PTR' : undeclared identifier
D:\DownLoad\LiveVideo\CaptureVideo.cpp(315) : error C2059: syntax error : ')'
D:\DownLoad\LiveVideo\CaptureVideo.cpp(316) : error C2143: syntax error : missing ';' before '{'
D:\DownLoad\LiveVideo\CaptureVideo.cpp(342) : error C2227: left of '->SetFiltergraph' must point to class/struct/union
D:\DownLoad\LiveVideo\CaptureVideo.cpp(381) : error C2227: left of '->RenderStream' must point to class/struct/union
D:\DownLoad\LiveVideo\CaptureVideo.cpp(442) : error C2065: 'DWORD_PTR' : undeclared identifier
D:\DownLoad\LiveVideo\CaptureVideo.cpp(442) : error C2146: syntax error : missing ')' before identifier 'pUnkGraph'
D:\DownLoad\LiveVideo\CaptureVideo.cpp(443) : error C2059: syntax error : ')'
D:\DownLoad\LiveVideo\CaptureVideo.cpp(509) : error C2227: left of '->Release' must point to class/struct/union
D:\DownLoad\LiveVideo\CaptureVideo.cpp(538) : error C2227: left of '->Release' must point to class/struct/union
D:\DownLoad\LiveVideo\CaptureVideo.cpp(713) : error C2227: left of '->SetFiltergraph' must point to class/struct/union
D:\DownLoad\LiveVideo\CaptureVideo.cpp(721) : error C2227: left of '->RenderStream' must point to class/struct/union
D:\DownLoad\LiveVideo\CaptureVideo.cpp(862) : error C2059: syntax error : ')'
D:\DownLoad\LiveVideo\CaptureVideo.cpp(863) : error C2143: syntax error : missing ';' before '{'
D:\DownLoad\LiveVideo\CaptureVideo.cpp(868) : error C2065: 'EC_DEVICE_LOST' : undeclared identifier
D:\DownLoad\LiveVideo\CaptureVideo.cpp(868) : error C2051: case expression not constant
D:\DownLoad\LiveVideo\CaptureVideo.cpp(920) : error C2146: syntax error : missing ')' before identifier 'pUnkGraph'
D:\DownLoad\LiveVideo\CaptureVideo.cpp(921) : error C2059: syntax error : ')'
D:\DownLoad\LiveVideo\CaptureVideo.cpp(1001) : error C2227: left of '->FindInterface' must point to class/struct/union
D:\DownLoad\LiveVideo\CaptureVideo.cpp(1005) : error C2227: left of '->FindInterface' must point to class/struct/union
D:\DownLoad\LiveVideo\CaptureVideo.cpp(1067) : error C2227: left of '->FindInterface' must point to class/struct/union
D:\DownLoad\LiveVideo\CaptureVideo.cpp(1071) : error C2227: left of '->FindInterface' must point to class/struct/union
D:\DownLoad\LiveVideo\CaptureVideo.cpp(1145) : error C2227: left of '->FindInterface' must point to class/struct/union
D:\DownLoad\LiveVideo\CaptureVideo.cpp(1149) : error C2227: left of '->FindInterface' must point to class/struct/union
LiveVideo.cpp
D:\DownLoad\LiveVideo\LiveVideo.cpp(4) : warning C4651: '/D_MBCS __cplusplus' specified for precompiled header but not for current compile
d:\download\livevideo\capturevideo.h(114) : error C2143: syntax error : missing ';' before '*'
d:\download\livevideo\capturevideo.h(114) : error C2501: 'ICaptureGraphBuilder2' : missing storage-class or type specifiers
d:\download\livevideo\capturevideo.h(114) : error C2501: 'm_pCapture' : missing storage-class or type specifiers
d:\download\livevideo\capturevideo.h(122) : error C2143: syntax error : missing ';' before '*'
d:\download\livevideo\capturevideo.h(122) : error C2501: 'ICaptureGraphBuilder2' : missing storage-class or type specifiers
d:\download\livevideo\capturevideo.h(122) : error C2501: 'm_pCaptureMoniker' : missing storage-class or type specifiers
LiveVideoDlg.cpp
D:\DownLoad\LiveVideo\LiveVideoDlg.cpp(4) : warning C4651: '/D_MBCS __cplusplus' specified for precompiled header but not for current compile
d:\download\livevideo\capturevideo.h(114) : error C2143: syntax error : missing ';' before '*'
d:\download\livevideo\capturevideo.h(114) : error C2501: 'ICaptureGraphBuilder2' : missing storage-class or type specifiers
d:\download\livevideo\capturevideo.h(114) : error C2501: 'm_pCapture' : missing storage-class or type specifiers
d:\download\livevideo\capturevideo.h(122) : error C2143: syntax error : missing ';' before '*'
d:\download\livevideo\capturevideo.h(122) : error C2501: 'ICaptureGraphBuilder2' : missing storage-class or type specifiers
d:\download\livevideo\capturevideo.h(122) : error C2501: 'm_pCaptureMoniker' : missing storage-class or type specifiers
Generating Code...
Error executing cl.exe.
Please help me
S.Yamini
|
|
|
|
|
You must first these interfaces for VC++ then use of lib files,but I think maybe you dont have include files on your system did you search on your computer for see does these filex exist on your computer or no?
|
|
|
|
|
You need to start with a good solid Windows application project.
I would create a new one with the wizard.
If you're on Visual C++ 6.0, I'm not sure what issues you'll have. You may want to post a
question to 6.0 users about using the latest platform SDK with that version of C++.
Your project settings and build environment settings need to be solid for any Windows project,
especially when using DirectShow, DirectX, etc.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
This episode brought to you by the number 3
|
|
|
|
|
Can anyone help me please to change the bar color of an XP styled
CProgressCtrl please...
Thanx'n'Advance
|
|
|
|
|
|
Thanx for replyin....
I have tried it.
send->m_ProgressSend.SendMessage(PBM_SETBARCOLOR,0,RGB(255,0,0));
This seems to work only if i dont use xp style.
is thr any other way out????
Thanx'n'advance
|
|
|
|
|
|
Thank u...
i already have a copy of processviewer with me...
but i would like a brief info about how its achieved ....
thanx'n'advance
|
|
|
|
|
See if this helps.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello everyone!
I'm trying to enumerate all the paths on my C:\ drive. I want this:
C:
C:\folder
C:\folder\subfolder
C:\folder\subfolder\subsubfolder
C:\folder\subfolder\subsubfolder\etc
...but instead I get this:
C:
C:\folder
C:\folder\.
C:\folder\.\.
C:\folder\.\.\.
What's the correct way of doing this? I'm using FindFirstFile and FindNextFile, not using MFC.
Thanks people!
Windows Calculator told me I will die at 28.
|
|
|
|
|
See this illustration from MSDN, the part you are missing in colored in red...
#include <afx.h>
#include <iostream>
using namespace std;
void Recurse(LPCTSTR pstr)
{
CFileFind finder;
CString strWildcard(pstr);
strWildcard += _T("\\*.*");
BOOL bWorking = finder.FindFile(strWildcard);
while (bWorking)
{
bWorking = finder.FindNextFile();
<code>
<code> if (finder.IsDots())
continue;</code>
if (finder.IsDirectory())
{
CString str = finder.GetFilePath();
cout << (LPCTSTR) str << endl;
Recurse(str);
}
}
finder.Close();
}
void main()
{
if (!AfxWinInit(GetModuleHandle(NULL), NULL, GetCommandLine(), 0)
cout << "panic!" << endl;
else
Recurse(_T("C:"));
} A dot(.) indicates current directory and a dot dot(..) indicates parent directory. So you need to ignore these two entries.
|
|
|
|
|
Is there any way to do this without MFC and C++ (just plain C & Win32)?
Thanks!
Windows Calculator told me I will die at 28.
|
|
|
|
|
Lord Kixdemp wrote: Is there any way to do this without MFC and C++ (just plain C & Win32)?
Yeah, the source code of CFileFind::IsDots is as follows, now maybe you know how to do it...
BOOL CFileFind::IsDots() const
{
ASSERT(m_hContext != NULL);
ASSERT_VALID(this);
BOOL bResult = FALSE;
if (m_pFoundInfo != NULL && IsDirectory())
{
LPWIN32_FIND_DATA pFindData = (LPWIN32_FIND_DATA) m_pFoundInfo;
if (pFindData->cFileName[0] == '.')
{
if (pFindData->cFileName[1] == '\0' ||
(pFindData->cFileName[1] == '.' &&
pFindData->cFileName[2] == '\0'))
{
bResult = TRUE;
}
}
}
return bResult;
}
|
|
|
|
|
When you're enumerating, skip any dirs named "." and ".."
|
|
|
|
|
Does MS Chart control supports unicode characters?
I want to set Legends for MSChart control in different languages.
But when I am trying any language other than english,the MSChart control showing garbage values insted of provided string......
|
|
|
|
|
Hi,
Im trying to make a word game. But im kinda stuck with how to hussle the letters.
This is the code i got so far:
char letters[] = {'a', 'v', 'e', 'd', 'k', 'u', 'r', 'n', 'e'};
for(char * c = letters; c < &letters[sizeof(letters)]; c++)
{
}
Im trying to search all possible letter combinations starting with a word containing 2 letters and max 9.
After that, i'll compare the words it found with the dictionary so that the user knows if the word exist or not.
But comparing wont be a problem. The problem right now is to search all possible word combinations.
Anyone got some kind of an algorithm for this?
Thanks in advance!
|
|
|
|