| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 12019 人关注过本帖
标题:missing function header (old-style formal list?)新手求助
只看楼主 加入收藏
fuyucao
Rank: 1
等 级:新手上路
帖 子:67
专家分:7
注 册:2011-10-17
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:7 
missing function header (old-style formal list?)新手求助
用API做的一个视频收集,就是插上摄像头以后就能显示,环境是VC6.0
#include <windows.h>
#include <stdio.h>
#include <Dshow.h>
#include <iostream.h>
#include <string.h>
#include <dbt.h>
#include <mmreg.h>
#include <Streams.h>
#include  "strmif.h"
#include  "uuids.h"
#include "stdafx.h"
#include "status.h"
#pragma comment(lib, "strmbasd.lib")
class  ISampleCaptureGraphBuilder;
class  Enumerator;
HWND ghwndApp=0, ghwndStatus=0;
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    PSTR szCmdLine, int iCmdShow)
{
    static TCHAR szAppName[] = TEXT ("HelloWin") ;
    HWND    hwnd ;
    MSG    msg ;
    WNDCLASS     wndclass ;

     wndclass.style          = CS_HREDRAW | CS_VREDRAW ;
     wndclass.lpfnWndProc  = WndProc ;
    wndclass.cbClsExtra      = 0 ;
    wndclass.cbWndExtra      = 0 ;
    wndclass.hInstance      = hInstance ;
    wndclass.hIcon          = LoadIcon (NULL, IDI_APPLICATION) ;
      wndclass.hCursor      = LoadCursor (NULL, IDC_ARROW) ;
     wndclass.hbrBackground    = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
      wndclass.lpszMenuName    = NULL ;
    wndclass.lpszClassName    = szAppName ;

    if (!RegisterClass (&wndclass))
     {
        MessageBox (    NULL, TEXT ("This program requires Windows NT!"),
                          szAppName, MB_ICONERROR) ;
        return 0 ;
     }
    hwnd = CreateWindow( szAppName,    // window class name
            TEXT ("The amcap"),    // window caption
            WS_OVERLAPPEDWINDOW,    // window style
            CW_USEDEFAULT,    // initial x position
            CW_USEDEFAULT,    // initial y position
            CW_USEDEFAULT,    // initial x size
            CW_USEDEFAULT,    // initial y size
            NULL,            // parent window handle
            NULL,            // window menu handle
            hInstance,        // program instance handle
            NULL) ;         // creation parameters
     
    ShowWindow (hwnd, iCmdShow) ;
    UpdateWindow (hwnd) ;
     
    while (GetMessage (&msg, NULL, 0, 0))
     {
        TranslateMessage (&msg) ;
          DispatchMessage (&msg) ;
     }
    return msg.wParam ;
}

LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    HDC            hdc ;
    PAINTSTRUCT ps ;
    RECT        rect ;
      
    switch (message)
     {
    case WM_CREATE:
        return 0 ;

    case     WM_PAINT:
            return 0 ;
        
    case    WM_DESTROY:
        PostQuitMessage (0) ;
        return 0 ;
     }
   return DefWindowProc (hwnd, message, wParam, lParam) ;
}


class CProgress : public CUnknown, public IAMCopyCaptureFileProgress
{
    public:

    CProgress(TCHAR *pName, LPUNKNOWN pUnk, HRESULT *phr) :
    CUnknown(pName, pUnk, phr)
    {
    };
    ~CProgress()
    {
    };

    STDMETHODIMP_(ULONG) AddRef()
    {
        return 1;
    };
    STDMETHODIMP_(ULONG) Release()
    {
        return 0;
    };

    STDMETHODIMP QueryInterface(REFIID iid, void **p)
    {
        CheckPointer(p, E_POINTER);
        if(iid == IID_IAMCopyCaptureFileProgress)
        {
            return GetInterface((IAMCopyCaptureFileProgress *)this, p);
        }
        else
        {
            return E_NOINTERFACE;
        }
    };
    STDMETHODIMP Progress(int i)
    {
        TCHAR tach[80];
        wsprintf(tach, TEXT("Save File Progress: %d%%\0"), i);
        statusUpdateStatus(ghwndStatus, tach);
        return S_OK;
    };
};


  HRESULT InitCaptureGraphBuilder(
  IGraphBuilder **ppGraph,  // Receives the pointer.
  ICaptureGraphBuilder2 **ppBuild  // Receives the pointer.
)
{
    if (!ppGraph || !ppBuild)
    {
        return E_POINTER;
    }
    IGraphBuilder *pGraph = NULL;
    ICaptureGraphBuilder2 *pBuild = NULL;

    // Create the Capture Graph Builder.
    HRESULT hr = CoCreateInstance(CLSID_CaptureGraphBuilder2, NULL,
        CLSCTX_INPROC_SERVER, IID_ICaptureGraphBuilder2, (void**)&pGraph);
    if (SUCCEEDED(hr))
    {
        // Create the Filter Graph Manager.
        hr = CoCreateInstance(CLSID_FilterGraph, 0, CLSCTX_INPROC_SERVER,
            IID_IGraphBuilder, (void**)&pGraph);
        if (SUCCEEDED(hr))
        {
            // Initialize the Capture Graph Builder.
            pBuild->SetFiltergraph(pGraph);

            // Return both interface pointers to the caller.
            *ppBuild = pBuild;
            *ppGraph = pGraph; // The caller must release both interfaces.
            return S_OK;
        }
        else
        {
            pBuild->Release();
        }
    }
    return hr; // Failed
}



//选择一个视频捕捉设
  {
  ICreateDevEnum *pDevEnum = NULL;
   IEnumMoniker *pEnum = NULL;

// Create the System Device Enumerator.

    HRESULT hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL,
    CLSCTX_INPROC_SERVER, IID_ICreateDevEnum,
    reinterpret_cast<void**>(&pDevEnum));

 if (SUCCEEDED(hr))
 {
    // Create an enumerator for the video capture category.
   hr = pDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory,&pEnum,0);
 }
  }

 {// 调用IPropertyBag::Read读取moniker的属性
 HWND hwnd; // Handle to the list box.
IMoniker *pMoniker = NULL;
while (pEnum->Next(1, &pMoniker, NULL) == S_OK)
{
    IPropertyBag *pPropBag;
    hr = pMoniker->BindToStorage(0, 0, IID_IPropertyBag,
        (void**)(&pPropBag));
    if (FAILED(hr))
    {
        pMoniker->Release();
        continue;  // Skip this one, maybe the next one will work.
    }
    // Find the description or friendly name.
    VARIANT varName;
    VariantInit(&varName);
    hr = pPropBag->Read(L"Description", &varName, 0);
    if (FAILED(hr))
    {
        hr = pPropBag->Read(L"FriendlyName", &varName, 0);
    }
    if (SUCCEEDED(hr))
    {
        // Add it to the application's list box.
        USES_CONVERSION;
        (long)SendMessage(hwnd, LB_ADDSTRING, 0,
            (LPARAM)OLE2T(varName.bstrVal));
        VariantClear(&varName);
    }
    pPropBag->Release();
    pMoniker->Release();
}
 }


{// create the capture filter
//调用IMoniker::BindToObject为设备生成filter
IBaseFilter *pCap = NULL;
hr = pMoniker->BindToObject(0, 0, IID_IBaseFilter, (void**)&pCap);
if (SUCCEEDED(hr))
{
    hr = m_pGraph->AddFilter(pCap, L"Capture Filter");
}
}


{
 ICaptureGraphBuilder2 *pBuild; // Capture Graph Builder
// Initialize pBuild (not shown).

IBaseFilter *pCap; // Video capture filter.
// Initialize pCap and add it to the filter graph (not shown).

hr = pBuild->RenderStream(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Video, //预览pin的种类
    pCap, NULL, NULL);
}
   
D:\Program Files\Microsoft Visual Studio\MyProjects\video\video.cpp(173) : error C2447: missing function header (old-style formal list?)
D:\Program Files\Microsoft Visual Studio\MyProjects\video\video.cpp(190) : error C2447: missing function header (old-style formal list?)
D:\Program Files\Microsoft Visual Studio\MyProjects\video\video.cpp(225) : error C2447: missing function header (old-style formal list?)
D:\Program Files\Microsoft Visual Studio\MyProjects\video\video.cpp(236) : error C2447: missing function header (old-style formal list?)
执行 cl.exe 时出错.










搜索更多相关主题的帖子: 摄像头 视频 function comment include 
2011-10-17 17:35
A13433758072
Rank: 11Rank: 11Rank: 11Rank: 11
来 自:广东潮州
等 级:小飞侠
威 望:1
帖 子:1182
专家分:2784
注 册:2010-7-22
收藏
得分:20 
头发长见识短....................

这么明显告诉你 都 不 懂   

D:\ Program Files文件\ Microsoft Visual Studio中\ MyProjects\视频\ video.cpp(173):错误C2447:缺少函数头(旧式正式名单?)
D:\ Program Files文件\ Microsoft Visual Studio中\ MyProjects\视频\ video.cpp(190):错误C2447:(旧式正式名单)缺少函数头
D:\ Program Files文件\ Microsoft Visual Studio中\ MyProjects\视频\ video.cpp(225):错误C2447:缺少函数头(旧式正式名单?)
D:\ Program Files文件\ Microsoft Visual Studio中\ MyProjects\视频\ video.cpp(236):错误C2447:缺少函数头(旧式正式名单?)
执行CL.EXE时出错。

图片附件: 游客没有浏览图片的权限,请 登录注册

图片附件: 游客没有浏览图片的权限,请 登录注册

图片附件: 游客没有浏览图片的权限,请 登录注册

图片附件: 游客没有浏览图片的权限,请 登录注册


连函数头都能 少   你 是以前是学啥语言的??????你 的 主函数呢?

[ 本帖最后由 A13433758072 于 2011-10-17 20:02 编辑 ]

一步一个脚印...............................默默地前进.....
诚邀乐于解答c菜鸟问题,的热心网友加入,  QQ群38490319
2011-10-17 20:00
fuyucao
Rank: 1
等 级:新手上路
帖 子:67
专家分:7
注 册:2011-10-17
收藏
得分:0 
有必要这么损我嘛,毕业了刚从事这一行不行啊
2011-10-18 08:06
fuyucao
Rank: 1
等 级:新手上路
帖 子:67
专家分:7
注 册:2011-10-17
收藏
得分:0 
依然感谢
2011-10-18 08:07
fuyucao
Rank: 1
等 级:新手上路
帖 子:67
专家分:7
注 册:2011-10-17
收藏
得分:0 
回复 2楼 A13433758072
主函数有,我头文件都加了啊,为什么还显示缺少头文件?新手,不要打击我了,谢谢了
2011-10-18 09:56
A13433758072
Rank: 11Rank: 11Rank: 11Rank: 11
来 自:广东潮州
等 级:小飞侠
威 望:1
帖 子:1182
专家分:2784
注 册:2010-7-22
收藏
得分:0 
回复 5楼 fuyucao
我是理性,评论,头发长短…………嘛 语法错误,函数需要,函数声明,函数定义,函数使用!函数的组成部分:函数头,函数体,头都没有,只有身体能不错吗?我问你是学啥的,是,估计你是否用了,别的语言

一步一个脚印...............................默默地前进.....
诚邀乐于解答c菜鸟问题,的热心网友加入,  QQ群38490319
2011-10-18 10:32
fuyucao
Rank: 1
等 级:新手上路
帖 子:67
专家分:7
注 册:2011-10-17
收藏
得分:0 
回复 6楼 A13433758072
学C的啊
2011-10-18 11:59
fuyucao
Rank: 1
等 级:新手上路
帖 子:67
专家分:7
注 册:2011-10-17
收藏
得分:0 
回复 6楼 A13433758072
你知道这个怎么加吗?我还是不知道怎么改
2011-10-18 13:58
快速回复:missing function header (old-style formal list?)新手求助
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.054321 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved