C++如何实现设置某张图片全屏显示,并且仅显示这张图片

andong133 2014-04-17 11:00:24
C++如何实现设置某张图片全屏显示,并且仅显示这张图片。
即:
这张图片覆盖了桌面上所有图标和当前其他的软件窗口。
非常感谢大家啊!
...全文
1230 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
you can display the image with opencv ,plz. for examples: int main() { Mat image = imread("DSC02645.JPG"); namedWindow("pic_viewer", CV_WINDOW_NORMAL); setWindowProperty("pic_viewer", CV_WND_PROP_FULLSCREEN, CV_WINDOW_FULLSCREEN); imshow("pic_viewer", image); waitKey(1000); //每隔1秒显示 }
Magic旭 2014-08-04
  • 打赏
  • 举报
回复
可以先将这个窗口设置成无边框的、最大化的,并且置顶,再将图片用StrechBlt画到窗口上。
赵4老师 2014-07-09
  • 打赏
  • 举报
回复
palm_m 2014-07-09
  • 打赏
  • 举报
回复
引用 3 楼 zhao4zhong1 的回复:
StretchBlt The StretchBlt function copies a bitmap from a source rectangle into a destination rectangle, stretching or compressing the bitmap to fit the dimensions of the destination rectangle, if necessary. The system stretches or compresses the bitmap according to the stretching mode currently set in the destination device context. BOOL StretchBlt( HDC hdcDest, // handle to destination device context int nXOriginDest, // x-coordinate of upper-left corner of dest. rectangle int nYOriginDest, // y-coordinate of upper-left corner of dest. rectangle int nWidthDest, // width of destination rectangle int nHeightDest, // height of destination rectangle HDC hdcSrc, // handle to source device context int nXOriginSrc, // x-coordinate of upper-left corner of source rectangle int nYOriginSrc, // y-coordinate of upper-left corner of source rectangle int nWidthSrc, // width of source rectangle int nHeightSrc, // height of source rectangle DWORD dwRop // raster operation code ); Parameters hdcDest Handle to the destination device context. nXOriginDest Specifies the x-coordinate, in logical units, of the upper-left corner of the destination rectangle. nYOriginDest Specifies the y-coordinate, in logical units, of the upper-left corner of the destination rectangle. nWidthDest Specifies the width, in logical units, of the destination rectangle. nHeightDest Specifies the height, in logical units, of the destination rectangle. hdcSrc Handle to the source device context. nXOriginSrc Specifies the x-coordinate, in logical units, of the upper-left corner of the source rectangle. nYOriginSrc Specifies the y-coordinate, in logical units, of the upper-left corner of the source rectangle. nWidthSrc Specifies the width, in logical units, of the source rectangle. nHeightSrc Specifies the height, in logical units, of the source rectangle. dwRop Specifies the raster operation to be performed. Raster operation codes define how the system combines colors in output operations that involve a brush, a source bitmap, and a destination bitmap. See BitBlt for a list of common raster operation codes. Return Values If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. Windows NT: To get extended error information, callGetLastError. Remarks StretchBlt stretches or compresses the source bitmap in memory and then copies the result to the destination rectangle. The color data for pattern or destination pixels is merged after the stretching or compression occurs. When an enhanced metafile is being recorded, an error occurs (and the function returns FALSE) if the source device context identifies an enhanced-metafile device context. If the specified raster operation requires a brush, the system uses the brush currently selected into the destination device context. The destination coordinates are transformed by using the transformation currently specified for the destination device context; the source coordinates are transformed by using the transformation currently specified for the source device context. If the source transformation has a rotation or shear, an error occurs. If destination, source, and pattern bitmaps do not have the same color format, StretchBlt converts the source and pattern bitmaps to match the destination bitmap. If StretchBlt must convert a monochrome bitmap to a color bitmap, it sets white bits (1) to the background color and black bits (0) to the foreground color. To convert a color bitmap to a monochrome bitmap, it sets pixels that match the background color to white (1) and sets all other pixels to black (0). The foreground and background colors of the device context with color are used. StretchBlt creates a mirror image of a bitmap if the signs of the nWidthSrc and nWidthDest parameters or of the nHeightSrc and nHeightDest parameters differ. If nWidthSrc and nWidthDest have different signs, the function creates a mirror image of the bitmap along the x-axis. If nHeightSrc and nHeightDest have different signs, the function creates a mirror image of the bitmap along the y-axis. Not all devices support the StretchBlt function. For more information, see the GetDeviceCaps. ICM: No color management is performed when a blit operation occurs. Windows CE: Windows CE version 1.0 supports only the SRCCOPY and SRCINVERT raster operations. Windows CE version 1.0 does not support mirroring. This function is the same in Windows CE version 2.0 as it is in Windows desktop platforms. QuickInfo Windows NT: Requires version 3.1 or later. Windows: Requires Windows 95 or later. Windows CE: Requires version 1.0 or later. Header: Declared in wingdi.h. Import Library: Use gdi32.lib. See Also Bitmaps Overview, Bitmap Functions, BitBlt, GetDeviceCaps, MaskBlt, PlgBlt, SetStretchBltMode 参考MSDN98\SAMPLES\VC98\SDK\GRAPHICS\GDI\SHOWDIB\*.*
赵老师,感觉你那里例子代码很多呀,压个包,放共享里让我们下载下载吧
赵4老师 2014-07-09
  • 打赏
  • 举报
回复
引用 5 楼 palm_m 的回复:
[quote=引用 3 楼 zhao4zhong1 的回复:] StretchBlt The StretchBlt function copies a bitmap from a source rectangle into a destination rectangle, stretching or compressing the bitmap to fit the dimensions of the destination rectangle, if necessary. The system stretches or compresses the bitmap according to the stretching mode currently set in the destination device context. BOOL StretchBlt( HDC hdcDest, // handle to destination device context int nXOriginDest, // x-coordinate of upper-left corner of dest. rectangle int nYOriginDest, // y-coordinate of upper-left corner of dest. rectangle int nWidthDest, // width of destination rectangle int nHeightDest, // height of destination rectangle HDC hdcSrc, // handle to source device context int nXOriginSrc, // x-coordinate of upper-left corner of source rectangle int nYOriginSrc, // y-coordinate of upper-left corner of source rectangle int nWidthSrc, // width of source rectangle int nHeightSrc, // height of source rectangle DWORD dwRop // raster operation code ); Parameters hdcDest Handle to the destination device context. nXOriginDest Specifies the x-coordinate, in logical units, of the upper-left corner of the destination rectangle. nYOriginDest Specifies the y-coordinate, in logical units, of the upper-left corner of the destination rectangle. nWidthDest Specifies the width, in logical units, of the destination rectangle. nHeightDest Specifies the height, in logical units, of the destination rectangle. hdcSrc Handle to the source device context. nXOriginSrc Specifies the x-coordinate, in logical units, of the upper-left corner of the source rectangle. nYOriginSrc Specifies the y-coordinate, in logical units, of the upper-left corner of the source rectangle. nWidthSrc Specifies the width, in logical units, of the source rectangle. nHeightSrc Specifies the height, in logical units, of the source rectangle. dwRop Specifies the raster operation to be performed. Raster operation codes define how the system combines colors in output operations that involve a brush, a source bitmap, and a destination bitmap. See BitBlt for a list of common raster operation codes. Return Values If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. Windows NT: To get extended error information, callGetLastError. Remarks StretchBlt stretches or compresses the source bitmap in memory and then copies the result to the destination rectangle. The color data for pattern or destination pixels is merged after the stretching or compression occurs. When an enhanced metafile is being recorded, an error occurs (and the function returns FALSE) if the source device context identifies an enhanced-metafile device context. If the specified raster operation requires a brush, the system uses the brush currently selected into the destination device context. The destination coordinates are transformed by using the transformation currently specified for the destination device context; the source coordinates are transformed by using the transformation currently specified for the source device context. If the source transformation has a rotation or shear, an error occurs. If destination, source, and pattern bitmaps do not have the same color format, StretchBlt converts the source and pattern bitmaps to match the destination bitmap. If StretchBlt must convert a monochrome bitmap to a color bitmap, it sets white bits (1) to the background color and black bits (0) to the foreground color. To convert a color bitmap to a monochrome bitmap, it sets pixels that match the background color to white (1) and sets all other pixels to black (0). The foreground and background colors of the device context with color are used. StretchBlt creates a mirror image of a bitmap if the signs of the nWidthSrc and nWidthDest parameters or of the nHeightSrc and nHeightDest parameters differ. If nWidthSrc and nWidthDest have different signs, the function creates a mirror image of the bitmap along the x-axis. If nHeightSrc and nHeightDest have different signs, the function creates a mirror image of the bitmap along the y-axis. Not all devices support the StretchBlt function. For more information, see the GetDeviceCaps. ICM: No color management is performed when a blit operation occurs. Windows CE: Windows CE version 1.0 supports only the SRCCOPY and SRCINVERT raster operations. Windows CE version 1.0 does not support mirroring. This function is the same in Windows CE version 2.0 as it is in Windows desktop platforms. QuickInfo Windows NT: Requires version 3.1 or later. Windows: Requires Windows 95 or later. Windows CE: Requires version 1.0 or later. Header: Declared in wingdi.h. Import Library: Use gdi32.lib. See Also Bitmaps Overview, Bitmap Functions, BitBlt, GetDeviceCaps, MaskBlt, PlgBlt, SetStretchBltMode 参考MSDN98\SAMPLES\VC98\SDK\GRAPHICS\GDI\SHOWDIB\*.*
赵老师,感觉你那里例子代码很多呀,压个包,放共享里让我们下载下载吧[/quote] 可以先下载我的资源里面的源代码。
狂奔的Ant 2014-07-03
  • 打赏
  • 举报
回复
赵老师依旧这么霸气
赵4老师 2014-04-17
  • 打赏
  • 举报
回复
仅供参考
#include <windows.h>
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
    PAINTSTRUCT ps;
    HDC hdc;
    HFONT hfont,ohfont;
    RECT r;
    COLORREF oc;

    switch(message) {
    case WM_CLOSE://按Alt+F4退出
        PostQuitMessage(0);
        break;
    case WM_PAINT:
        BeginPaint(hWnd, &ps);
        hdc = ps.hdc; // the device context to draw in
        GetClientRect(hWnd, &r); // Obtain the window's client rectangle
        hfont = CreateFont(240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "华文楷体");
        ohfont=SelectObject(hdc,hfont);
        oc=SetTextColor(hdc,0x00C080FF);
        SetBkMode(hdc, TRANSPARENT);
        TextOut(hdc,r.left+r.right/2-720, r.top+r.bottom/2-120,"最短画图程序",12);
        SelectObject(hdc,ohfont);
        SetTextColor(hdc,oc);
        DeleteObject(hfont);
        EndPaint(hWnd, &ps);
        break;
    default:
        return DefWindowProc(hWnd, message, wParam, lParam);
    }
    return 0;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
    MSG msg             = {0};
    WNDCLASS wc         = {0};
    HBRUSH hbrh;
    hbrh=CreateSolidBrush(0x00000000);
    wc.lpfnWndProc      = WndProc;
    wc.hInstance        = hInstance;
    wc.hbrBackground    = hbrh;
    wc.lpszClassName    = "minwindowsapp";
    wc.hCursor          = LoadCursor(NULL,IDC_ARROW);
    if( FAILED(RegisterClass(&wc)) ) return 1;

    if(FAILED(CreateWindow(wc.lpszClassName,
                        "Minimal Windows Application",
                        WS_POPUP|WS_VISIBLE,
                        0,
                        0,
                        GetSystemMetrics(SM_CXSCREEN),
                        GetSystemMetrics(SM_CYSCREEN),
                        0,
                        0,
                        hInstance,
                        NULL)))
        return 2;

    while( GetMessage( &msg, NULL, 0, 0 ) > 0 ) {
        DispatchMessage( &msg );
    }
    DeleteObject(hbrh);
    return 0;
}
赵4老师 2014-04-17
  • 打赏
  • 举报
回复
StretchBlt The StretchBlt function copies a bitmap from a source rectangle into a destination rectangle, stretching or compressing the bitmap to fit the dimensions of the destination rectangle, if necessary. The system stretches or compresses the bitmap according to the stretching mode currently set in the destination device context. BOOL StretchBlt( HDC hdcDest, // handle to destination device context int nXOriginDest, // x-coordinate of upper-left corner of dest. rectangle int nYOriginDest, // y-coordinate of upper-left corner of dest. rectangle int nWidthDest, // width of destination rectangle int nHeightDest, // height of destination rectangle HDC hdcSrc, // handle to source device context int nXOriginSrc, // x-coordinate of upper-left corner of source rectangle int nYOriginSrc, // y-coordinate of upper-left corner of source rectangle int nWidthSrc, // width of source rectangle int nHeightSrc, // height of source rectangle DWORD dwRop // raster operation code ); Parameters hdcDest Handle to the destination device context. nXOriginDest Specifies the x-coordinate, in logical units, of the upper-left corner of the destination rectangle. nYOriginDest Specifies the y-coordinate, in logical units, of the upper-left corner of the destination rectangle. nWidthDest Specifies the width, in logical units, of the destination rectangle. nHeightDest Specifies the height, in logical units, of the destination rectangle. hdcSrc Handle to the source device context. nXOriginSrc Specifies the x-coordinate, in logical units, of the upper-left corner of the source rectangle. nYOriginSrc Specifies the y-coordinate, in logical units, of the upper-left corner of the source rectangle. nWidthSrc Specifies the width, in logical units, of the source rectangle. nHeightSrc Specifies the height, in logical units, of the source rectangle. dwRop Specifies the raster operation to be performed. Raster operation codes define how the system combines colors in output operations that involve a brush, a source bitmap, and a destination bitmap. See BitBlt for a list of common raster operation codes. Return Values If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. Windows NT: To get extended error information, callGetLastError. Remarks StretchBlt stretches or compresses the source bitmap in memory and then copies the result to the destination rectangle. The color data for pattern or destination pixels is merged after the stretching or compression occurs. When an enhanced metafile is being recorded, an error occurs (and the function returns FALSE) if the source device context identifies an enhanced-metafile device context. If the specified raster operation requires a brush, the system uses the brush currently selected into the destination device context. The destination coordinates are transformed by using the transformation currently specified for the destination device context; the source coordinates are transformed by using the transformation currently specified for the source device context. If the source transformation has a rotation or shear, an error occurs. If destination, source, and pattern bitmaps do not have the same color format, StretchBlt converts the source and pattern bitmaps to match the destination bitmap. If StretchBlt must convert a monochrome bitmap to a color bitmap, it sets white bits (1) to the background color and black bits (0) to the foreground color. To convert a color bitmap to a monochrome bitmap, it sets pixels that match the background color to white (1) and sets all other pixels to black (0). The foreground and background colors of the device context with color are used. StretchBlt creates a mirror image of a bitmap if the signs of the nWidthSrc and nWidthDest parameters or of the nHeightSrc and nHeightDest parameters differ. If nWidthSrc and nWidthDest have different signs, the function creates a mirror image of the bitmap along the x-axis. If nHeightSrc and nHeightDest have different signs, the function creates a mirror image of the bitmap along the y-axis. Not all devices support the StretchBlt function. For more information, see the GetDeviceCaps. ICM: No color management is performed when a blit operation occurs. Windows CE: Windows CE version 1.0 supports only the SRCCOPY and SRCINVERT raster operations. Windows CE version 1.0 does not support mirroring. This function is the same in Windows CE version 2.0 as it is in Windows desktop platforms. QuickInfo Windows NT: Requires version 3.1 or later. Windows: Requires Windows 95 or later. Windows CE: Requires version 1.0 or later. Header: Declared in wingdi.h. Import Library: Use gdi32.lib. See Also Bitmaps Overview, Bitmap Functions, BitBlt, GetDeviceCaps, MaskBlt, PlgBlt, SetStretchBltMode 参考MSDN98\SAMPLES\VC98\SDK\GRAPHICS\GDI\SHOWDIB\*.*
andong133 2014-04-17
  • 打赏
  • 举报
回复
[quote=引用 1 楼 zhao4zhong1 的回复:] 仅供参考[code=c]#include <windows.h> 有没有一个简单的API函数啊?主要目的就是全屏显示一张图片。谢谢你了
功能不比ACDSee弱 (1)以缩略图方式显示某一目录下所有图片文件。 (2)支持显示.txt .html文件并能够以语法高亮方式显示.pas文件(用Html和Xml技术分别实现)。 (3)软件界面任意组合,图片预览大小任意可调。 (4)以幻灯片方式(特技效果)显示某一目录下所有图片文件。 (5)放大、缩小及全屏显示图片。 (6)设置墙纸功能。 (7)打包生成html相册。 (8)图象编辑功能,包括:调整图片的亮度、对比度、饱和度,RGB调整,转换为灰度图及柔化、锐化、浮雕、雕刻、底片、曝光等多种滤镜。 (9)支持滤镜插件编程(目前能用Delphi和Borlan C++ builder开发)。 (10)提供打包功能。可以把任意目录下的所有图片文件打包成一个文件(*.ssp),并加密码予以保护。 (11)支持提取.exe和.dll文件中的图标。并且以缩略图方式显示。 5.主要技巧算法: (1)缩略图 实现原理:动态创建Tbitmap对象,设定大小并画上两个边框使其像一个panel,最后把按比例缩小后的图片bitblt于其上。 (2)语法高亮方式显示.pas文件 实现原理:该功能其实就是编译原理中的词法分析器所要实现的功能。针对不同的token予以不同的字体样式。 (3)打包生成html相册 实现原理:保存缩略图和原图片文件到指定目录,动态生成html文件。 (4)图象编辑功能 实现原理:有关图象处理方面的算法都是借鉴自一些书籍,详见附录。 (5)打包功能 实现原理:采用微软的结构化存储技术实现。 (6)滤镜插件 实现原理:定义滤镜接口函数,动态加载.dll文件
1.软件名称:ImageSee2.运行环境:Windows98及其更高版本。3.开发环境:Delphi6.04.主要功能说明: (1)以缩略图方式显示某一目录下所有图片文件。 (2)支持显示.txt .html文件并能够以语法高亮方式显示.pas文件(用Html和Xml技术分别实现)。 (3)软件界面任意组合,图片预览大小任意可调。 (4)以幻灯片方式(特技效果)显示某一目录下所有图片文件。 (5)放大、缩小及全屏显示图片。 (6)设置墙纸功能。 (7)打包生成html相册。 (8)图象编辑功能,包括:调整图片的亮度、对比度、饱和度,RGB调整,转换为灰度图及柔化、锐化、浮雕、雕刻、底片、曝光等多种滤镜。 (9)支持滤镜插件编程(目前能用Delphi和Borlan C++ builder开发)。 (10)提供打包功能。可以把任意目录下的所有图片文件打包成一个文件(*.ssp),并加密码予以保护。 (11)支持提取.exe和.dll文件中的图标。并且以缩略图方式显示。5.主要技巧算法: (1)缩略图 实现原理:动态创建Tbitmap对象,设定大小并画上两个边框使其像一个panel,最后把按比例缩小后的图片bitblt于其上。 (2)语法高亮方式显示.pas文件 实现原理:该功能其实就是编译原理中的词法分析器所要实现的功能。针对不同的token予以不同的字体样式。 (3)打包生成html相册 实现原理:保存缩略图和原图片文件到指定目录,动态生成html文件。 (4)图象编辑功能 实现原理:有关图象处理方面的算法都是借鉴自一些书籍,详见附录。 (5)打包功能 实现原理:采用微软的结构化存储技术实现。 (6)滤镜插件 实现原理:定义滤镜接口函数,动态加载.dll文件。6.版权说明: 本软件为作者独立开发完成,且未使用任何第三方控件,保留所有版权。7.附录 参考资料: 姚海根编著,《图象处理》,上海科学技术出版社,2000 张远鹏等著,《计算机图象处理技术基础》,北京大学出版社,1996 李兰友等编著,《Visual Basic 6图象处理开发与实例》,电子工业出版社,2000 Marco Cantu著,王辉等译,《Delphi 4从入门到精通》,电子工业出版社,1999 Eric Harmon著,陈旭等译,《Delphi COM 深入编程》,机械工业出版社,2000 David J.Kruglinski著,潘爱民等译,《Visual C++技术内幕》(第四版),1999 大富翁论坛,www.delphibbs.com efg计算机实验室,www.efg2.com community.borland.com
本软件为偶参加系里的一个软件设计大赛而写的, 然而,很遗憾,偶只拿到个第二名。 我发誓以后写软件我一定在界面上下最多的工夫! 请用delphi6.0分别编译四个工程,然后将生成的 .exe或.dll文件 放置同一目录就可以了。 任何人都可以随意复制,传播本软件。但若您修改了 其中的代码,我希望您能够寄给我一份。谢谢! 姜亮 2002.05.30于山东曲阜 jiangliang@163.com 保留所有版权。如果您对本程序有任何看法,欢迎来信交流。 ImageSee 1.0说明文档   --------------------------------------------------------------------------------     1.软件名称:ImageSee 2.运行环境:Windows98及其更高版本。 3.开发环境:Delphi6.0 4.主要功能说明:   (1)以缩略图方式显示某一目录下所有图片文件。   (2)支持显示.txt .html文件并能够以语法高亮方式显示.pas文件(用Html和Xml技术分别实现)。   (3)软件界面任意组合,图片预览大小任意可调。   (4)以幻灯片方式(特技效果)显示某一目录下所有图片文件。   (5)放大、缩小及全屏显示图片。   (6)设置墙纸功能。   (7)打包生成html相册。   (8)图象编辑功能,包括:调整图片的亮度、对比度、饱和度,RGB调整,转换为灰度图及柔化、锐化、浮雕、雕刻、底片、曝光等多种滤镜。   (9)支持滤镜插件编程(目前能用Delphi和Borlan C++ builder开发)。   (10)提供打包功能。可以把任意目录下的所有图片文件打包成一个文件(*.ssp),并加密码予以保护。   (11)支持提取.exe和.dll文件中的图标。并且以缩略图方式显示。 5.主要技巧算法:   (1)缩略图    实现原理:动态创建Tbitmap对象,设定大小并画上两个边框使其像一个panel,最后把按比例缩小后的图片bitblt于其上。   (2)语法高亮方式显示.pas文件    实现原理:该功能其实就是编译原理中的词法分析器所要实现的功能。针对不同的token予以不同的字体样式。   (3)打包生成html相册    实现原理:保存缩略图和原图片文件到指定目录,动态生成html文件。   (4)图象编辑功能    实现原理:有关图象处理方面的算法都是借鉴自一些书籍,详见附录。   (5)打包功能    实现原理:采用微软的结构化存储技术实现。   (6)滤镜插件    实现原理:定义滤镜接口函数,动态加载.dll文件。 6.版权说明:    本软件为作者独立开发完成,且未使用任何第三方控件,保留所有版权。 7.附录    参考资料:    姚海根编著,《图象处理》,上海科学技术出版社,2000    张远鹏等著,《计算机图象处理技术基础》,北京大学出版社,1996    李兰友等编著,《Visual Basic 6图象处理开发与实例》,电子工业出版社,2000    Marco Cantu著,王辉等译,《Delphi 4从入门到精通》,电子工业出版社,1999    Eric Harmon著,陈旭等译,《Delphi COM 深入编程》,机械工业出版社,2000    David J.Kruglinski著,潘爱民等译,《Visual C++技术内幕》(第四版),1999    大富翁论坛,www.delphibbs.com    efg计算机实验室,www.efg2.com    community.borland.com  

3,881

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 其它技术问题
社区管理员
  • 其它技术问题社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧