阅读:1044回复:2
求救 利用ExtEscape 访问显存
最近,我编程实现视频的显示用到ExtEscape函数
谁能告之该函数的详细用法啊?谢谢了 |
|
|
沙发#
发布于:2004-10-10 11:40
ExtEscape
The ExtEscape function enables applications to access capabilities of a particular device that are not available through GDI. int ExtEscape( HDC hdc, // handle to DC int nEscape, // escape function int cbInput, // size of input structure LPCSTR lpszInData, // input structure int cbOutput, // size of output structure LPSTR lpszOutData // output structure ); Parameters hdc [in] Handle to the device context. nEscape [in] Specifies the escape function to be performed. It can be one of the following or it can be an application-defined escape function. Value Meaning CHECKJPEGFORMAT Windows 2000/XP: Checks whether the printer supports a JPEG image. CHECKPNGFORMAT Windows 2000/XP: Checks whether the printer supports a PNG image. DRAWPATTERNRECT Draws a white, gray-scale, or black rectangle. GET_PS_FEATURESETTING Windows 2000/XP: Gets information on a specified feature setting for a PostScript driver. PASSTHROUGH Allows the application to send data directly to a printer. Supported in compatibility mode and GDI-centric mode. POSTSCRIPT_DATA Allows the application to send data directly to a printer. Supported only in compatibility mode. POSTSCRIPT_IDENTIFY Windows 2000/XP: Sets a PostScript driver to GDI-centric or PostScript-centric mode. POSTSCRIPT_INJECTION Windows 2000/XP: Inserts a block of raw data in a PostScript job stream. POSTSCRIPT_PASSTHROUGH Windows 2000/XP: Sends data directly to a PostScript printer driver. Supported in compatibility mode and PS-centric mode. QUERYESCSUPPORT Determines whether a particular escape is implemented by the device driver. SPCLPASSTHROUGH2 Windows 2000/XP: Allows applications to include private procedures and other resources at the document level-save context. cbInput [in] Specifies the number of bytes of data pointed to by the lpszInData parameter. lpszInData [in] Pointer to the input structure required for the specified escape. cbOutput [in] Specifies the number of bytes of data pointed to by the lpszOutData parameter. lpszOutData [out] Pointer to the structure that receives output from this escape. This parameter must not be NULL if ExtEscape is called as a query function. If no data is to be returned in this structure, set cbOutput to 0. Return Values The return value specifies the outcome of the function. It is greater than zero if the function is successful, except for the QUERYESCSUPPORT printer escape, which checks for implementation only. The return value is zero if the escape is not implemented. A return value less than zero indicates an error. Windows NT/2000/XP: To get extended error information, call GetLastError. Remarks Use this function to pass a driver-defined escape value to a device. Use the Escape function to pass one of the system-defined escape values to a device, unless the escape is one of the defined escapes in nEscape. ExtEscape might not work properly with the system-defined escapes. In particular, escapes in which lpszInData is a pointer to a structure that contains a member that is a pointer will fail. Example Code For an example, see Sizing a JPEG or PNG Image. Requirements Windows NT/2000/XP: Included in Windows NT 3.1 and later. Windows 95/98/Me: Included in Windows 95 and later. Header: Declared in Wingdi.h; include Windows.h. Library: Use Gdi32.lib. |
|
|
板凳#
发布于:2004-10-10 11:41
// pvJpgImage points to a buffer containing the JPEG image
// nJpgImageSize is the size of the buffer // ulJpgWidth is the width of the JPEG image // ulJpgHeight is the height of the JPEG image // // // Check if CHECKJPEGFORMAT is supported (device has JPEG support) // and use it to verify that device can handle the JPEG image. // ul = CHECKJPEGFORMAT; if ( // Check if CHECKJPEGFORMAT exists: (ExtEscape(hdc, QUERYESCSUPPORT, sizeof(ul), &ul, 0, 0) > 0) && // Check if CHECKJPEGFORMAT executed without error: (ExtEscape(hdc, CHECKJPEGFORMAT, pvJpgImage, nJpgImageSize, sizeof(ul), &ul) > 0) && // Check status code returned by CHECKJPEGFORMAT: (ul == 1) ) { // // Initialize the BITMAPINFO. // memset(&bmi, 0, sizeof(bmi)); bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmi.bmiHeader.biWidth = ulJpgWidth; bmi.bmiHeader.biHeight = -ulJpgHeight; // top-down image bmi.bmiHeader.biPlanes = 1; bmi.bmiHeader.biBitCount = 0; bmi.bmiHeader.biCompression = BI_JPEG; bmi.bmiHeader.biSizeImage = nJpgImageSize; // // Do the StretchDIBits. // iRet = StretchDIBits(hdc, // destination rectangle ulDstX, ulDstY, ulDstWidth, ulDstHeight, // source rectangle 0, 0, ulJpgWidth, ulJpgHeight, pvJpgImage, &bmi, DIB_RGB_COLORS, SRCCOPY); if (iRet == GDI_ERROR) return FALSE; } else { // // Decompress image into a DIB and call StretchDIBits // with the DIB instead. // } |
|
|