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)) ;

LoadIcon的使用的更多相关文章

  1. LoadIcon

    1.LoadIcon(HINSTANCE hInstance,LPCSTR lpIconName);该函数从与 hInstance 模块相关联的可执行文件中装入lpIconName指定的图标资源,仅当 ...

  2. loadicon后一定要调用destroyicon吗

    Remarks It is only necessary to call DestroyIcon for icons and cursors created with the following fu ...

  3. C++ 最小化到托盘

    #define WM_SHOWTASK (WM_USER + 1) void CTestDlg::OnSysCommand(UINT nID, LPARAM lParam) { if ((nID &a ...

  4. Windows API 函数列表 附帮助手册

    所有Windows API函数列表,为了方便查询,也为了大家查找,所以整理一下贡献出来了. 帮助手册:700多个Windows API的函数手册 免费下载 API之网络函数 API之消息函数 API之 ...

  5. 【Windows编程】系列第六篇:创建Toolbar与Statusbar

    上一篇我们学习了解了如何使用Windows GDI画图,该应用程序都是光光的静态窗口,我们使用Windows应用程序,但凡稍微复杂一点的程序都会有工具栏和状态栏,工具栏主要用于一些快捷功能按钮.比如典 ...

  6. 局域网象棋游戏(C++实现,使用Socket,界面使用Win32,CodeBlocks+GCC编译)

    目录 成果 运行效果图 过程 1. 首先的问题是下棋的两端应该是什么样的? 2. 接下来的问题是怎么表示,怎么存储? 3. 然后应该怎么通信呢? 代码 main.cpp chinese_chess.h ...

  7. Android 系统工具类SystemUtils

    包含的功能有: 获取系统中所有APP应用.获取用户安装的APP应用.根据包名和Activity启动类查询应用信息.跳转到WIFI设置.WIFI网络开关.移动网络开关.GPS开关 当前若关则打开 当前若 ...

  8. MFC2016.6.8

    1.theApp extern声明之后不可以使用?可以用,只是需要extern之后的类名和类名称写对,不要犯得低级错误.2.怎样取出列表控件中的第某列的值?GetItemText(); CListCt ...

  9. [Android Pro] Android异步任务处理之AsyncTaskLoader的使用

    reference to : http://blog.csdn.net/happy_horse/article/details/51518280 最近项目中涉及到加载本地的地名.db文件,数据量大,自 ...

随机推荐

  1. 「洛谷P3469」[POI2008]BLO-Blockade 解题报告

    P3469[POI2008]LO-Blockade 题意翻译 在Byteotia有n个城镇. 一些城镇之间由无向边连接. 在城镇外没有十字路口,尽管可能有桥,隧道或者高架公路(反正不考虑这些).每两个 ...

  2. Using TFRecords and tf.Example

    -----这篇其实是TensorFlow的官方tutorials,由于没有翻译,笔者姑且翻译一下,用来日后思考.------- 原址:https://www.tensorflow.org/tutori ...

  3. 微信公众号 唤醒手机导航APP 一看就懂 复制即用

    公司自研发框架,基本上没啥看不懂的 基本都是直接复制用就好了!希望能帮助到需要的朋友! 新建俩个同级文件用来保存 jsapi_ticket 和 access_token的文件 命名:jsapi_tic ...

  4. Java代码调用Shell脚本并传入参数实现DB2数据库表导出到文件

    本文通过Java代码调用Shell脚本并传入参数实现DB2数据库表导出到文件,代码如下: import java.io.File; import java.io.IOException; import ...

  5. 网络流 - 最大流构图入门 bzoj 1305

    一次舞会有n个男孩和n个女孩.每首曲子开始时,所有男孩和女孩恰好配成n对跳交谊舞.每个男孩都不会和同一个女孩跳两首(或更多)舞曲.有一些男孩女孩相互喜欢,而其他相互不喜欢(不会“单向喜欢”).每个男孩 ...

  6. 初识 ST 表

    推荐博客 : https://blog.csdn.net/BerryKanry/article/details/70177006 ST表通常用于RMQ问题中,询问某个区间的最值这类问题中 ST表的核心 ...

  7. String中文字符转码

    如何使用String构造方法和String.getBytes()做好中文字符转码 @Test public void test() { String testStr = "中"; ...

  8. JVM内存布局及GC知识

    一.JVM运行时内存布局 按java 8虚拟机规范的原始表达:(jvm)Run-Time Data Areas, 暂时翻译为"jvm运行时内存布局". 从概念上大致分为6个(逻辑) ...

  9. IDEA工具java开发之 代码生成Generate

    ◆生成set/get ◆生成构造函数 ◆生成toString ◆生成hashCodes和equals

  10. 在ubuntu18.04下搭建kvm

    前一段时间一直在尝试Ubuntu上搭建xen,一直出现各种问题,各种坑 首先先感谢下面这个公司对我的耐心解答,非常感谢.特别是后面来的电话对我进行了详细的解答,所以选择搭建kvm. 1. 需要检查一下 ...