Initial commit: ROW Client source code
Game client codebase including: - CharacterActionControl: Character and creature management - GlobalScript: Network, items, skills, quests, utilities - RYLClient: Main client application with GUI and event handlers - Engine: 3D rendering engine (RYLGL) - MemoryManager: Custom memory allocation - Library: Third-party dependencies (DirectX, boost, etc.) - Tools: Development utilities 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
3946
Library/dxx8/samples/Multimedia/DirectShow/Capture/AMCap/amcap.cpp
Normal file
3946
Library/dxx8/samples/Multimedia/DirectShow/Capture/AMCap/amcap.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,134 @@
|
||||
# Microsoft Developer Studio Project File - Name="amcap" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=amcap - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "amcap.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "amcap.mak" CFG="amcap - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "amcap - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "amcap - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "amcap - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x0400 /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /i "..\..\BaseClasses" /d "NDEBUG" /d "WIN32"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 ..\..\baseclasses\release\strmbase.lib quartz.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib ole32.lib winmm.lib msacm32.lib olepro32.lib oleaut32.lib advapi32.lib uuid.lib strmiids.lib /nologo /stack:0x200000,0x200000 /subsystem:windows /pdb:none /machine:I386 /nodefaultlib:"libc libcmt" /libpath:"..\..\..\..\..\lib"
|
||||
# SUBTRACT LINK32 /nodefaultlib
|
||||
|
||||
!ELSEIF "$(CFG)" == "amcap - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MTd /W3 /GX /Zi /Od /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x0400 /D "DEBUG" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /i "..\..\BaseClasses" /d "_DEBUG" /d "WIN32"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 ..\..\baseclasses\debug\strmbasd.lib quartz.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib ole32.lib winmm.lib msacm32.lib olepro32.lib oleaut32.lib advapi32.lib uuid.lib strmiids.lib /nologo /stack:0x200000,0x200000 /subsystem:windows /pdb:none /debug /machine:I386 /nodefaultlib:"libcd libcmtd" /libpath:"..\..\..\..\..\lib"
|
||||
# SUBTRACT LINK32 /nodefaultlib
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "amcap - Win32 Release"
|
||||
# Name "amcap - Win32 Debug"
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter ".h"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\amcap.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\crossbar.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\status.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter ".cpp, .c"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\amcap.cpp
|
||||
# ADD CPP /Yc"streams.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\crossbar.cpp
|
||||
# ADD CPP /Yu"streams.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\status.cpp
|
||||
# ADD CPP /Yu"streams.h"
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\amcap.rc
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "amcap"=.\amcap.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
143
Library/dxx8/samples/Multimedia/DirectShow/Capture/AMCap/amcap.h
Normal file
143
Library/dxx8/samples/Multimedia/DirectShow/Capture/AMCap/amcap.h
Normal file
@@ -0,0 +1,143 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// File: AMCap.h
|
||||
//
|
||||
// Desc: DirectShow sample code - audio/video capture.
|
||||
//
|
||||
// Copyright (c) 1993-2001 Microsoft Corporation. All rights reserved.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#define ID_APP 1000
|
||||
|
||||
/* Menu Items */
|
||||
#define MENU_EXIT 4
|
||||
#define MENU_SET_CAP_FILE 5
|
||||
#define MENU_ALLOC_CAP_FILE 6
|
||||
#define MENU_START_CAP 7
|
||||
#define MENU_STOP_CAP 8
|
||||
#define MENU_CAP_CC 9
|
||||
#define MENU_CAP_AUDIO 12
|
||||
#define MENU_AUDIOFORMAT 13
|
||||
#define MENU_FRAMERATE 14
|
||||
#define MENU_PREVIEW 15
|
||||
#define MENU_VDEVICE0 16
|
||||
#define MENU_VDEVICE1 17
|
||||
#define MENU_VDEVICE2 18
|
||||
#define MENU_VDEVICE3 19
|
||||
#define MENU_VDEVICE4 20
|
||||
#define MENU_VDEVICE5 21
|
||||
#define MENU_VDEVICE6 22
|
||||
#define MENU_VDEVICE7 23
|
||||
#define MENU_VDEVICE8 24
|
||||
#define MENU_VDEVICE9 25
|
||||
#define MENU_ADEVICE0 26
|
||||
#define MENU_ADEVICE1 27
|
||||
#define MENU_ADEVICE2 28
|
||||
#define MENU_ADEVICE3 29
|
||||
#define MENU_ADEVICE4 30
|
||||
#define MENU_ADEVICE5 31
|
||||
#define MENU_ADEVICE6 32
|
||||
#define MENU_ADEVICE7 33
|
||||
#define MENU_ADEVICE8 34
|
||||
#define MENU_ADEVICE9 35
|
||||
#define MENU_ABOUT 36
|
||||
#define MENU_SAVE_CAP_FILE 37
|
||||
#define MENU_NOMASTER 38
|
||||
#define MENU_AUDIOMASTER 39
|
||||
#define MENU_VIDEOMASTER 40
|
||||
#define MENU_TIMELIMIT 41
|
||||
#define MENU_DIALOG0 42
|
||||
#define MENU_DIALOG1 43
|
||||
#define MENU_DIALOG2 44
|
||||
#define MENU_DIALOG3 45
|
||||
#define MENU_DIALOG4 46
|
||||
#define MENU_DIALOG5 47
|
||||
#define MENU_DIALOG6 48
|
||||
#define MENU_DIALOG7 49
|
||||
#define MENU_DIALOG8 50
|
||||
#define MENU_DIALOG9 51
|
||||
#define MENU_DIALOGA 52
|
||||
#define MENU_DIALOGB 53
|
||||
#define MENU_DIALOGC 54
|
||||
#define MENU_DIALOGD 55
|
||||
#define MENU_DIALOGE 56
|
||||
#define MENU_DIALOGF 57 // !!! more?
|
||||
|
||||
// Dialogs
|
||||
#define IDD_ABOUT 600
|
||||
#define IDD_AllocCapFileSpace 601
|
||||
#define IDD_FrameRateDialog 602
|
||||
#define IDD_PressAKeyDialog 603
|
||||
#define IDD_TimeLimitDialog 604
|
||||
|
||||
// defines for dialogs
|
||||
#define IDD_SetCapFileFree 400
|
||||
#define IDD_SetCapFileSize 401
|
||||
#define IDC_FRAMERATE 402
|
||||
#define IDC_CAPFILENAME 403
|
||||
#define IDC_TIMELIMIT 404
|
||||
#define IDC_USETIMELIMIT 405
|
||||
#define IDC_USEFRAMERATE 406
|
||||
|
||||
// window messages
|
||||
#define WM_FGNOTIFY WM_USER+1
|
||||
|
||||
// device notification definitions
|
||||
#if (WINVER < 0x0500)
|
||||
|
||||
#define DBT_DEVTYP_DEVICEINTERFACE 0x00000005 // device interface class
|
||||
#define DEVICE_NOTIFY_WINDOW_HANDLE 0x00000000
|
||||
typedef PVOID HDEVNOTIFY;
|
||||
|
||||
#endif
|
||||
|
||||
extern "C"
|
||||
{
|
||||
typedef BOOL (/* WINUSERAPI */ WINAPI *PUnregisterDeviceNotification)(
|
||||
IN HDEVNOTIFY Handle
|
||||
);
|
||||
|
||||
typedef HDEVNOTIFY (/* WINUSERAPI */ WINAPI *PRegisterDeviceNotificationA)(
|
||||
IN HANDLE hRecipient,
|
||||
IN LPVOID NotificationFilter,
|
||||
IN DWORD Flags
|
||||
);
|
||||
|
||||
typedef HDEVNOTIFY (/* WINUSERAPI */ WINAPI *PRegisterDeviceNotificationW)(
|
||||
IN HANDLE hRecipient,
|
||||
IN LPVOID NotificationFilter,
|
||||
IN DWORD Flags
|
||||
);
|
||||
}
|
||||
#ifdef UNICODE
|
||||
#define PRegisterDeviceNotification PRegisterDeviceNotificationW
|
||||
#else
|
||||
#define PRegisterDeviceNotification PRegisterDeviceNotificationA
|
||||
#endif // !UNICODE
|
||||
|
||||
#if (WINVER < 0x0500)
|
||||
|
||||
typedef struct _DEV_BROADCAST_DEVICEINTERFACE_A {
|
||||
DWORD dbcc_size;
|
||||
DWORD dbcc_devicetype;
|
||||
DWORD dbcc_reserved;
|
||||
GUID dbcc_classguid;
|
||||
char dbcc_name[1];
|
||||
} DEV_BROADCAST_DEVICEINTERFACE_A, *PDEV_BROADCAST_DEVICEINTERFACE_A;
|
||||
|
||||
typedef struct _DEV_BROADCAST_DEVICEINTERFACE_W {
|
||||
DWORD dbcc_size;
|
||||
DWORD dbcc_devicetype;
|
||||
DWORD dbcc_reserved;
|
||||
GUID dbcc_classguid;
|
||||
wchar_t dbcc_name[1];
|
||||
} DEV_BROADCAST_DEVICEINTERFACE_W, *PDEV_BROADCAST_DEVICEINTERFACE_W;
|
||||
|
||||
#ifdef UNICODE
|
||||
typedef DEV_BROADCAST_DEVICEINTERFACE_W DEV_BROADCAST_DEVICEINTERFACE;
|
||||
typedef PDEV_BROADCAST_DEVICEINTERFACE_W PDEV_BROADCAST_DEVICEINTERFACE;
|
||||
#else
|
||||
typedef DEV_BROADCAST_DEVICEINTERFACE_A DEV_BROADCAST_DEVICEINTERFACE;
|
||||
typedef PDEV_BROADCAST_DEVICEINTERFACE_A PDEV_BROADCAST_DEVICEINTERFACE;
|
||||
#endif // UNICODE
|
||||
#endif // WINVER
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,276 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on amcap.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=amcap - Win32 Debug
|
||||
!MESSAGE No configuration specified. Defaulting to amcap - Win32 Debug.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "amcap - Win32 Release" && "$(CFG)" != "amcap - Win32 Debug"
|
||||
!MESSAGE Invalid configuration "$(CFG)" specified.
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "amcap.mak" CFG="amcap - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "amcap - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "amcap - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
!ERROR An invalid configuration is specified.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(OS)" == "Windows_NT"
|
||||
NULL=
|
||||
!ELSE
|
||||
NULL=nul
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" == "amcap - Win32 Release"
|
||||
|
||||
OUTDIR=.\Release
|
||||
INTDIR=.\Release
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Release
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\amcap.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\amcap.obj"
|
||||
-@erase "$(INTDIR)\amcap.pch"
|
||||
-@erase "$(INTDIR)\amcap.res"
|
||||
-@erase "$(INTDIR)\crossbar.obj"
|
||||
-@erase "$(INTDIR)\status.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\amcap.exe"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x0400 /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
.c{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
MTL=midl.exe
|
||||
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
RSC=rc.exe
|
||||
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\amcap.res" /i "..\..\BaseClasses" /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\amcap.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=quartz.lib msvcrt.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib ole32.lib winmm.lib msacm32.lib olepro32.lib oleaut32.lib advapi32.lib uuid.lib strmiids.lib ..\..\baseclasses\release\strmbase.lib /nologo /subsystem:windows /pdb:none /machine:I386 /nodefaultlib /out:"$(OUTDIR)\amcap.exe" /libpath:"..\..\..\..\..\lib" /stack:0x200000,0x200000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\amcap.obj" \
|
||||
"$(INTDIR)\crossbar.obj" \
|
||||
"$(INTDIR)\status.obj" \
|
||||
"$(INTDIR)\amcap.res"
|
||||
|
||||
"$(OUTDIR)\amcap.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "amcap - Win32 Debug"
|
||||
|
||||
OUTDIR=.\Debug
|
||||
INTDIR=.\Debug
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Debug
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\amcap.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\amcap.obj"
|
||||
-@erase "$(INTDIR)\amcap.pch"
|
||||
-@erase "$(INTDIR)\amcap.res"
|
||||
-@erase "$(INTDIR)\crossbar.obj"
|
||||
-@erase "$(INTDIR)\status.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\amcap.exe"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MLd /W3 /GX /Zi /Od /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x0400 /D "DEBUG" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
.c{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
MTL=midl.exe
|
||||
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
RSC=rc.exe
|
||||
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\amcap.res" /i "..\..\BaseClasses" /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\amcap.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=quartz.lib msvcrtd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib ole32.lib winmm.lib msacm32.lib olepro32.lib oleaut32.lib advapi32.lib uuid.lib strmiids.lib ..\..\baseclasses\debug\strmbasd.lib /nologo /subsystem:windows /pdb:none /debug /machine:I386 /nodefaultlib /out:"$(OUTDIR)\amcap.exe" /libpath:"..\..\..\..\..\lib" /stack:0x200000,0x200000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\amcap.obj" \
|
||||
"$(INTDIR)\crossbar.obj" \
|
||||
"$(INTDIR)\status.obj" \
|
||||
"$(INTDIR)\amcap.res"
|
||||
|
||||
"$(OUTDIR)\amcap.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(NO_EXTERNAL_DEPS)" != "1"
|
||||
!IF EXISTS("amcap.dep")
|
||||
!INCLUDE "amcap.dep"
|
||||
!ELSE
|
||||
!MESSAGE Warning: cannot find "amcap.dep"
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "amcap - Win32 Release" || "$(CFG)" == "amcap - Win32 Debug"
|
||||
SOURCE=.\amcap.cpp
|
||||
|
||||
!IF "$(CFG)" == "amcap - Win32 Release"
|
||||
|
||||
CPP_SWITCHES=/nologo /ML /W3 /GX /O2 /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x0400 /Fp"$(INTDIR)\amcap.pch" /Yc"streams.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
"$(INTDIR)\amcap.obj" "$(INTDIR)\amcap.pch" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) @<<
|
||||
$(CPP_SWITCHES) $(SOURCE)
|
||||
<<
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "amcap - Win32 Debug"
|
||||
|
||||
CPP_SWITCHES=/nologo /MLd /W3 /GX /Zi /Od /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x0400 /D "DEBUG" /Fp"$(INTDIR)\amcap.pch" /Yc"streams.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
"$(INTDIR)\amcap.obj" "$(INTDIR)\amcap.pch" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) @<<
|
||||
$(CPP_SWITCHES) $(SOURCE)
|
||||
<<
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=.\crossbar.cpp
|
||||
|
||||
!IF "$(CFG)" == "amcap - Win32 Release"
|
||||
|
||||
CPP_SWITCHES=/nologo /ML /W3 /GX /O2 /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x0400 /Fp"$(INTDIR)\amcap.pch" /Yu"streams.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
"$(INTDIR)\crossbar.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\amcap.pch"
|
||||
$(CPP) @<<
|
||||
$(CPP_SWITCHES) $(SOURCE)
|
||||
<<
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "amcap - Win32 Debug"
|
||||
|
||||
CPP_SWITCHES=/nologo /MLd /W3 /GX /Zi /Od /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x0400 /D "DEBUG" /Fp"$(INTDIR)\amcap.pch" /Yu"streams.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
"$(INTDIR)\crossbar.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\amcap.pch"
|
||||
$(CPP) @<<
|
||||
$(CPP_SWITCHES) $(SOURCE)
|
||||
<<
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=.\status.cpp
|
||||
|
||||
!IF "$(CFG)" == "amcap - Win32 Release"
|
||||
|
||||
CPP_SWITCHES=/nologo /ML /W3 /GX /O2 /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x0400 /Fp"$(INTDIR)\amcap.pch" /Yu"streams.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
"$(INTDIR)\status.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\amcap.pch"
|
||||
$(CPP) @<<
|
||||
$(CPP_SWITCHES) $(SOURCE)
|
||||
<<
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "amcap - Win32 Debug"
|
||||
|
||||
CPP_SWITCHES=/nologo /MLd /W3 /GX /Zi /Od /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x0400 /D "DEBUG" /Fp"$(INTDIR)\amcap.pch" /Yu"streams.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
"$(INTDIR)\status.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\amcap.pch"
|
||||
$(CPP) @<<
|
||||
$(CPP_SWITCHES) $(SOURCE)
|
||||
<<
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=.\amcap.rc
|
||||
|
||||
"$(INTDIR)\amcap.res" : $(SOURCE) "$(INTDIR)"
|
||||
$(RSC) $(RSC_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
|
||||
* KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
|
||||
* PURPOSE.
|
||||
*
|
||||
* Copyright (c) 1993-2001 Microsoft Corporation. All Rights Reserved.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <windows.h>
|
||||
#include <activex.ver>
|
||||
#include "amcap.h"
|
||||
|
||||
AMCapIcon ICON "amcap.ico"
|
||||
|
||||
ID_APP menu
|
||||
begin
|
||||
POPUP "&File"
|
||||
begin
|
||||
MENUITEM "Set Capture File..." , MENU_SET_CAP_FILE
|
||||
MENUITEM "Allocate File Space..." , MENU_ALLOC_CAP_FILE
|
||||
MENUITEM "Save Captured Video As..." , MENU_SAVE_CAP_FILE
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "E&xit" , MENU_EXIT
|
||||
end
|
||||
POPUP "&Devices"
|
||||
begin
|
||||
MENUITEM SEPARATOR
|
||||
end
|
||||
POPUP "&Options"
|
||||
begin
|
||||
MENUITEM "Preview" , MENU_PREVIEW
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Audio Format..." , MENU_AUDIOFORMAT
|
||||
MENUITEM SEPARATOR
|
||||
/* VIDEO dialogs are made dynamically */
|
||||
end
|
||||
POPUP "&Capture"
|
||||
begin
|
||||
MENUITEM "Start Capture" , MENU_START_CAP
|
||||
MENUITEM "Stop Capture" , MENU_STOP_CAP
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Capture Audio" , MENU_CAP_AUDIO
|
||||
MENUITEM "Closed Captioning" , MENU_CAP_CC
|
||||
POPUP "Master Stream"
|
||||
BEGIN
|
||||
MENUITEM "None" MENU_NOMASTER
|
||||
MENUITEM "Audio" MENU_AUDIOMASTER
|
||||
MENUITEM "Video" MENU_VIDEOMASTER
|
||||
END
|
||||
MENUITEM "Set Frame Rate..." , MENU_FRAMERATE
|
||||
MENUITEM "Set Time Limit..." , MENU_TIMELIMIT
|
||||
end
|
||||
POPUP "&Help"
|
||||
begin
|
||||
MENUITEM "&About..." , MENU_ABOUT
|
||||
end
|
||||
end
|
||||
|
||||
//
|
||||
// Dialogs
|
||||
//
|
||||
|
||||
// About Dialog
|
||||
IDD_ABOUT DIALOG DISCARDABLE 10, 20, 215, 78
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "About AMCap..."
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
CTEXT "AMCAP - DirectShow Video Capture Sample",-1,23,
|
||||
8,170,8,NOT WS_GROUP
|
||||
CTEXT "Version 8.10",-1,41,23,134,8,NOT WS_GROUP
|
||||
CTEXT "Copyright <20> 1997-2001 Microsoft Corp.",-1,23,
|
||||
38,170,8,NOT WS_GROUP
|
||||
DEFPUSHBUTTON "OK",IDOK,91,53,32,14,WS_GROUP
|
||||
ICON "AMCAPICON"-1,7,17,21,20
|
||||
END
|
||||
|
||||
IDD_AllocCapFileSpace DIALOG 6, 18, 160, 105
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | DS_3DLOOK
|
||||
CAPTION "Set File Size"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
LTEXT "Enter the amount of disk space to set ", -1, 5, 9, 130,
|
||||
8
|
||||
LTEXT "aside for the capture file. Existing video", -1, 5, 19,
|
||||
135, 8
|
||||
LTEXT "data in the file will be lost.", -1, 5, 29, 93, 8
|
||||
LTEXT "Free disk space:", -1, 5, 50, 59, 8
|
||||
LTEXT " ", IDD_SetCapFileFree, 73, 50, 20, 8
|
||||
LTEXT "MBytes", -1, 96, 50, 27, 8
|
||||
LTEXT "Capture file size:", -1, 5, 64, 60, 8
|
||||
EDITTEXT IDD_SetCapFileSize, 65, 64, 28, 12, ES_AUTOHSCROLL
|
||||
LTEXT "MBytes", -1, 96, 64, 27, 8
|
||||
PUSHBUTTON "OK", IDOK, 38, 84, 40, 14
|
||||
PUSHBUTTON "Cancel", IDCANCEL, 88, 84, 40, 14
|
||||
END
|
||||
|
||||
|
||||
IDD_PressAKeyDialog DIALOG LOADONCALL MOVEABLE DISCARDABLE 12, 29, 121, 60
|
||||
CAPTION "Ready to Capture"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
STYLE WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME | WS_POPUP
|
||||
BEGIN
|
||||
CONTROL "Select OK to start capture of video sequence to:",
|
||||
-1, "static", SS_LEFT | WS_CHILD, 5, 4, 100, 16
|
||||
CONTROL "", IDC_CAPFILENAME, "static", SS_LEFT | WS_CHILD, 5, 23, 100, 16
|
||||
CONTROL "OK", IDOK, "button", BS_DEFPUSHBUTTON | WS_TABSTOP | WS_CHILD,
|
||||
18, 42, 32, 14
|
||||
CONTROL "Cancel", IDCANCEL, "button", BS_PUSHBUTTON | WS_TABSTOP | WS_CHILD,
|
||||
69, 42, 32, 14
|
||||
END
|
||||
|
||||
|
||||
IDD_FrameRateDialog DIALOG LOADONCALL MOVEABLE DISCARDABLE 12, 29, 121, 50
|
||||
CAPTION "Choose Frame Rate"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
STYLE WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME | WS_POPUP
|
||||
BEGIN
|
||||
CONTROL "", IDC_USEFRAMERATE "button", BS_AUTOCHECKBOX | WS_TABSTOP, 3, 4, 9, 8
|
||||
CONTROL "Use Frame Rate", -1, "static", SS_LEFT | WS_CHILD, 13, 4, 73, 8
|
||||
CONTROL "&Frame Rate:", -1, "static", SS_LEFT | WS_CHILD, 3, 18, 43, 8
|
||||
CONTROL "", IDC_FRAMERATE, "edit", WS_BORDER | WS_TABSTOP | WS_CHILD, 44, 16, 44, 12
|
||||
CONTROL "f/sec", -1, "static", SS_LEFT | WS_CHILD, 93, 18, 18, 8
|
||||
CONTROL "OK", IDOK, "button", BS_DEFPUSHBUTTON | WS_TABSTOP | WS_CHILD, 18, 33, 32, 14
|
||||
CONTROL "Cancel", IDCANCEL, "button", BS_PUSHBUTTON | WS_TABSTOP | WS_CHILD, 69, 33, 32, 14
|
||||
END
|
||||
|
||||
|
||||
IDD_TimeLimitDialog DIALOG LOADONCALL MOVEABLE DISCARDABLE 12, 29, 121, 50
|
||||
CAPTION "Capture Time Limit"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
STYLE WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME | WS_POPUP
|
||||
BEGIN
|
||||
CONTROL "", IDC_USETIMELIMIT "button", BS_AUTOCHECKBOX | WS_TABSTOP, 3, 4, 9, 8
|
||||
CONTROL "Use Time Limit", -1, "static", SS_LEFT | WS_CHILD, 13, 4, 73, 8
|
||||
CONTROL "&Time Limit:", -1, "static", SS_LEFT | WS_CHILD, 3, 18, 43, 8
|
||||
CONTROL "", IDC_TIMELIMIT, "edit", WS_BORDER | WS_TABSTOP | WS_CHILD, 44, 16, 44, 12
|
||||
CONTROL "sec", -1, "static", SS_LEFT | WS_CHILD, 93, 18, 18, 8
|
||||
CONTROL "OK", IDOK, "button", BS_DEFPUSHBUTTON | WS_TABSTOP | WS_CHILD, 18, 33, 32, 14
|
||||
CONTROL "Cancel", IDCANCEL, "button", BS_PUSHBUTTON | WS_TABSTOP | WS_CHILD, 69, 33, 32, 14
|
||||
END
|
||||
|
||||
//
|
||||
// Version Info
|
||||
//
|
||||
#define VERSION_RES_BIN_NAME "Amcap.exe\0"
|
||||
#define VERSION_RES_BIN_DESCRIPTION "Capture Application (Sample)\0"
|
||||
#define VERSION_RES_ACTIVEX "\0"
|
||||
#define VERSION_RES_TYPE VFT_APP
|
||||
|
||||
#define AMOVIE_SELF_REGISTER
|
||||
|
||||
#include <activex.rcv>
|
||||
|
||||
@@ -0,0 +1,593 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// File: Crossbar.cpp
|
||||
//
|
||||
// Desc: A class for controlling video crossbars.
|
||||
//
|
||||
// This class creates a single object which encapsulates all connected
|
||||
// crossbars, enumerates all unique inputs which can be reached from
|
||||
// a given starting pin, and automatically routes audio when a video
|
||||
// source is selected.
|
||||
//
|
||||
// The class supports an arbitrarily complex graph of crossbars,
|
||||
// which can be cascaded and disjoint, that is not all inputs need
|
||||
// to traverse the same set of crossbars.
|
||||
//
|
||||
// Given a starting input pin (typically the analog video input to
|
||||
// the capture filter), the class recursively traces upstream
|
||||
// searching for all viable inputs. An input is considered viable if
|
||||
// it is a video pin and is either:
|
||||
//
|
||||
// - unconnected
|
||||
// - connects to a filter which does not support IAMCrossbar
|
||||
//
|
||||
// Methods:
|
||||
//
|
||||
// CCrossbar (IPin *pPin);
|
||||
// ~CCrossbar();
|
||||
//
|
||||
// HRESULT GetInputCount (LONG *pCount);
|
||||
// HRESULT GetInputType (LONG Index, LONG * PhysicalType);
|
||||
// HRESULT GetInputName (LONG Index, TCHAR * pName, LONG NameSize);
|
||||
// HRESULT SetInputIndex (LONG Index);
|
||||
// HRESULT GetInputIndex (LONG *Index);
|
||||
//
|
||||
// Copyright (c) 1993-2001 Microsoft Corporation. All rights reserved.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include <streams.h>
|
||||
#include "crossbar.h"
|
||||
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Name: CCrossbar::CCrossbar()
|
||||
// Desc: Constructor for the CCrossbar class
|
||||
//------------------------------------------------------------------------------
|
||||
CCrossbar::CCrossbar(
|
||||
IPin *pStartingInputPin
|
||||
)
|
||||
: m_pStartingPin (pStartingInputPin)
|
||||
, m_CurrentRoutingIndex (0)
|
||||
, m_RoutingList (NULL)
|
||||
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
DbgLog((LOG_TRACE,3,TEXT("CCrossbar Constructor")));
|
||||
|
||||
ASSERT (pStartingInputPin != NULL);
|
||||
|
||||
// Init everything to zero
|
||||
ZeroMemory (&m_RoutingRoot, sizeof (m_RoutingRoot));
|
||||
|
||||
m_RoutingList = new CRoutingList (TEXT("RoutingList"), 5);
|
||||
if (m_RoutingList) {
|
||||
|
||||
hr = BuildRoutingList(
|
||||
pStartingInputPin,
|
||||
&m_RoutingRoot,
|
||||
0 /* Depth */);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Name: CCrossbar::CCrossbar()
|
||||
// Desc: Destructor for the CCrossbar class
|
||||
//------------------------------------------------------------------------------
|
||||
CCrossbar::~CCrossbar()
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
DbgLog((LOG_TRACE,3,TEXT("CCrossbar Destructor")));
|
||||
|
||||
hr = DestroyRoutingList ();
|
||||
|
||||
delete m_RoutingList;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// This function is called recursively, every time a new crossbar is
|
||||
// entered as we search upstream.
|
||||
//
|
||||
// Return values:
|
||||
//
|
||||
// S_OK - Returned on final exit after recursive search if at least
|
||||
// one routing is possible
|
||||
// S_FALSE - Normal return indicating we've reached the end of a
|
||||
// recursive search, so save the current path
|
||||
// E_FAIL - Unable to route anything
|
||||
|
||||
HRESULT
|
||||
CCrossbar::BuildRoutingList (
|
||||
IPin *pStartingInputPin,
|
||||
CRouting *pRouting,
|
||||
int Depth
|
||||
)
|
||||
{
|
||||
HRESULT hr;
|
||||
LONG InputIndexRelated;
|
||||
LONG InputPhysicalType;
|
||||
LONG OutputIndexRelated;
|
||||
LONG OutputPhysicalType;
|
||||
IPin *pPin;
|
||||
IPin *pStartingOutputPin;
|
||||
CRouting RoutingNext;
|
||||
|
||||
LONG Inputs;
|
||||
LONG Outputs;
|
||||
LONG InputIndex;
|
||||
LONG OutputIndex;
|
||||
PIN_INFO pinInfo;
|
||||
IAMCrossbar *pXbar;
|
||||
|
||||
ASSERT (pStartingInputPin != NULL);
|
||||
ASSERT (pRouting != NULL);
|
||||
|
||||
//
|
||||
// If the pin isn't connected, then it's a terminal pin
|
||||
//
|
||||
|
||||
hr = pStartingInputPin->ConnectedTo (&pStartingOutputPin);
|
||||
if (hr != S_OK) {
|
||||
return (Depth == 0) ? E_FAIL : S_FALSE;
|
||||
}
|
||||
|
||||
//
|
||||
// It is connected, so now find out if the filter supports
|
||||
// IAMCrossbar
|
||||
//
|
||||
|
||||
if (S_OK == pStartingOutputPin->QueryPinInfo(&pinInfo)) {
|
||||
ASSERT (pinInfo.dir == PINDIR_OUTPUT);
|
||||
|
||||
hr = pinInfo.pFilter->QueryInterface(IID_IAMCrossbar,
|
||||
(void **)&pXbar);
|
||||
if (hr == S_OK) {
|
||||
EXECUTE_ASSERT (S_OK == pXbar->get_PinCounts(&Outputs, &Inputs));
|
||||
|
||||
EXECUTE_ASSERT (S_OK == GetCrossbarIndexFromIPin (
|
||||
pXbar,
|
||||
&OutputIndex,
|
||||
FALSE, // Input ?
|
||||
pStartingOutputPin));
|
||||
|
||||
EXECUTE_ASSERT (S_OK == pXbar->get_CrossbarPinInfo(
|
||||
FALSE, // Input ?
|
||||
OutputIndex,
|
||||
&OutputIndexRelated,
|
||||
&OutputPhysicalType));
|
||||
|
||||
//
|
||||
// for all input pins
|
||||
//
|
||||
|
||||
for (InputIndex = 0; InputIndex < Inputs; InputIndex++) {
|
||||
EXECUTE_ASSERT (S_OK == pXbar->get_CrossbarPinInfo(
|
||||
TRUE, // Input?
|
||||
InputIndex,
|
||||
&InputIndexRelated,
|
||||
&InputPhysicalType));
|
||||
|
||||
//
|
||||
// Is the pin a video pin?
|
||||
//
|
||||
if (InputPhysicalType < PhysConn_Audio_Tuner) {
|
||||
//
|
||||
// Can we route it?
|
||||
//
|
||||
if (S_OK == pXbar->CanRoute(OutputIndex, InputIndex)) {
|
||||
|
||||
EXECUTE_ASSERT (S_OK == GetCrossbarIPinAtIndex (
|
||||
pXbar,
|
||||
InputIndex,
|
||||
TRUE, // Input
|
||||
&pPin));
|
||||
|
||||
//
|
||||
// We've found a route through this crossbar
|
||||
// so save our state before recusively searching
|
||||
// again.
|
||||
//
|
||||
ZeroMemory (&RoutingNext, sizeof (RoutingNext));
|
||||
|
||||
// doubly linked list
|
||||
RoutingNext.pRightRouting = pRouting;
|
||||
pRouting->pLeftRouting = &RoutingNext;
|
||||
|
||||
pRouting->pXbar = pXbar;
|
||||
pRouting->VideoInputIndex = InputIndex;
|
||||
pRouting->VideoOutputIndex = OutputIndex;
|
||||
pRouting->AudioInputIndex = InputIndexRelated;
|
||||
pRouting->AudioOutputIndex = OutputIndexRelated;
|
||||
pRouting->InputPhysicalType = InputPhysicalType;
|
||||
pRouting->OutputPhysicalType = OutputPhysicalType;
|
||||
pRouting->Depth = Depth;
|
||||
|
||||
hr = BuildRoutingList (
|
||||
pPin,
|
||||
&RoutingNext,
|
||||
Depth + 1);
|
||||
|
||||
if (hr == S_OK) {
|
||||
; // Nothing to do?
|
||||
}
|
||||
else if (hr == S_FALSE) {
|
||||
pRouting->pLeftRouting = NULL;
|
||||
SaveRouting (pRouting);
|
||||
}
|
||||
else if (hr == E_FAIL) {
|
||||
; // Nothing to do?
|
||||
}
|
||||
} // if we can route
|
||||
} // if its a video pin
|
||||
} // for all input pins
|
||||
pXbar->Release();
|
||||
}
|
||||
else {
|
||||
// The filter doesn't support IAMCrossbar, so this
|
||||
// is a terminal pin
|
||||
pinInfo.pFilter->Release();
|
||||
pStartingOutputPin->Release ();
|
||||
|
||||
return (Depth == 0) ? E_FAIL : S_FALSE;
|
||||
}
|
||||
|
||||
pinInfo.pFilter->Release();
|
||||
}
|
||||
|
||||
pStartingOutputPin->Release ();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//
|
||||
// Make a copy of the current routing, and AddRef the IAMCrossbar
|
||||
// interfaces.
|
||||
//
|
||||
|
||||
HRESULT
|
||||
CCrossbar::SaveRouting (CRouting *pRoutingNew)
|
||||
{
|
||||
int j;
|
||||
int Depth= pRoutingNew->Depth + 1;
|
||||
CRouting *pr;
|
||||
CRouting *pCurrent = pRoutingNew;
|
||||
|
||||
DbgLog((LOG_TRACE,3,TEXT("CCrossbar::SaveRouting, Depth=%d, NumberOfRoutings=%d"),
|
||||
Depth, m_RoutingList->GetCount() + 1));
|
||||
|
||||
pr = new CRouting[Depth];
|
||||
|
||||
if (pr == NULL) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_RoutingList->AddTail (pr);
|
||||
|
||||
for (j = 0; j < Depth; j++, pr++) {
|
||||
*pr = *pCurrent;
|
||||
ASSERT (pCurrent->pXbar != NULL);
|
||||
//
|
||||
// We're holding onto this interface, so AddRef
|
||||
//
|
||||
pCurrent->pXbar->AddRef();
|
||||
|
||||
pCurrent = pCurrent->pRightRouting;
|
||||
|
||||
//
|
||||
// Pointers were stack based during recursive search, so update them
|
||||
// in the allocated array
|
||||
//
|
||||
pr->pLeftRouting = &(*(pr-1));
|
||||
pr->pRightRouting = pCurrent;
|
||||
|
||||
if (j == 0) { // first element
|
||||
pr->pLeftRouting = NULL;
|
||||
}
|
||||
if (j == (Depth - 1)) { // last element
|
||||
pr->pRightRouting = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
HRESULT
|
||||
CCrossbar::DestroyRoutingList()
|
||||
{
|
||||
int k;
|
||||
int Depth;
|
||||
CRouting * pCurrent;
|
||||
|
||||
DbgLog((LOG_TRACE,3,TEXT("DestroyRoutingList")));
|
||||
|
||||
while (m_RoutingList->GetCount()) {
|
||||
pCurrent = m_RoutingList->RemoveHead();
|
||||
Depth = pCurrent->Depth + 1;
|
||||
|
||||
for (k = 0; k < Depth; k++) {
|
||||
ASSERT (pCurrent->pXbar != NULL);
|
||||
pCurrent->pXbar->Release();
|
||||
|
||||
pCurrent = pCurrent->pRightRouting;
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Does not AddRef the returned *Pin
|
||||
//
|
||||
HRESULT
|
||||
CCrossbar::GetCrossbarIPinAtIndex(
|
||||
IAMCrossbar *pXbar,
|
||||
LONG PinIndex,
|
||||
BOOL IsInputPin,
|
||||
IPin ** ppPin)
|
||||
{
|
||||
LONG cntInPins, cntOutPins;
|
||||
IPin *pP = 0;
|
||||
IBaseFilter *pFilter = NULL;
|
||||
IEnumPins *pins;
|
||||
ULONG n;
|
||||
HRESULT hr;
|
||||
|
||||
*ppPin = 0;
|
||||
|
||||
if(S_OK != pXbar->get_PinCounts(&cntOutPins, &cntInPins)) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
LONG TrueIndex = IsInputPin ? PinIndex : PinIndex + cntInPins;
|
||||
|
||||
hr = pXbar->QueryInterface(IID_IBaseFilter, (void **)&pFilter);
|
||||
|
||||
if (hr == S_OK) {
|
||||
if(SUCCEEDED(pFilter->EnumPins(&pins))) {
|
||||
LONG i=0;
|
||||
while(pins->Next(1, &pP, &n) == S_OK) {
|
||||
pP->Release();
|
||||
if (i == TrueIndex) {
|
||||
*ppPin = pP;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
pins->Release();
|
||||
}
|
||||
pFilter->Release();
|
||||
}
|
||||
|
||||
return *ppPin ? S_OK : E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Find corresponding index of an IPin on a crossbar
|
||||
//
|
||||
HRESULT
|
||||
CCrossbar::GetCrossbarIndexFromIPin (
|
||||
IAMCrossbar * pXbar,
|
||||
LONG * PinIndex,
|
||||
BOOL IsInputPin,
|
||||
IPin * pPin)
|
||||
|
||||
{
|
||||
LONG cntInPins, cntOutPins;
|
||||
IPin *pP = 0;
|
||||
IBaseFilter *pFilter = NULL;
|
||||
IEnumPins *pins;
|
||||
ULONG n;
|
||||
BOOL fOK = FALSE;
|
||||
HRESULT hr;
|
||||
|
||||
if(S_OK != pXbar->get_PinCounts(&cntOutPins, &cntInPins)) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
hr = pXbar->QueryInterface(IID_IBaseFilter, (void **)&pFilter);
|
||||
|
||||
if (hr == S_OK) {
|
||||
if(SUCCEEDED(pFilter->EnumPins(&pins))) {
|
||||
LONG i=0;
|
||||
while(pins->Next(1, &pP, &n) == S_OK) {
|
||||
pP->Release();
|
||||
if (pPin == pP) {
|
||||
*PinIndex = IsInputPin ? i : i - cntInPins;
|
||||
fOK = TRUE;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
pins->Release();
|
||||
}
|
||||
pFilter->Release();
|
||||
}
|
||||
|
||||
return fOK ? S_OK : E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// How many unique video inputs can be selected?
|
||||
//
|
||||
HRESULT
|
||||
CCrossbar::GetInputCount (
|
||||
LONG *pCount)
|
||||
{
|
||||
*pCount = m_RoutingList->GetCount();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// What is the physical type of a given input?
|
||||
//
|
||||
HRESULT
|
||||
CCrossbar::GetInputType (
|
||||
LONG Index,
|
||||
LONG * PhysicalType)
|
||||
{
|
||||
CRouting *pCurrent = m_RoutingList->GetHead();
|
||||
|
||||
if (Index >= m_RoutingList->GetCount()) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
POSITION pos = m_RoutingList->GetHeadPosition();
|
||||
for (int j = 0; j <= Index; j++) {
|
||||
pCurrent = m_RoutingList->GetNext(pos);
|
||||
}
|
||||
ASSERT (pCurrent != NULL);
|
||||
|
||||
*PhysicalType = pCurrent->InputPhysicalType;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Converts a PinType into a String
|
||||
//
|
||||
BOOL
|
||||
CCrossbar::StringFromPinType (TCHAR *pc, int nSize, long lType)
|
||||
{
|
||||
TCHAR *pcT;
|
||||
BOOL bSuccess;
|
||||
|
||||
switch (lType) {
|
||||
|
||||
case PhysConn_Video_Tuner: pcT = TEXT("Video Tuner"); break;
|
||||
case PhysConn_Video_Composite: pcT = TEXT("Video Composite"); break;
|
||||
case PhysConn_Video_SVideo: pcT = TEXT("Video SVideo"); break;
|
||||
case PhysConn_Video_RGB: pcT = TEXT("Video RGB"); break;
|
||||
case PhysConn_Video_YRYBY: pcT = TEXT("Video YRYBY"); break;
|
||||
case PhysConn_Video_SerialDigital: pcT = TEXT("Video SerialDigital"); break;
|
||||
case PhysConn_Video_ParallelDigital: pcT = TEXT("Video ParallelDigital");break;
|
||||
case PhysConn_Video_SCSI: pcT = TEXT("Video SCSI"); break;
|
||||
case PhysConn_Video_AUX: pcT = TEXT("Video AUX"); break;
|
||||
case PhysConn_Video_1394: pcT = TEXT("Video 1394"); break;
|
||||
case PhysConn_Video_USB: pcT = TEXT("Video USB"); break;
|
||||
case PhysConn_Video_VideoDecoder: pcT = TEXT("Video Decoder"); break;
|
||||
case PhysConn_Video_VideoEncoder: pcT = TEXT("Video Encoder"); break;
|
||||
|
||||
case PhysConn_Audio_Tuner: pcT = TEXT("Audio Tuner"); break;
|
||||
case PhysConn_Audio_Line: pcT = TEXT("Audio Line"); break;
|
||||
case PhysConn_Audio_Mic: pcT = TEXT("Audio Mic"); break;
|
||||
case PhysConn_Audio_AESDigital: pcT = TEXT("Audio AESDigital"); break;
|
||||
case PhysConn_Audio_SPDIFDigital: pcT = TEXT("Audio SPDIFDigital"); break;
|
||||
case PhysConn_Audio_SCSI: pcT = TEXT("Audio SCSI"); break;
|
||||
case PhysConn_Audio_AUX: pcT = TEXT("Audio AUX"); break;
|
||||
case PhysConn_Audio_1394: pcT = TEXT("Audio 1394"); break;
|
||||
case PhysConn_Audio_USB: pcT = TEXT("Audio USB"); break;
|
||||
case PhysConn_Audio_AudioDecoder: pcT = TEXT("Audio Decoder"); break;
|
||||
|
||||
default:
|
||||
pcT = TEXT("Unknown");
|
||||
break;
|
||||
}
|
||||
|
||||
// return TRUE on sucessful copy
|
||||
if (lstrcpyn (pc, pcT, nSize) != NULL) {
|
||||
bSuccess = TRUE;
|
||||
}
|
||||
else {
|
||||
bSuccess = FALSE;
|
||||
}
|
||||
|
||||
return (bSuccess);
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Get a text version of an input
|
||||
//
|
||||
// Return S_OK if the buffer is large enough to copy the string name
|
||||
//
|
||||
HRESULT
|
||||
CCrossbar::GetInputName (
|
||||
LONG Index,
|
||||
TCHAR *pName,
|
||||
LONG Size)
|
||||
{
|
||||
CRouting *pCurrent = m_RoutingList->GetHead();
|
||||
|
||||
if ((Index >= m_RoutingList->GetCount()) || (pName == NULL)) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
POSITION pos = m_RoutingList->GetHeadPosition();
|
||||
for (int j = 0; j <= Index; j++) {
|
||||
pCurrent = m_RoutingList->GetNext(pos);
|
||||
}
|
||||
ASSERT (pCurrent != NULL);
|
||||
|
||||
return (StringFromPinType (pName, Size, pCurrent->InputPhysicalType) ?
|
||||
S_OK : E_FAIL);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Select an input
|
||||
//
|
||||
HRESULT
|
||||
CCrossbar::SetInputIndex (
|
||||
LONG Index)
|
||||
{
|
||||
HRESULT hr = E_FAIL;
|
||||
CRouting *pCurrent = m_RoutingList->GetHead();
|
||||
int j;
|
||||
|
||||
if (Index >= m_RoutingList->GetCount()) {
|
||||
return hr;
|
||||
}
|
||||
|
||||
POSITION pos = m_RoutingList->GetHeadPosition();
|
||||
for (j = 0; j <= Index; j++) {
|
||||
pCurrent = m_RoutingList->GetNext(pos);
|
||||
}
|
||||
|
||||
ASSERT (pCurrent != NULL);
|
||||
|
||||
int Depth= pCurrent->Depth + 1;
|
||||
|
||||
for (j = 0; j < Depth; j++) {
|
||||
hr = pCurrent->pXbar->Route (pCurrent->VideoOutputIndex, pCurrent->VideoInputIndex);
|
||||
ASSERT (S_OK == hr);
|
||||
|
||||
if ((pCurrent->AudioOutputIndex != -1) && (pCurrent->AudioInputIndex != -1)) {
|
||||
EXECUTE_ASSERT (S_OK == pCurrent->pXbar->Route (pCurrent->AudioOutputIndex, pCurrent->AudioInputIndex));
|
||||
}
|
||||
|
||||
DbgLog((LOG_TRACE,3,TEXT("CCrossbar::Routing, VideoOutIndex=%d VideoInIndex=%d"),
|
||||
pCurrent->VideoOutputIndex, pCurrent->VideoInputIndex));
|
||||
|
||||
pCurrent++;
|
||||
}
|
||||
|
||||
m_CurrentRoutingIndex = Index;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// What input is currently selected?
|
||||
//
|
||||
HRESULT
|
||||
CCrossbar::GetInputIndex (
|
||||
LONG *Index)
|
||||
{
|
||||
*Index = m_CurrentRoutingIndex;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// File: Crossbar.h
|
||||
//
|
||||
// Desc: DirectShow sample code - definition of class for controlling
|
||||
// video crossbars.
|
||||
//
|
||||
// Copyright (c) 1993-2001 Microsoft Corporation. All rights reserved.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#ifndef __Crossbar_h__
|
||||
#define __Crossbar_h__
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Name: class CClass
|
||||
// Desc: This class contains routing information for the capture data
|
||||
//------------------------------------------------------------------------------
|
||||
class CRouting {
|
||||
public:
|
||||
class CRouting *pLeftRouting;
|
||||
class CRouting *pRightRouting;
|
||||
LONG VideoInputIndex;
|
||||
LONG VideoOutputIndex;
|
||||
LONG AudioInputIndex;
|
||||
LONG AudioOutputIndex;
|
||||
IAMCrossbar *pXbar;
|
||||
LONG InputPhysicalType;
|
||||
LONG OutputPhysicalType;
|
||||
LONG Depth;
|
||||
|
||||
CRouting () {};
|
||||
~CRouting () {};
|
||||
};
|
||||
|
||||
typedef CGenericList<CRouting> CRoutingList;
|
||||
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Name: class CCrossbar
|
||||
// Desc: The actual helper class for Crossbars
|
||||
//------------------------------------------------------------------------------
|
||||
class CCrossbar
|
||||
{
|
||||
private:
|
||||
IPin *m_pStartingPin;
|
||||
CRouting m_RoutingRoot;
|
||||
CRoutingList *m_RoutingList;
|
||||
int m_CurrentRoutingIndex;
|
||||
|
||||
HRESULT BuildRoutingList (
|
||||
IPin *pStartingInputPin,
|
||||
CRouting *pCRouting,
|
||||
int Depth);
|
||||
HRESULT SaveRouting (CRouting *pRoutingNew);
|
||||
HRESULT DestroyRoutingList();
|
||||
BOOL StringFromPinType (TCHAR *pc, int nSize, long lType);
|
||||
|
||||
HRESULT GetCrossbarIPinAtIndex(
|
||||
IAMCrossbar *pXbar,
|
||||
LONG PinIndex,
|
||||
BOOL IsInputPin,
|
||||
IPin ** ppPin);
|
||||
HRESULT GetCrossbarIndexFromIPin (
|
||||
IAMCrossbar * pXbar,
|
||||
LONG * PinIndex,
|
||||
BOOL IsInputPin,
|
||||
IPin * pPin);
|
||||
|
||||
public:
|
||||
|
||||
CCrossbar (IPin *pPin);
|
||||
~CCrossbar();
|
||||
|
||||
HRESULT GetInputCount (LONG *pCount);
|
||||
HRESULT GetInputType (LONG Index, LONG * PhysicalType);
|
||||
HRESULT GetInputName (LONG Index, TCHAR * pName, LONG NameSize);
|
||||
HRESULT SetInputIndex (LONG Index);
|
||||
HRESULT GetInputIndex (LONG *Index);
|
||||
|
||||
};
|
||||
|
||||
#endif // __Crossbar_h__
|
||||
@@ -0,0 +1,14 @@
|
||||
DirectShow Sample -- AMCap
|
||||
--------------------------
|
||||
|
||||
This sample application demonstrates the following tasks related to
|
||||
audio and video capture:
|
||||
|
||||
- Capture to a file
|
||||
- Live preview
|
||||
- Allocation of the capture file
|
||||
- Display of device property pages
|
||||
- Device enumeration
|
||||
- Stream control
|
||||
|
||||
AMCap replaces the Video For Windows VidCap sample.
|
||||
@@ -0,0 +1,320 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// File: Status.cpp
|
||||
//
|
||||
// Desc: Status Bar Window Code
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corporation. All rights reserved.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include <streams.h>
|
||||
#include <windowsx.h>
|
||||
#include <mmsystem.h>
|
||||
#include "status.h"
|
||||
|
||||
|
||||
// class names for status bar and static text windows
|
||||
TCHAR szStatusClass[] = TEXT("StatusClass");
|
||||
TCHAR szText[] = TEXT("SText");
|
||||
int gStatusStdHeight; // based on font metrics
|
||||
|
||||
static HANDLE ghFont;
|
||||
static HBRUSH ghbrHL, ghbrShadow;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Local Function Prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
LRESULT CALLBACK statusWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT CALLBACK fnText(HWND, UINT, WPARAM, LPARAM);
|
||||
static void PaintText(HWND hwnd, HDC hdc);
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------+
|
||||
| statusCreateTools - create the objects needed for status bar
|
||||
|
|
||||
+--------------------------------------------------------------*/
|
||||
void
|
||||
statusCreateTools(void)
|
||||
{
|
||||
HDC hdc;
|
||||
TEXTMETRIC tm;
|
||||
HFONT hfont;
|
||||
|
||||
ghbrHL = CreateSolidBrush(GetSysColor(COLOR_BTNHIGHLIGHT));
|
||||
ghbrShadow = CreateSolidBrush(GetSysColor(COLOR_BTNSHADOW));
|
||||
|
||||
/* Create the font we'll use for the status bar - use system as default */
|
||||
ghFont = CreateFont(12, 0, // height, width
|
||||
0, 0, // escapement, orientation
|
||||
FW_NORMAL, // weight,
|
||||
FALSE, FALSE, FALSE, // attributes
|
||||
ANSI_CHARSET, // charset
|
||||
OUT_DEFAULT_PRECIS, // output precision
|
||||
CLIP_DEFAULT_PRECIS, // clip precision
|
||||
DEFAULT_QUALITY, // quality
|
||||
VARIABLE_PITCH | FF_MODERN,
|
||||
TEXT("Helv"));
|
||||
|
||||
if(ghFont == NULL)
|
||||
{
|
||||
ghFont = GetStockObject(SYSTEM_FONT);
|
||||
}
|
||||
|
||||
// find the char size to calc standard status bar height
|
||||
hdc = GetDC(NULL);
|
||||
hfont = (HFONT)SelectObject(hdc, ghFont);
|
||||
GetTextMetrics(hdc, &tm);
|
||||
SelectObject(hdc, hfont);
|
||||
ReleaseDC(NULL, hdc);
|
||||
|
||||
gStatusStdHeight = tm.tmHeight * 3 / 2;
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------+
|
||||
| statusDeleteTools
|
||||
|
|
||||
+--------------------------------------------------------------*/
|
||||
void statusDeleteTools(void)
|
||||
{
|
||||
DeleteObject(ghbrHL);
|
||||
DeleteObject(ghbrShadow);
|
||||
|
||||
DeleteObject(ghFont);
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------+
|
||||
| statusInit - initialize for status window, register the
|
||||
| Window's class.
|
||||
|
|
||||
+--------------------------------------------------------------*/
|
||||
BOOL statusInit(HANDLE hInst, HANDLE hPrev)
|
||||
{
|
||||
WNDCLASS cls;
|
||||
|
||||
statusCreateTools();
|
||||
|
||||
if(!hPrev)
|
||||
{
|
||||
cls.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
cls.hIcon = NULL;
|
||||
cls.lpszMenuName = NULL;
|
||||
cls.lpszClassName = szStatusClass;
|
||||
cls.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
|
||||
cls.hInstance = (HINSTANCE)hInst;
|
||||
cls.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
|
||||
cls.lpfnWndProc = (WNDPROC)statusWndProc;
|
||||
cls.cbClsExtra = 0;
|
||||
cls.cbWndExtra = 0;
|
||||
|
||||
if(!RegisterClass(&cls))
|
||||
return FALSE;
|
||||
|
||||
cls.hCursor = LoadCursor(NULL,IDC_ARROW);
|
||||
cls.hIcon = NULL;
|
||||
cls.lpszMenuName = NULL;
|
||||
cls.lpszClassName = szText;
|
||||
cls.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
|
||||
cls.hInstance = (HINSTANCE)hInst;
|
||||
cls.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
|
||||
cls.lpfnWndProc = (WNDPROC)fnText;
|
||||
cls.cbClsExtra = 0;
|
||||
cls.cbWndExtra = 0;
|
||||
|
||||
if(!RegisterClass(&cls))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------+
|
||||
| statusGetHeight
|
||||
|
|
||||
| Returns the recommended height for a status bar based on the
|
||||
| character dimensions of the font used
|
||||
+--------------------------------------------------------------*/
|
||||
int statusGetHeight(void)
|
||||
{
|
||||
return(gStatusStdHeight);
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------+
|
||||
| statusUpdateStatus - update the status line
|
||||
|
|
||||
| The argument can either be NULL or a string
|
||||
+--------------------------------------------------------------*/
|
||||
void statusUpdateStatus(HWND hwnd, LPCTSTR lpsz)
|
||||
{
|
||||
HWND hwndtext;
|
||||
|
||||
hwndtext = GetDlgItem(hwnd, 1);
|
||||
if(!lpsz || *lpsz == '\0')
|
||||
{
|
||||
SetWindowText(hwndtext,TEXT(""));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetWindowText(hwndtext, lpsz);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------+
|
||||
| statusWndProc - window proc for status window
|
||||
|
|
||||
+--------------------------------------------------------------*/
|
||||
LRESULT CALLBACK
|
||||
statusWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
HWND hwndSText;
|
||||
|
||||
switch(msg)
|
||||
{
|
||||
case WM_CREATE:
|
||||
{
|
||||
/* we need to create the static text control for the status bar */
|
||||
hwndSText = CreateWindow(szText,
|
||||
TEXT(""),
|
||||
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
|
||||
0, 0, 0, 0,
|
||||
hwnd,
|
||||
(HMENU) 1, // child id
|
||||
GetWindowInstance(hwnd),
|
||||
NULL);
|
||||
|
||||
if(!hwndSText)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_DESTROY:
|
||||
statusDeleteTools();
|
||||
break;
|
||||
|
||||
case WM_SIZE:
|
||||
{
|
||||
RECT rc;
|
||||
|
||||
GetClientRect(hwnd, &rc);
|
||||
|
||||
MoveWindow(GetDlgItem(hwnd, 1), // get child window handle
|
||||
2, 1, // xy just inside
|
||||
rc.right - 4,
|
||||
rc.bottom - 2,
|
||||
TRUE);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_PAINT:
|
||||
{
|
||||
BeginPaint(hwnd, &ps);
|
||||
|
||||
// only the background and the child window need painting
|
||||
EndPaint(hwnd, &ps);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_SYSCOLORCHANGE:
|
||||
statusDeleteTools();
|
||||
statusCreateTools();
|
||||
break;
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------+
|
||||
| fnText - window proc for static text window
|
||||
| |
|
||||
+--------------------------------------------------------------*/
|
||||
LRESULT CALLBACK
|
||||
fnText(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case WM_SETTEXT:
|
||||
DefWindowProc(hwnd, msg, wParam, lParam);
|
||||
InvalidateRect(hwnd,NULL,FALSE);
|
||||
UpdateWindow(hwnd);
|
||||
return 0L;
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
return 0L;
|
||||
|
||||
case WM_PAINT:
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
|
||||
BeginPaint(hwnd, &ps);
|
||||
PaintText(hwnd, ps.hdc);
|
||||
EndPaint(hwnd, &ps);
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
|
||||
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------+
|
||||
| PaintText - paint the shadowed static text field
|
||||
|
|
||||
+--------------------------------------------------------------*/
|
||||
void PaintText(HWND hwnd, HDC hdc)
|
||||
{
|
||||
RECT rc;
|
||||
TCHAR ach[128];
|
||||
int len;
|
||||
int dx, dy;
|
||||
RECT rcFill;
|
||||
HFONT hfontOld;
|
||||
HBRUSH hbrSave;
|
||||
|
||||
GetClientRect(hwnd, &rc);
|
||||
|
||||
len = GetWindowText(hwnd,ach,sizeof(ach)/sizeof(ach[0]));
|
||||
|
||||
SetBkColor(hdc, GetSysColor(COLOR_BTNFACE));
|
||||
SetTextColor(hdc, GetSysColor(COLOR_BTNTEXT));
|
||||
|
||||
hfontOld = (HFONT)SelectObject(hdc, ghFont);
|
||||
|
||||
rcFill.left = rc.left + 1;
|
||||
rcFill.right = rc.right - 1;
|
||||
rcFill.top = rc.top + 1;
|
||||
rcFill.bottom = rc.bottom - 1;
|
||||
|
||||
/* move in some and do background and text in one swoosh */
|
||||
ExtTextOut(hdc,4,1,ETO_OPAQUE,&rcFill,ach,len,NULL);
|
||||
|
||||
dx = rc.right - rc.left;
|
||||
dy = rc.bottom - rc.top;
|
||||
|
||||
hbrSave = (HBRUSH)SelectObject(hdc, ghbrShadow);
|
||||
PatBlt(hdc, rc.left, rc.top, 1, dy, PATCOPY);
|
||||
PatBlt(hdc, rc.left, rc.top, dx, 1, PATCOPY);
|
||||
|
||||
SelectObject(hdc, ghbrHL);
|
||||
PatBlt(hdc, rc.right-1, rc.top+1, 1, dy-1, PATCOPY);
|
||||
PatBlt(hdc, rc.left+1, rc.bottom -1, dx-1, 1, PATCOPY);
|
||||
|
||||
if(hfontOld)
|
||||
SelectObject(hdc, hfontOld);
|
||||
if(hbrSave)
|
||||
SelectObject(hdc, hbrSave);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// File: Status.h
|
||||
//
|
||||
// Desc: Header file for the Status Bar
|
||||
//
|
||||
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Global Variables
|
||||
//------------------------------------------------------------------------------
|
||||
extern TCHAR szStatusClass[];
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Function Prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
BOOL statusInit(HANDLE hInst, HANDLE hPrev);
|
||||
void statusUpdateStatus(HWND hwnd, LPCTSTR lpsz);
|
||||
int statusGetHeight(void);
|
||||
@@ -0,0 +1,12 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// stdafx.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include <streams.h>
|
||||
#include "stdafx.h"
|
||||
|
||||
#ifdef _ATL_STATIC_REGISTRY
|
||||
#include <statreg.h>
|
||||
#include <statreg.cpp>
|
||||
#endif
|
||||
#include <atlimpl.cpp>
|
||||
@@ -0,0 +1,26 @@
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently,
|
||||
// but are changed infrequently
|
||||
|
||||
#if !defined(AFX_STDAFX_H__08E7CDC6_7F58_11D2_8CF1_00A0C9441E20__INCLUDED_)
|
||||
#define AFX_STDAFX_H__08E7CDC6_7F58_11D2_8CF1_00A0C9441E20__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#ifdef WIN32_LEAN_AND_MEAN
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
|
||||
#define _ATL_APARTMENT_THREADED
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
||||
#include <atlbase.h>
|
||||
extern CComModule _Module;
|
||||
#include <atlcom.h>
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_STDAFX_H__08E7CDC6_7F58_11D2_8CF1_00A0C9441E20__INCLUDED)
|
||||
Reference in New Issue
Block a user