現在、ウェブカメラからのフィードに複数の画像要素を重ねるアプリケーションを作成しています。ウェブカメラ フィードhttp://www.dreamincode.net/forums/topic/193519-win32-webcam-program/を表示するためにこのガイドに従い、それを directx フレームワーク ( http:// www.youtube.com/user/ChiliTomatoNoodleチュートリアル)、135 行目でリンク エラーが発生しました (具体的には、「エラー LNK2001: 未解決の外部シンボル _capCreateCaptureWindowA@32」)。
私が何を間違えたのか分かりますか?
#include <windows.h>
#include <vfw.h>
#include <wchar.h>
#include "Game.h"
#include "resource.h"
#include "Mouse.h"
LRESULT CALLBACK WindowProc (HWND, UINT, WPARAM, LPARAM);
static KeyboardServer kServ;
static MouseServer mServ;
char szAppName [] = TEXT("Webcam");
HWND camhwnd;
HDC hdc ;
HDC hdcMem;
PAINTSTRUCT ps;
HBITMAP hbm;
RECT rc;
//WinMain -- Main Window
int WINAPI WinMain ( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) {
HWND hwnd;
MSG msg;
WNDCLASS wc;
wc.style = CS_HREDRAW|CS_VREDRAW;
wc.lpfnWndProc = WindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(GetModuleHandle(NULL), IDI_APPLICATION);
wc.hCursor = LoadCursor (NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH) (COLOR_WINDOW+1);
wc.lpszMenuName = NULL;
wc.lpszClassName = szAppName;
RegisterClass (&wc);
hwnd = CreateWindow (szAppName,szAppName,WS_POPUP | WS_VISIBLE,0,0,1920,1080,0,0,hInstance,0);
ShowWindow (hwnd,SW_SHOW);
UpdateWindow (hwnd);
ShowWindow(camhwnd,SW_SHOW);
SendMessage(camhwnd,WM_CAP_DRIVER_CONNECT,0,0);
SendMessage(camhwnd, WM_CAP_SET_SCALE, true , 0);
SendMessage(camhwnd, WM_CAP_SET_PREVIEWRATE, 66, 0);
SendMessage(camhwnd, WM_CAP_SET_PREVIEW, true , 0);
Game theGame( hwnd,kServ,mServ );
while( msg.message != WM_QUIT ) {
if( PeekMessage( &msg,NULL,0,0,PM_REMOVE ) ) {
TranslateMessage( &msg );
DispatchMessage( &msg );
}
else {
theGame.Go();
}
}
return msg.wParam;
}
LRESULT WINAPI MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) {
switch( msg ) {
case WM_DESTROY:
PostQuitMessage( 0 );
break;
// ************ KEYBOARD MESSAGES ************ //
case WM_KEYDOWN:
switch( wParam ) {
case VK_UP:
kServ.OnUpPressed();
break;
case VK_DOWN:
kServ.OnDownPressed();
break;
case VK_LEFT:
kServ.OnLeftPressed();
break;
case VK_RIGHT:
kServ.OnRightPressed();
break;
case VK_SPACE:
kServ.OnSpacePressed();
break;
case VK_RETURN:
kServ.OnEnterPressed();
break;
}
break;
case WM_KEYUP:
switch( wParam ) {
case VK_UP:
kServ.OnUpReleased();
break;
case VK_DOWN:
kServ.OnDownReleased();
break;
case VK_LEFT:
kServ.OnLeftReleased();
break;
case VK_RIGHT:
kServ.OnRightReleased();
break;
case VK_SPACE:
kServ.OnSpaceReleased();
break;
case VK_RETURN:
kServ.OnEnterReleased();
break;
}
break;
// ************ END KEYBOARD MESSAGES ************ //
}
return DefWindowProc( hWnd, msg, wParam, lParam );
}
//Main Window Procedure WindowProc
LRESULT CALLBACK WindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
HINSTANCE hInstance = GetModuleHandle(NULL);
switch (message) {
case WM_CREATE: {
camhwnd = capCreateCaptureWindow ("camera window", WS_CHILD , 0, 0, 1920, 1080, hwnd, 0);
SendMessage(camhwnd,WM_CAP_DRIVER_CONNECT,0,0);
SendMessage(camhwnd,WM_CAP_DLG_VIDEOSOURCE,0,0);
break;
}
case WM_DESTROY: {
SendMessage(camhwnd, WM_CAP_DRIVER_DISCONNECT, 0, 0);
PostQuitMessage(0);
break;
}
default:
return DefWindowProc(hwnd, message, wParam, lParam);
}
return 0;
}