zoukankan      html  css  js  c++  java
  • LoadIcon的使用

    LoadIcon

    msdn:

    Loads the specified icon resource from the executable (.exe) file associated with an application instance.


    Syntax

    HICON WINAPI LoadIcon(
      _In_opt_  HINSTANCE hInstance,
      _In_      LPCTSTR lpIconName
    );
    

    Parameters

    hInstance [in, optional]

    Type: HINSTANCE

    A handle to an instance of the module whose executable file contains the icon to be loaded. This parameter must be NULL when a standard icon is being loaded.

    lpIconName [in]

    Type: LPCTSTR

    The name of the icon resource to be loaded. Alternatively, this parameter can contain the resource identifier in the low-order word and zero in the high-order word. Use the MAKEINTRESOURCE macro to create this value.

    To use one of the predefined icons, set the hInstance parameter to NULL and the lpIconName parameter to one of the following values.


    在初始化时,我们可以这样使用:

    wndclass.hIcon         = LoadIcon (NULL, IDI_APPLICATION) ;

    使用系统预定义图标,必须把第一个参数设置为NULL.

    相应的显示:


    另外,我们也可以使用自定义的图标:

    用到MAKEINTRESOURCE宏

    MAKEINTRESOURCE 

    Converts an integer value to a resource type compatible with the resource-management functions. This macro is used in place of a string containing the name of the resource.

    Syntax

    LPTSTR MAKEINTRESOURCE(
      WORD wInteger
    );
    
    

    Parameters

    wInteger

    The integer value to be converted.

    说说使用:

    在VS2012下的Resource View下的项目添加ICO文件,它会生成ID号,默认的IDI_ICON1.


    引入resource.h

    修改如下:

    wndclass.hIcon         = LoadIcon (hInstance, MAKEINTRESOURCE(IDI_ICON1)) ;



    Keep it simple!
    作者:N3verL4nd
    知识共享,欢迎转载。
  • 相关阅读:
    返回到上一页的html代码的几种写法
    记一次网站服务器内存占用过多问题
    rpm命令数据库修复日志
    Linux vmstat命令实战详解
    innodb的innodb_buffer_pool_size和MyISAM的key_buffer_size
    mysql
    如何查看linux系统下的各种日志文件 linux 系统日志的分析大全
    /var/lock/subsys作用
    CentOS目录结构详解
    MySQL体系结构
  • 原文地址:https://www.cnblogs.com/lgh1992314/p/5834913.html
Copyright © 2011-2022 走看看