⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 okapi32.h

📁 OK系列PCI图象卡编程程序,MFC方式,压缩形式
💻 H
📖 第 1 页 / 共 2 页
字号:
	LPBITMAPINFOHEADER	lpbi; //bitmap info
	BYTE			*lpdib; //dib data
	HWND			hwndPlayBox; //1 replaying, 0 quit
	short			iCurrFrame; //current frame in buffer
	short			iReserved; //
} DIBINFO, *LPDIBINFO;



//------ okapi32 functions list -----------

#ifdef __cplusplus
extern "C" {            /* Assume C declarations for C++ */
#endif /* __cplusplus */


//--1. basic routines--------------

//prolog and epilog
HANDLE	WINAPI okOpenBoard(long *iIndex); //okLockBoard
		//open a Ok series board in specified index(0 based), return 0 if not found any
		//if success, return a handle to control specified board
		//if set index=-1, mean takes default index no. (default is 0 
		//if user not specified by 'Ok Device Manager' in Control Pannel)
		//this index can be also a specified board type code
		//this function will change iIndex to the true used index, 
		//if index input is -1 or type code 

BOOL	WINAPI okCloseBoard(HANDLE hBoard); //okCloseBoard
		//Unlock and close Ok board specified handle
long	WINAPI okGetLastError();
		//Get last error msg

long	WINAPI okGetBufferSize(HANDLE hBoard, void **lpLinear, DWORD *dwSize);
		//get base address and size of pre-allocated buffer,
		//if success return the max. frame num in which can be store according to current set
		//else return false;
LPVOID  WINAPI okGetBufferAddr(HANDLE hBoard, long lNoFrame);
		//get base address of specified frame No. in BUFFER
		//if success return the linear base address 
		//else return false;

LPVOID  WINAPI okGetTargetInfo(HANDLE hBoard, TARGET tgt, long lNoFrame, short * wid, short * ht, long *stride);
		//get target info include base address, width, height and stride specified frame No. 
		//if success return the linear base address and other infos, else return false;

short	WINAPI okGetTypeCode(HANDLE hBoard, LPSTR lpBoardName);
		//return type code and name of specified handle 


//set rect and capture 
long	WINAPI okSetTargetRect(HANDLE hBoard, TARGET target, LPRECT lpTgtRect);
		//set target (VIDEO, SCREEN, BUFFER, FRAME)capture to or from
		//if Rect.right or .bottom) are -1 , they will be filled current value
		//special note for target=BUFFER:
		//if never set CAPTURE_BUFBLOCKSIZE, the block size(W,H) of buffer will be changed 
		//according to size of right x bottom of lpRect, else the size will not changed 
		//if success return max frames this target can support, else return <=0

BOOL	WINAPI okSetToWndRect(HANDLE hBoard, HWND hWnd);
		//set client rect of hwnd as screen rect


BOOL	WINAPI okCaptureTo(HANDLE hBoard, TARGET Dest, WORD wParam, LPARAM lParam);
		//capture video source to target which can be BUFFER, SCREEN, FRAME, MONITOR 
		//wParam=start(o based), lParam>0: number of frame to capture to, =0: cont. mode,
 		//if lParam > total frames in BUFER, it will loop in rewind mode(i%total)
		//if lParam=-1 mean it loop infinitely until call okStopCapture
		//return max num frame can be stored in the target if success,
		// return 0 if failed(eg. format not matched). -1 not support target
		//this call will return immediately not wait to finish.
		//
BOOL	WINAPI okCaptureToScreen(HANDLE hBoard);
		//Start to capture to screen (video real-time display on screen) and return immediately
		//this is just a special routine of okCaptureTo(hBoard,SCREEN,0,0)

BOOL	WINAPI okPlaybackFrom(HANDLE hBoard, TARGET src, WORD wParam, LPARAM lParam);
		//playback on monitor from target which can be BUFFER, FRAME
		//wParam=start(o based), lParam>0: number of frame to capture to, =0: cont. mode 
		//if lParam > total frames in BUFER, it will loop in rewind mode (i%total)
		//if lParam=-1 mean it loop infinitely until call okStopCapture
		//return max num frame be stored in the target if success, 
		//return 0 if wrong. -1 not support target
		//this call will return immediately not wait to finish.
		//

//get status and stop capture
long	WINAPI okGetCaptureStatus(HANDLE hBoard, BOOL bWait);
		//query capturing status, if bWait then wait to finish capturing, else return immediately.
		//return 0 if finished, if cont. mode capturing return target capture to
		//(which include SCREEN -1, FRAME -2, MONITOR -3)
		//if capturing to/from BUFFER or file, return the frame No.(1 based) being capturing 

BOOL	WINAPI okStopCapture(HANDLE hBoard);
		//Stop capturing to or playback from SCREEN, BUFFER or other targets 
		//return target just captured to or from. 
		//if capturing to/from BUFFER or file, return the frame No.(1 based) being capturing 


//capture by to /from 
BOOL	WINAPI okCaptureByBuffer(HANDLE hBoard, TARGET dest, short start, long num);
		//capture sequence images to dest by way of two frame buffers (in BUFFER), 
		//the frame size and format is taken as same as current config of BUFFER
		//if dest is file name which can be .seq or .bmp (will generate multi bmp files)
		//dest can be also a user memory pointer or a BLOCKINFO pointer (with user memory pointer)
		//retrun true immediately if success. num should be great than 0

		
BOOL	WINAPI okPlaybackByBuffer(HANDLE hBoard, TARGET src, short start, long num);
		//playback sequence images on monitor from src by way of two frame buffers (in BUFFER)
		//the size and format of BUFFER will be changed to same as src
		//src can be a file name which may be .seq or .bmp (first orderd bmp files) 
		////src can be also a BLOCKINFO pointer (with infos of user memory pointer,size and format)
		//if src is just user memory pointer, this function will think its block size and format 
		//are same as current config of BUFFER (in this case can not support loop function).
		//retrun true immediately if success 
		//if num is great than the true frame number in src, it will loop back
		//if num=-1 mean it will loop infinitely until call okStopCapture

//set and get params
long	WINAPI okSetVideoParam(HANDLE hBoard, WORD wParam, long lParam);
		//----set video param sub-function defines
		//set video param and return previous param; 
		//if input lParam=-1, just return previous param 			
		//if not support return -1, if error return -2 

long	WINAPI okSetCaptureParam(HANDLE hBoard, WORD wParam, long lParam);
		//set capture param and return previous param; 
		//if input lParam=-1, just return previous param 			
		//if not support return -1, if error return -2 


//transfer and convert rect
long	WINAPI okSetConvertParam(HANDLE hBoard, WORD wParam, long lParam);
		//set convert param for for function okConvertRect 
		//if not support return -1, if error return -2 

long	WINAPI okReadRect(HANDLE hBoard, TARGET src, short start, LPBYTE lpBuf);
		//read data into lpBuf from rect(set previous) in frame start of dst (SCREEN, BUFFER, FRAME)
		//the data in lpBuf stored in way row by row
		//if src not supported return -1, if failed return 0, 
		//return -1 if not support, return 0 failed, 
		//if success return data length read in byte
		//if lpBuf=NULL, just return data length to read

long	WINAPI okWriteRect(HANDLE hBoard, TARGET dst, short start, LPBYTE lpBuf);
		//write data in lpBuf to rect(set previous) of dst (SCREEN, BUFFER, FRAME)
		//the data in lpBuf stored in way row by row
		//return -1 if not support, return 0 failed, 
		//if success return data length written in byte

long	WINAPI okReadRectEx(HANDLE hBoard, TARGET src, short start, LPBYTE lpBuf, LPARAM lParam);
		//read data into lpBuf from rect(set previous) in frame start of dst (SCREEN, BUFFER, FRAME)
		//the data in lpBuf stored in way row by row
		//if src not supported return -1, if failed return 0, 
		//return -1 if not support, return 0 failed, 
		//if success return data length read in byte
		//if lpBuf=NULL, just return data length to read
		//LOWORD(lParam)is form code for bits of lpBuf (e.g.:FORM_GRAY8),if it is 0 mean: as same as src
        //HIWORD(LParam) is the mode of taking channels. mode=0 take all, =1 red, =2 green, =3 blue;

long	WINAPI okWriteRectEx(HANDLE hBoard, TARGET dst, short start, LPBYTE lpBuf, LPARAM lParam);
		//write data in lpBuf to rect(set previous) of dst (SCREEN, BUFFER, FRAME)
		//the data in lpBuf stored in way row by row
		//return -1 if not support, return 0 failed, 
		//if success return data length written in byte
		//LOWORD(lParam)is form code for bits of lpBuf (e.g.:FORM_GRAY8),if it is 0 mean: as same as dst
        //HIWORD(LParam) is the mode of taking channels. mode=0 take all, =1 red, =2 green, =3 blue;

long	WINAPI okTransferRect(HANDLE hBoard, TARGET dest, short iFirst, TARGET src, short iStart, long lNum);
		//transfer source rect to dest rect (here target can be SCREEN, BUFFER, FRAME, also BLOCKINFO point to user memory) 
		//if total in dest or src less than lNum, it will rewind to begin then continue
		//this function transfer in format of src, that means it don't convert pixel bits if dst and src are not same 
		//if src or dst not supported return -1, if failed return 0, 
		//if success return data length of one block image in byte

long	WINAPI okConvertRect(HANDLE hBoard, TARGET dst, short first, TARGET src, short start, LPARAM lParam);
		//transfer source rect to dest rect (here target can be SCREEN, BUFFER, FRAME, also BLOCKINFO point to user memory) 
		//LOWORD(lParam)=lNum, total num, HIWORD(lParam)=mode, channels to convert
		//mode=0 take all, =1 red, =2 green, =3 blue;
		//if total in dest or src < lNum, it will rewind to begin then continue
		//this function convert to pixel foramt of dst if dst has not same bits format as src 
		//if src or dst not supported return -1, if failed return 0, 
		//if success return image size of one block in pixel

long	WINAPI okConvertRectEx(HANDLE hDstBoard, TARGET dst, short first, HANDLE hSrcBoard, TARGET src, short start, LPARAM no);
		//same as the above function okConvertRect except with src handle

	
long	WINAPI okGetSignalParam(HANDLE hBoard, WPARAM wParam);
		//Get specified param of video signal source
		//if not support return -1, if error return -2, else return param

long	WINAPI okWaitSignalEvent(HANDLE hBoard, WPARAM wParam, LPARAM lMilliSecond);
		//Wait specified signal come
		//lMilliSecond is time-out time in milliseconds for to wait
		//if lMilliSecond is zero, the function returns current state immediately
		//if lMilliSecond is INFINITE(-1) wait forever until event come
		//return -1 not support, 0 speicfied signal not come, 1 come


BOOL	WINAPI okSetSeqProcWnd(HANDLE hBoard, HWND hwndMain);
		//set proc hwnd for receive message about sequence capture

BOOL	WINAPI okSetSeqCallback(HANDLE hBoard, 
								BOOL CALLBACK BeginProc(HANDLE hBoard), 
								BOOL CALLBACK SeqProc(HANDLE hBoard, long No), 
								BOOL CALLBACK EndProc(HANDLE hBoard));
		//set callback function for multi-frame capturing function 
		//(which are okCaptureTo, okCaptureFrom,okCaptureToFile, okCaptureFromFile)
		//see follow 

BOOL	CALLBACK BeginProc(HANDLE hBoard); //user defined callback function
		//callback this function before to capture
BOOL	CALLBACK SeqProc(HANDLE hBoard, long No); //user defined callback function
		// callback this function after finish capturing one frame
		// No is the number(0 based) frame just finished or being playbacked. 
BOOL	CALLBACK EndProc(HANDLE hBoard); //user defined callback function
		// callback this function after end capturing

//---overlay mask:
long	WINAPI okEnableMask(HANDLE hBoard, BOOL bMask);
		//0: disable mask; 1: positive mask, 2: negative mask
		//positive: 0 for win clients visible, 1 video visible
		//negative: 0 for video visible,  1 for win client (graph) visible
		//if bMask=-1 actually not set just get status previous set
		//return last mask status,
 
long	WINAPI okSetMaskRect(HANDLE hBoard, LPRECT lpRect, LPSTR lpMask);
		//Set mask rect(lpRect is relative to lpDstRect in SetScreenRect or
		//SetBufferRect, lpMask is mask code (in byte 0 or 1). one byte for one pixel
		//if lpMask==1, set all rect region in lpRect video visible
		//if lpMask==0, set all rect region in lpRect video unvisible
		//return base linear address of inner mask bit 

//---set out LUT:
long	WINAPI okFillOutLUT(HANDLE hBoard,  LPBYTE bLUT, short start, short num);
		//fill specified playback out LUT. 
		//bLut stored values to fill, (r0,g0,b0, r1,g1,b1 ...)
		//start: offset pos in LUT(based 0), num: num items to fill


//---multi cards access--------
short	WINAPI okGetSlotBoard(BOARDTYPE **lpOkInfo);
		//Query all Ok boards available in PCI bus, return total number
short	WINAPI okGetBoardIndex(char *szBoardName, short iNo);
		//Get index (start 0) of specified board name string (it can also be typcode string)
		// and order in same name (start 0), 
		//return -1 if no this specified ok board
short	WINAPI okGetBoardName(long lIndex, LPSTR szBoardName);
		//get the board code and name of the specified index 
		//return the type code if success else return 0 if no card

BOOL	WINAPI okLoadInitParam(HANDLE hBoard, short iChannNo);
		//load specified chann (and as current chann.)of initial params
BOOL	WINAPI okSaveInitParam(HANDLE hBoard, short iChannNo);
		//save current init param to specified chann (and as current chann.)


long	WINAPI okGetAvailBuffer(void **lpLinear, DWORD *dwSize);
		//Get free meomery buffers pre-allocated . 
		//call it when user hope to access buffer directly or lock for some one board 
long	WINAPI okLockBuffer(HANDLE hBoard, DWORD dwSizeByte, void **lpBasLinear);
		//Lock speicfiled size meomery buffers, then other handle can not use them
		//return the size of locked buffer in fact
BOOL	WINAPI okUnlockAllBuffer(void);
		//Unlock all buffer for all handle

BOOL	WINAPI 	okMulCaptureTo(HANDLE *lphBaord,TARGET Dest, WORD wParam, LPARAM lParam);
		//control multi boards to capture to target simultaneously, lphBaord are pointer of hBoard of multi board  
		//other functions are same as okCaptureByBuffer

BOOL	WINAPI 	okMulCaptureByBuffer(HANDLE *lphBaord,TARGET tgt, short start, long num);
		//control multi boards to capture by buffer simultaneously, lphBaord are pointer of hBoard of multi board  
		//other functions are same as okCaptureByBuffer


//-- set pre-allocate buffer size in k byte
long	WINAPI okSetAllocBuffer(long lSize);
		//set the new size to preallocate in k bytes, 
		//if new size is not same as current, 
		//then the functuion will restart the window system

BOOL	WINAPI okSetStaticVxD(long lMode);
		//lMode=0: check if static vxd registered.
		//=1: create static vxd register
		//=2: delete static vxd register

//---apps utilities-----------------

//save and load files
long WINAPI okSaveImageFile(HANDLE hBoard, LPSTR szFileName, long first, TARGET target, long start, long num);
	//here target can be BUFFER, SCREEN, FRAME or user buffer pointor
	//1.if ext name=".bmp":
	//create new file and than save one frame in start position of target as bmp file 
	//
	//2.if ext name=".seq":
	//save no frame from (start) in target into (first) frame pos in seq(sequence) file in sequencely.
	//if the file already exist the function will not delete it, that mean old contents in the file will be kept.
	//So if you want create a new seq file with a existed file name you must delete before this call .
	//

long WINAPI okLoadImageFile(HANDLE hBoard, LPSTR szFileName, long first, TARGET target, long start, long num);
	//here target can be BUFFER, SCREEN, FRAME or user buffer pointor
	//1.if ext name=".bmp":
	//load one frame into start position of target from bmp file 
	//
	//2.if ext name=".seq":
	//load no frame into (start) in target from (first) frame pos in seq(sequence) file in sequencely.



//apps setup dialog 
BOOL WINAPI okOpenSetParamDlg( HANDLE hBoard, HWND hParentWnd);
	//dialog to setup video param 
BOOL WINAPI okOpenSeqCaptureDlg( HANDLE hBoard, HWND hParentWnd);
	//dialog to capture sequence image

LPDIBINFO WINAPI okOpenReplayDlg( HANDLE hBoard, HWND hWnd, TARGET src, long total);
	//open modeless dialog to replay sequence images(in BUFFER, USERBUF or seq file) on SCREEN or MONITOR

#ifdef __cplusplus
}
#endif    /* __cplusplus */




//-------------------end--------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -