The Machine Perception Toolbox

[Introduction]- [News]- [Download]- [Screenshots]- [Manual (pdf)]- [Forums]- [API Reference]- [Repository ]

 

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

MPBlinkDetectorApp.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <atlbase.h>
#include <streams.h>
#include <initguid.h>
#include "DirectShow/MPDirectShow.h"
#include <cstdio>

Include dependency graph for MPBlinkDetectorApp.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define MAX_LOADSTRING   100
#define WM_GRAPHNOTIFY   WM_APP + 1

Functions

LRESULT CALLBACK About (HWND, UINT, WPARAM, LPARAM)
void HandleEvent ()
BOOL InitInstance (HINSTANCE, int)
void Msg (TCHAR *szFormat,...)
ATOM MyRegisterClass (HINSTANCE hInstance)
int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM)

Variables

BYTE bReturnImmediatelyFromCallback = 0
HINSTANCE hInst
MPDirectShow m_directShow
TCHAR szTitle [MAX_LOADSTRING]
TCHAR szWindowClass [MAX_LOADSTRING]


Define Documentation

#define MAX_LOADSTRING   100
 

Definition at line 12 of file MPBlinkDetectorApp.cpp.

Referenced by WinMain(), and WndProc().

#define WM_GRAPHNOTIFY   WM_APP + 1
 

Definition at line 36 of file MPBlinkDetectorApp.cpp.

Referenced by WndProc().


Function Documentation

LRESULT CALLBACK About HWND  ,
UINT  ,
WPARAM  ,
LPARAM 
 

Definition at line 220 of file MPBlinkDetectorApp.cpp.

Referenced by WndProc().

00221 {
00222         switch (message)
00223         {
00224                 case WM_INITDIALOG:
00225                                 return TRUE;
00226 
00227                 case WM_COMMAND:
00228                         if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
00229                         {
00230                                 EndDialog(hWnd, LOWORD(wParam));
00231                                 return TRUE;
00232                         }
00233                         break;
00234         }
00235     return FALSE;
00236 }

void HandleEvent  ) 
 

Definition at line 168 of file MPBlinkDetectorApp.cpp.

00169 {
00170 
00171 }

BOOL InitInstance HINSTANCE  ,
int 
 

Definition at line 131 of file MPBlinkDetectorApp.cpp.

References BOOL, ds_blinkDetector, hInst, m_directShow, MPDirectShow::RunDirectShow(), MPDirectShow::SetInput(), MPDirectShow::SetProject(), szTitle, and szWindowClass.

00132 {
00133    HWND hWnd;
00134 
00135    hInst = hInstance; // Store instance handle in our global variable
00136 
00137    hWnd = CreateWindow(szWindowClass, szTitle, WS_DLGFRAME|WS_SYSMENU|WS_MINIMIZEBOX,
00138       CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
00139 
00140    if (!hWnd)
00141    {
00142       return FALSE;
00143    }
00144    //RunDirectShow(hWnd);
00145          m_directShow.SetProject(ds_blinkDetector);      
00146          m_directShow.SetInput(320, 240);
00147          m_directShow.RunDirectShow(hWnd);
00148    SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL-1);
00149 
00150    ShowWindow(hWnd, nCmdShow);
00151    UpdateWindow(hWnd);
00152 
00153    return TRUE;
00154 }

Here is the call graph for this function:

void Msg TCHAR *  szFormat,
  ...
 

Definition at line 240 of file MPBlinkDetectorApp.cpp.

00241 {
00242     TCHAR szBuffer[1024];  // Large buffer for very long filenames (like HTTP)
00243 
00244     // Format the input string
00245 
00246         va_list pArgs;
00247     va_start(pArgs, szFormat);
00248     _vstprintf(szBuffer, szFormat, pArgs);
00249     va_end(pArgs);
00250 
00251     // Display a message box with the formatted string
00252     MessageBox(NULL, szBuffer, TEXT("First Grab Sample"), MB_OK);
00253 }

ATOM MyRegisterClass HINSTANCE  hInstance  ) 
 

Definition at line 98 of file MPBlinkDetectorApp.cpp.

00099 {
00100         WNDCLASSEX wcex;
00101 
00102         wcex.cbSize = sizeof(WNDCLASSEX);
00103 
00104         wcex.style                      = CS_HREDRAW | CS_VREDRAW;
00105         wcex.lpfnWndProc        = (WNDPROC)WndProc;
00106         wcex.cbClsExtra         = 0;
00107         wcex.cbWndExtra         = 0;
00108         wcex.hInstance          = hInstance;
00109         wcex.hIcon                      = LoadIcon(hInstance, (LPCTSTR)IDI_MPBLINKDETECTORAPP);
00110         wcex.hCursor            = LoadCursor(NULL, IDC_ARROW);
00111         wcex.hbrBackground      = (HBRUSH)(COLOR_WINDOW+1);
00112         wcex.lpszMenuName       = (LPCSTR)IDC_MPBLINKDETECTORAPP;
00113         wcex.lpszClassName      = szWindowClass;
00114         wcex.hIconSm            = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL);
00115 
00116         return RegisterClassEx(&wcex);
00117 }

int APIENTRY WinMain HINSTANCE  hInstance,
HINSTANCE  hPrevInstance,
LPSTR  lpCmdLine,
int  nCmdShow
 

Definition at line 48 of file MPBlinkDetectorApp.cpp.

References InitInstance(), MAX_LOADSTRING, MyRegisterClass(), szTitle, and szWindowClass.

00052 {
00053         // TODO: Place code here.
00054         MSG msg;
00055         HACCEL hAccelTable;
00056 
00057         // Initialize global strings
00058         LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
00059         LoadString(hInstance, IDC_MPBLINKDETECTORAPP, szWindowClass, MAX_LOADSTRING);
00060         MyRegisterClass(hInstance);
00061 
00062         // Perform application initialization:
00063         if (!InitInstance (hInstance, nCmdShow))
00064         {
00065                 return FALSE;
00066         }
00067 
00068         hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_MPBLINKDETECTORAPP);
00069 
00070         // Main message loop:
00071         while (GetMessage(&msg, NULL, 0, 0))
00072         {
00073                 if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
00074                 {
00075                         TranslateMessage(&msg);
00076                         DispatchMessage(&msg);
00077                 }
00078         }
00079 
00080         return msg.wParam;
00081 }

Here is the call graph for this function:

LRESULT CALLBACK WndProc HWND  ,
UINT  ,
WPARAM  ,
LPARAM 
 

Definition at line 175 of file MPBlinkDetectorApp.cpp.

References About(), hInst, MAX_LOADSTRING, and WM_GRAPHNOTIFY.

00176 {
00177         int wmId, wmEvent;
00178 //      PAINTSTRUCT ps;
00179 //      HDC hdc;
00180         TCHAR szHello[MAX_LOADSTRING];
00181         LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING);
00182 
00183         switch (message)
00184         {
00185                 case WM_GRAPHNOTIFY:
00186                         break;
00187                 case WM_COMMAND:
00188                         wmId    = LOWORD(wParam);
00189                         wmEvent = HIWORD(wParam);
00190                         // Parse the menu selections:
00191                         switch (wmId)
00192                         {
00193                                 case IDM_ABOUT:
00194                                    DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
00195                                    break;
00196                                 case IDM_EXIT:
00197 
00198                                    DestroyWindow(hWnd);
00199                                    break;
00200                                 default:
00201                                    return DefWindowProc(hWnd, message, wParam, lParam);
00202                         }
00203                         break;
00204 
00205 
00206                 case WM_PAINT:
00207                         break;
00208                 case WM_DESTROY:
00209                         PostQuitMessage(0);
00210                         break;
00211                 default:
00212                         return DefWindowProc(hWnd, message, wParam, lParam);
00213    }
00214    return 0;
00215 }

Here is the call graph for this function:


Variable Documentation

BYTE bReturnImmediatelyFromCallback = 0
 

Definition at line 42 of file MPBlinkDetectorApp.cpp.

HINSTANCE hInst
 

Definition at line 14 of file MPBlinkDetectorApp.cpp.

Referenced by InitInstance(), and WndProc().

MPDirectShow m_directShow
 

Definition at line 39 of file MPBlinkDetectorApp.cpp.

Referenced by DeviceList::DoModal(), InitInstance(), SaveVideo::setDirectShow(), and Projectsbox::setDirectShow().

TCHAR szTitle[MAX_LOADSTRING]
 

Definition at line 15 of file MPBlinkDetectorApp.cpp.

Referenced by InitInstance(), and WinMain().

TCHAR szWindowClass[MAX_LOADSTRING]
 

Definition at line 16 of file MPBlinkDetectorApp.cpp.

Referenced by InitInstance(), and WinMain().


Generated on Mon Nov 8 17:08:13 2004 for MPT by  doxygen 1.3.9.1