zoukankan      html  css  js  c++  java
  • 【原创】把D3D画面渲染到桌面!不用创建任何窗口

       其实这个很简单,只是创建设备的时候那个hwnd有点不一样!
       可能有人就会说,用GetDesktopWindows()获得桌面的句柄不就行了?那就错了!这样会没有效果的!正确的代码如下:

        HWND hWnd  =  FindWindowEx(GetDesktopWindow() ,  0  ,  " Progman "  ,  " Program Manager " );
        hWnd 
    =  FindWindowEx(hWnd ,  0  ,  " SHELLDLL_DefView "  ,  0 );
        hWnd 
    =  FindWindowEx(hWnd ,  0  ,  " SysListView32 "  ,  " FolderView " );
        
    //  初始化 D3D 设备
        InitD3D(hWnd);


    是不是很简单!哈哈。

    显示的时候,如果想渲染在桌面的一角,则可以这样写:
    // 显示在左上角,128×128宽
            RECT rect;
            rect.left 
    = 0;
            rect.right 
    = 128;
            rect.top 
    = 0;
            rect.bottom 
    = 128;
            
    // 显示
            g_pd3dDevice->Present(0 , &rect , 0 , 0);


  • 相关阅读:
    android Serializable 和 Parcelable 区别
    Android HttpClient 用法以及乱码解决
    android 头像选择以及裁剪
    播放动画
    跑马灯效果
    Paint基本属性
    安卓开发中的各种事件
    View类和surfaceView详细介绍
    hadoop资源
    wsdl文件转换为java
  • 原文地址:https://www.cnblogs.com/flying_bat/p/877264.html
Copyright © 2011-2022 走看看