Initial
This commit is contained in:
15
video/MAIN.CPP
Normal file
15
video/MAIN.CPP
Normal file
@@ -0,0 +1,15 @@
|
||||
#include <common/string.hpp>
|
||||
#include <video/main.hpp>
|
||||
#include <video/vidctrl.hpp>
|
||||
|
||||
HINSTANCE Main::smhInstance=0;
|
||||
HINSTANCE Main::smhPrevInstance=0;
|
||||
int Main::smnCmdShow=0;
|
||||
|
||||
|
||||
int PASCAL WinMain(HINSTANCE /*hInstance*/,HINSTANCE /*hPrevInstance*/,LPSTR /*lpszCmdLine*/,int /*nCmdShow*/)
|
||||
{
|
||||
VideoControl vidControl;
|
||||
vidControl.getVersion();
|
||||
return FALSE;
|
||||
}
|
||||
67
video/MAIN.HPP
Normal file
67
video/MAIN.HPP
Normal file
@@ -0,0 +1,67 @@
|
||||
#ifndef _SYSTEM_MAIN_HPP_
|
||||
#define _SYSTEM_MAIN_HPP_
|
||||
#ifndef _COMMON_WINDOWS_HPP_
|
||||
#include <common/windows.hpp>
|
||||
#endif
|
||||
|
||||
class Main
|
||||
{
|
||||
public:
|
||||
static HINSTANCE processInstance(HWND hWnd);
|
||||
static HINSTANCE processInstance(void);
|
||||
static HINSTANCE previousProcessInstance(void);
|
||||
static void processInstance(HINSTANCE processInstance);
|
||||
static void previousProcessInstance(HINSTANCE previousProcessInstance);
|
||||
static void cmdShow(int nCmdShow);
|
||||
private:
|
||||
static HINSTANCE smhInstance;
|
||||
static HINSTANCE smhPrevInstance;
|
||||
static int smnCmdShow;
|
||||
};
|
||||
|
||||
inline
|
||||
void Main::processInstance(HINSTANCE hProcessInstance)
|
||||
{
|
||||
smhInstance=hProcessInstance;
|
||||
}
|
||||
|
||||
inline
|
||||
void Main::previousProcessInstance(HINSTANCE previousProcessInstance)
|
||||
{
|
||||
smhPrevInstance=previousProcessInstance;
|
||||
}
|
||||
|
||||
inline
|
||||
void Main::cmdShow(int nCmdShow)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
HINSTANCE Main::processInstance(void)
|
||||
{
|
||||
return smhInstance;
|
||||
}
|
||||
|
||||
inline
|
||||
HINSTANCE Main::previousProcessInstance(void)
|
||||
{
|
||||
return smhPrevInstance;
|
||||
}
|
||||
|
||||
#if defined(__FLAT__)
|
||||
inline
|
||||
HINSTANCE Main::processInstance(HWND hWnd)
|
||||
{
|
||||
return (HINSTANCE)::GetWindowLong(hWnd,GWL_HINSTANCE);
|
||||
}
|
||||
#else
|
||||
inline
|
||||
HINSTANCE Main::processInstance(HWND hWnd)
|
||||
{
|
||||
return (HINSTANCE)::GetWindowWord(hWnd,GWW_HINSTANCE);
|
||||
}
|
||||
#endif
|
||||
#define WM_REACTIVATE WM_USER+1
|
||||
#endif
|
||||
|
||||
|
||||
21
video/VIDCTRL.CPP
Normal file
21
video/VIDCTRL.CPP
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <video/vidctrl.hpp>
|
||||
|
||||
VideoControl::VideoControl(void)
|
||||
: VxDControl("\\\\.\\VIDEO.VXD")
|
||||
{
|
||||
if(!isOkay()){mErrorCode=::GetLastError();return;}
|
||||
resetError();
|
||||
if(ExpectedVersion!=getVersion())VxDControl::~VxDControl();
|
||||
}
|
||||
|
||||
DWORD VideoControl::getVersion(void)
|
||||
{
|
||||
DWORD returnCode(FALSE);
|
||||
|
||||
if(!isOkay())return FALSE;
|
||||
resetError();
|
||||
if(!::DeviceIoControl((HANDLE)*this,GetVersion,(LPVOID)0,0,(LPVOID)mReturnInfo,sizeof(mReturnInfo),&mBytesReturned,0))mErrorCode=::GetLastError();
|
||||
else returnCode=TRUE;
|
||||
return (returnCode?mReturnInfo[1]:returnCode);
|
||||
}
|
||||
|
||||
43
video/VIDCTRL.HPP
Normal file
43
video/VIDCTRL.HPP
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifndef _VIDEO_VIDEOCONTROL_HPP_
|
||||
#define _VIDEO_VIDEOCONTROL_HPP_
|
||||
#ifndef _COMMON_VXDCONTROL_HPP_
|
||||
#include <common/vxdctrl.hpp>
|
||||
#endif
|
||||
|
||||
class VideoControl : public VxDControl
|
||||
{
|
||||
public:
|
||||
VideoControl(void);
|
||||
virtual ~VideoControl();
|
||||
DWORD getVersion(void);
|
||||
DWORD errorCode(void)const;
|
||||
private:
|
||||
typedef DWORD QUADWORD[2];
|
||||
typedef QUADWORD *PQUADWORD;
|
||||
enum {GetVersion=0x01};
|
||||
enum {ExpectedVersion=0x400};
|
||||
void resetError(void);
|
||||
DWORD mBytesReturned;
|
||||
DWORD mSendInfo[2];
|
||||
DWORD mReturnInfo[4];
|
||||
DWORD mErrorCode;
|
||||
};
|
||||
|
||||
inline
|
||||
VideoControl::~VideoControl()
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
void VideoControl::resetError(void)
|
||||
{
|
||||
mErrorCode=0;
|
||||
}
|
||||
|
||||
inline
|
||||
DWORD VideoControl::errorCode(void)const
|
||||
{
|
||||
return mErrorCode;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user