Icons in Win32

VC++多线程控制动态图标:Win32 API实现与线程同步详解 多线程编程是提升桌面应用响应性和用户体验的核心技术,其原理在于将耗时任务与用户界面操作分离到不同执行流,避免主线程阻塞导致的界面卡顿。在Windows平台,通过Win32 API的CreateThread函数创建工作线程,结合事件、临界区等同步机制,可以实现高效的后台任务处理。这一技术对于需要实时反馈的应用场景价值显著,例如文件传输、数据计算或网络请求过程中的状态指示。本文聚焦于利用VC++和Win32线程模型,实现一个由工作线程驱动的动态图标控件,详细解析了从线程创建、自定义消息通信到双缓冲绘图消除闪烁的 阅读详情

Icons in Win32

 

John Hornick
Microsoft Corporation

Created: September 29, 1995

John is a Support Engineer in Product Support Services, Windows Developer Support.

Download 4493.exe.

Abstract

This article describes, in detail, the format and use of icons in 32-bit Windows. The following topics are covered; the format of icon resources in ICO, DLL and EXE files, the format of icon images in memory, Windows' use of icons, Windows' selection of an icon image from an icon resource, and the APIs provided to manipulate icon images. To follow the discussion, the reader should be familiar with Device Independent Bitmaps (DIBs) and their format. For more information about DIBs, please refer to the following sources:

  • Platform SDK help for the BITMAPINFO structure
  • Knowledge Base article Q81498 SAMPLE: DIBs and Their Uses
  • Knowledge Base article Q94326 SAMPLE: 16 and 32 Bits-Per-Pel Bitmap Formats

Sample code dealing with some of the topics in this article is available in the Platform SDK sample tree in the IconPro project.

Disclaimer    Internal details discussed in this article are subject to change without notice in future versions of Windows.

Introduction

Icons are a varied lot—they come in many sizes and color depths. A single icon resource—an ICO file, or an icon resource in an EXE or DLL file—can contain multiple icon images, each with a different size and/or color depth. Windows 95 and future versions of Windows NT (collectively referred to as "Windows" from here on) extract the appropriate size/color depth image from the resource depending on the context of the icon's use. Windows also provides a collection of APIs for accessing and displaying icons and icon images.

What's in an Icon?

An icon resource can contain multiple icon images. For example, one icon resource—in this case, a single .ICO file—can contain images in several sizes and color depths:

16 x 16  16 colors32 x 32  16 colors72 x 72  256 colors

The ICO File

An Icon file, which usually has the ICO extension, contains one icon resource. Given that an icon resource can contain multiple images, it is no surprise that the file begins with an icon directory:

typedef struct
{
    WORD           idReserved;   // Reserved (must be 0)
    WORD           idType;       // Resource Type (1 for icons)
    WORD           idCount;      // How many images?
    ICONDIRENTRY   idEntries[1]; // An entry for each image (idCount of 'em)
} ICONDIR, *LPICONDIR;

The idCount member indicates how many images are present in the icon resource. The size of the idEntries array is determined by idCount. There exists one ICONDIRENTRY for each icon image in the file, providing details about its location in the file, size and color depth. The ICONDIRENTRY structure is defined as:

typedef struct
{
    BYTE        bWidth;          // Width, in pixels, of the image
    BYTE        bHeight;         // Height, in pixels, of the image
    BYTE        bColorCount;     // Number of colors in image (0 if >=8bpp)
    BYTE        bReserved;       // Reserved ( must be 0)
    WORD        wPlanes;         // Color Planes
    WORD        wBitCount;       // Bits per pixel
    DWORD       dwBytesInRes;    // How many bytes in this resource?
    DWORD       dwImageOffset;   // Where in the file is this image?
} ICONDIRENTRY, *LPICONDIRENTRY;

For each ICONDIRENTRY, the file contains an icon image. The dwBytesInRes member indicates the size of the image data. This image data can be found dwImageOffset bytes from the beginning of the file, and is stored in the following format:

typdef struct
{
   BITMAPINFOHEADER   icHeader;      // DIB header
   RGBQUAD         icColors[1];   // Color table
   BYTE            icXOR[1];      // DIB bits for XOR mask
   BYTE            icAND[1];      // DIB bits for AND mask
} ICONIMAGE, *LPICONIMAGE;

The icHeader member has the form of a DIB BITMAPINFOHEADER. Only the following members are used: biSize, biWidth, biHeight, biPlanes, biBitCount, biSizeImage. All other members must be 0. The biHeight member specifies the combined height of the XOR and AND masks. The members of icHeader define the contents and sizes of the other elements of the ICONIMAGE structure in the same way that the BITMAPINFOHEADER structure defines a CF_DIB format DIB.

The icColors member is an array of RGBQUADs. The number of elements in this array is determined by examining the icHeader member.

The icXOR member contains the DIB bits for the XOR mask of the image. The number of bytes in this array is determined by examining the icHeader member. The XOR mask is the color portion of the image and is applied to the destination using the XOR operation after the application of the AND mask.

The icAND member contains the bits for the monochrome AND mask. The number of bytes in this array is determined by examining the icHeader member, and assuming 1bpp. The dimensions of this bitmap must be the same as the dimensions of the XOR mask. The AND mask is applied to the destination using the AND operation, to preserve or remove destination pixels before applying the XOR mask.

Note    The biHeight member of the icHeader structure represents the combined height of the XOR and AND masks. Remember to divide this number by two before using it to perform calculations for either of the XOR or AND masks. Also remember that the AND mask is a monochrome DIB, with a color depth of 1 bpp.

The following is an incomplete code fragment for reading an .ICO file:

// We need an ICONDIR to hold the data
pIconDir = malloc( sizeof( ICONDIR ) );
// Read the Reserved word
ReadFile( hFile, &(pIconDir->idReserved), sizeof( WORD ), &dwBytesRead, NULL );
// Read the Type word - make sure it is 1 for icons
ReadFile( hFile, &(pIconDir->idType), sizeof( WORD ), &dwBytesRead, NULL );
// Read the count - how many images in this file?
ReadFile( hFile, &(pIconDir->idCount), sizeof( WORD ), &dwBytesRead, NULL );
// Reallocate IconDir so that idEntries has enough room for idCount elements
pIconDir = realloc( pIconDir, ( sizeof( WORD ) * 3 ) +
                              ( sizeof( ICONDIRENTRY ) * pIconDir->idCount ) );
// Read the ICONDIRENTRY elements
ReadFile( hFile, pIconDir->idEntries, pIconDir->idCount * sizeof(ICONDIRENTRY),
          &dwBytesRead, NULL );
// Loop through and read in each image
for(i=0;i<pIconDir->idCount;i++)
{
  // Allocate memory to hold the image
  pIconImage = malloc( pIconDir->idEntries[i].dwBytesInRes );
  // Seek to the location in the file that has the image
  SetFilePointer( hFile, pIconDir->idEntries[i].dwImageOffset, 
                  NULL, FILE_BEGIN );
  // Read the image data
  ReadFile( hFile, pIconImage, pIconDir->idEntries[i].dwBytesInRes,
            &dwBytesRead, NULL );
  // Here, pIconImage is an ICONIMAGE structure. Party on it :)
  // Then, free the associated memory
  free( pIconImage );
}
// Clean up the ICONDIR memory
free( pIconDir );

Complete code can be found in the Icons.C module of IconPro, in a function named ReadIconFromICOFile.

DLL and EXE Files

Icons can also be stored in .DLL and .EXE files. The structures used to store icon images in .EXE and .DLL files differ only slightly from those used in .ICO files.

Analogous to the ICONDIR data in the ICO file is the RT_GROUP_ICON resource. In fact, one RT_GROUP_ICON resource is created for each ICO file bound to the EXE or DLL with the resource compiler/linker. The RT_GROUP_ICON resource is simply a GRPICONDIR structure:

// #pragmas are used here to insure that the structure's
// packing in memory matches the packing of the EXE or DLL.
#pragma pack( push )
#pragma pack( 2 )
typedef struct 
{
   WORD            idReserved;   // Reserved (must be 0)
   WORD            idType;       // Resource type (1 for icons)
   WORD            idCount;      // How many images?
   GRPICONDIRENTRY   idEntries[1]; // The entries for each image
} GRPICONDIR, *LPGRPICONDIR;
#pragma pack( pop )

The idCount member indicates how many images are present in the icon resource. The size of the idEntries array is determined by idCount. There exists one GRPICONDIRENTRY for each icon image in the resource, providing details about its size and color depth. The GRPICONDIRENTRY structure is defined as:

#pragma pack( push )
#pragma pack( 2 )
typedef struct
{
   BYTE   bWidth;               // Width, in pixels, of the image
   BYTE   bHeight;              // Height, in pixels, of the image
   BYTE   bColorCount;          // Number of colors in image (0 if >=8bpp)
   BYTE   bReserved;            // Reserved
   WORD   wPlanes;              // Color Planes
   WORD   wBitCount;            // Bits per pixel
   DWORD   dwBytesInRes;         // how many bytes in this resource?
   WORD   nID;                  // the ID
} GRPICONDIRENTRY, *LPGRPICONDIRENTRY;
#pragma pack( pop )

The dwBytesInRes member indicates the total size of the RT_ICON resource referenced by the nID member. nID is the RT_ICON identifier that can be passed to FindResource, LoadResource and LockResource to obtain a pointer to the ICONIMAGE structure (defined above) for this image.

The following is an incomplete code fragment for reading icons from a .DLL or .EXE file:

// Load the DLL/EXE without executing its code
hLib = LoadLibraryEx( szFileName, NULL, LOAD_LIBRARY_AS_DATAFILE );
// Find the group resource which lists its images
hRsrc = FindResource( hLib, MAKEINTRESOURCE( nId ), RT_GROUP_ICON );
// Load and Lock to get a pointer to a GRPICONDIR
hGlobal = LoadResource( hLib, hRsrc );
lpGrpIconDir = LockResource( hGlobal );
// Using an ID from the group, Find, Load and Lock the RT_ICON
hRsrc = FindResource( hLib, MAKEINTRESOURCE( lpGrpIconDir->idEntries[0].nID ),
                      RT_ICON );
hGlobal = LoadResource( hLib, hRsrc );
lpIconImage = LockResource( hGlobal );
// Here, lpIconImage points to an ICONIMAGE structure

Complete code can be found in the Icons.C module of IconPro, in a function named ReadIconFromEXEFile.

In Memory

When dealing with icon resources in memory, the format is identical to the format used in .EXE and .DLL files. APIs such as CreateIconFromResource expect to be passed an ICONIMAGE structure. This is very convenient since FindResource, LoadResource and LockResource can be used to load the RT_ICON resource in that format.

An HICON handle is a handle to a single icon image, or RT_ICON resource. In previous versions of Windows, the size of an HICON image could be determined by calling GetSystemMetrics with the SM_CYICON and SM_CXICON flags. It is now possible, however, to have HICON handles for icons with non-standard sizes. HICON icons always have the same color format as the display device. See the discussion of APIs below for more details on how to handle icons of different sizes and color depths using HICON handles.

When in Windows

In Windows, the system maintains the concept of two sizes of icons, small and large. Further, the shell also has a concept of small and large icons. This means that in total, Windows is aware of four different icon sizes—System Small, System Large, Shell Small, and Shell Large.

The System Small size is derived from the size of window captions. The caption size can be adjusted from the "Appearance" tab in the Display Properties dialog. Adjustments made to the caption size are immediately reflected in the System Small icon size. The System Small size can be queried by calling GetSystemMetrics with the SM_CXSMICON and SM_CYSMICON parameters.

The System Large size is defined by the video driver and therefore cannot be changed dynamically. The System Large size can be queried by calling GetSystemMetrics with the SM_CXICON and SM_CYICON parameters.

The Shell Small size is defined by Windows, and currently Windows does not support changing this value, nor is there currently a direct way to query this value.

The Shell Large size is stored in the registry under the following key:

HKEY_CURRENT_USER/Control Panel/desktop/WindowMetrics/Shell Icon Size

The Shell Large size can be changed by modifying the registry or from the "Appearance" tab in the Display Properties dialog, which allows values from 16 to 72. Following is an example of code that can be used to change the Shell Large icon size by accessing the registry:

DWORD SetShellLargeIconSize( DWORD dwNewSize )
{
   #define MAX_LENGTH   512
   DWORD   dwOldSize, dwLength = MAX_LENGTH, dwType = REG_SZ;
   TCHAR   szBuffer[MAX_LENGTH];
   HKEY   hKey;

   // Get the Key
   RegOpenKey( HKEY_CURRENT_USER, "Control Panel//desktop//WindowMetrics",                   &hKey);
   // Save the last size
   RegQueryValueEx( hKey, "Shell Icon Size", NULL, &dwType, szBuffer, 
               &dwLength );
   dwOldSize = atol( szBuffer );
   // We will allow only values >=16 and <=72
   if( (dwNewSize>=16) || (dwNewSize<=72) )
   {
      wsprintf( szBuffer, "%d", dwNewSize );
      RegSetValueEx( hKey, "Shell Icon Size", 0, REG_SZ, szBuffer,
                  lstrlen(szBuffer) + 1 );
   }
   // Clean up
   RegCloseKey( hKey );
   // Let everyone know that things changed
   SendMessage( HWND_BROADCAST, WM_SETTINGCHANGE, SPI_SETICONMETRICS,
               (LPARAM)("WindowMetrics") );
   return dwOldSize;
   #undef MAX_LENGTH
}

Table 1. Where Windows Uses Different Sized Icons

LocationIcon Size
DesktopShell Large
TitleBar of WindowsSystem Small
<Alt><Tab> DialogSystem Large
Start MenuShell Small / Shell Large

While Windows imposes no restrictions on the sizes of icons, common sizes include 16, 32, and 48 pixels square. For this reason, developers are encouraged to include a minimum of the following sizes and color depths in their icon resources:

16 x 1616 colors
32 x 3216 colors
48 x 48256 colors

Choosing an Icon

When Windows prepares to display an icon, a desktop shortcut for example, it must parse the .EXE or .DLL file and extract the appropriate icon image. This selection is a two step process starting with the selection of the appropriate RT_GROUP_ICON resource, and ending with the selection of the proper RT_ICON image from that RT_GROUP_ICON.

Which Icon?

If an .EXE or .DLL file has only one RT_GROUP_ICON resource, the first step is trivial; Windows simply uses that resource. However, if more than one such group resource exists in the file, Windows must decide which one to use. Windows NT simply chooses the first resource listed in the application's RC script. On the other hand, Windows 95's algorithm is to choose the alphabetically first named group icon if one exists. If one such group resource does not exist, Windows chooses the icon with the numerically lowest identifier. So, to be sure that a particular icon is used for an application, the developer should insure that both of the following criteria are met:

  1. The icon is placed before all other icons in the RC file.
  2. If the icon is named, its name is alphabetically before any other named icon, otherwise its resource identifier is numerically smaller than any other icon.
Which Image?

Once an RT_GROUP_ICON is chosen, the individual icon image, or RT_ICON resource, must be selected and extracted. Again, if there exists only one RT_ICON resource for the group in question, the choice is trivial. However, if multiple images are present in the group, the following selection rules are applied:

  1. The image closest in size to the requested size is chosen.
  2. If two or more images of that size are present, the one that matches the color depth of the display is chosen.
  3. If none exactly match the color depth of the display, Windows chooses the image with the greatest color depth without exceeding the color depth of the display.
  4. If all the size-matched images exceed the color depth of the display, the one with the lowest color depth is chosen.
  5. Windows treats all color depths of 8 or more bpp as equal. For example, it is pointless to have a 16x16 256 color image and a 16x16 16bpp image in the same resource—Windows will simply choose the first one it encounters.
  6. When the display is in 8bpp mode, Windows will prefer a 16 color icon over a 256 color icon, and will display all icons using the system default palette.

APIs

When dealing with icons, the developer can choose to manipulate the raw resource bytes, or let Windows handle the low level details and simply use HICON handles. The advantage of handling the raw resource bytes is a gain in control, while the advantage of using the HICON handles is that of simplicity. For most purposes, the HICON interface is sufficient—it is likely that handling the raw resource bytes will be necessary only in the development of an icon handling program.

Raw Resource Bytes

The standard Windows API functions for manipulating resources—FindResource, LoadResource and LockResource—can, of course, be used to handle icon resources.

EnumResourceNames can be used, passing in RT_GROUP_ICON, to find the available group icon resources. Once the appropriate group resource is chosen, it can be loaded using FindResource, LoadResource and LockResource. This will yield a pointer to a GRPICONDIR structure.

The idEntries array is the searched for a match on the desired color depth and size. The nID member of that array element is then used as an argument to FindResource, passing in RT_ICON. LoadResource and LockResource then yield a pointer to an ICONIMAGE structure for that icon image.

To allow Windows to perform the color depth and size selection, the GRPICONDIR structure can be passed to LookUpIconIdFromDirectory or LookUpIconIdFromDirectoryEx. Both of these functions return an id that can be used with RT_ICON and FindResource, the latter providing a way to specify a desired size to match against.

The ICONIMAGE structure contains pointers to the DIB bits for the masks. These pointers can be used in DIB functions for direct manipulation. The ICONIMAGE structure is also conveniently suitable to be passed to CreateIconFromResource or CreateIconFromResourceEx to yield an HICON handle. The former of the two functions creates an icon that is System Large size. The latter provides a way to specify a desired size, and Windows performs the appropriate conversions.

HICON Handles

An HICON handle is a handle to a single icon image. This is analogous to a single RT_ICON resource. The image is stored internally using device dependent bitmaps (DDBs). This implies that all HICON icons have the same color format as the display device. The size of the icon depends on its origin and the system defined icon sizes.

The available icon handling functions can be thought of in two groups—those that handle System Large size icons and those that handle any size icons. The functions that handle only System Large size icons are typically left over from 16 bit days, when the system defined only one icon size. The newer functions, those that handle any size icon, accept as a parameter the desired size of the icon.

One Size Fits All

The original icon handling functions were designed for a system that defined only one icon size. Therefore, most of those functions are unaware of the possibility of more than one icon size and assume all icons are System Large size.

LoadIcon, ExtractIcon and DrawIcon fall into this category. LoadIcon and ExtractIcon always search for a match for System Large size. If an exact match cannot be found, these two functions stretch the closest match to that size. They always return an icon of System Large size. Similarly, DrawIcon always draws the icon at System Large size. If a different size icon is passed to DrawIcon, it is stretched and displayed at System Large size.

CreateIconFromResource also exhibits this behavior. It returns a handle to a System Large size icon, stretching the RT_ICON resource it was passed as necessary.

To Each Their Own

Now that Windows has the ability to handle different sized icons, new API functions were added to handle them. In some cases, old functions were expanded and "Ex" was added to their name. In other cases, whole new functions were added. The net result is that there is now full support for different sized icons in the Windows API.

Several different functions are available to get an HICON handle to a different sized icon. LoadImage can be used to extract an icon from an EXE or DLL file without the hassle of manually loading the resource bytes. CreateIconFromResourceEx is available if the resource bytes have been loaded.

CreateIcon and CreateIconIndirect, even though they have their roots in 16-bit land, do facilitate creating icons of different sizes. CreateIcon accept a desired width and height as parameters, while CreateIconIndirect creates an icon based on the bitmaps in the ICONINFO parameter. Note that both of these functions work with DDBs, not DIBs.

SHGetFileInfo can also be used to get icons from files, providing the icon that the shell would display for the file. SHGetFileInfo works on any type of file, and can extract any of the four icons sizes, as shown below:

// Load a System Large icon image
SHGetFileInfo( szFileName, 0, &shfi, sizeof( SHFILEINFO ), 
               SHGFI_ICON | SHGFI_LARGEICON);

// Load a System Small icon image
SHGetFileInfo( szFileName, 0, &shfi, sizeof( SHFILEINFO ), 
               SHGFI_ICON | SHGFI_SMALLICON);

// Load a Shell Large icon image
SHGetFileInfo( szFileName, 0, &shfi, sizeof( SHFILEINFO ), 
               SHGFI_ICON | SHGFI_SHELLICONSIZE);

// Load a Shell Small icon image
SHGetFileInfo( szFileName, 0, &shfi, sizeof( SHFILEINFO ), 
               SHGFI_ICON | SHGFI_SHELLICONSIZE | SHGFI_SMALLICON);

Given an HICON handle, DrawIconEx can be used to display it—at its normal size, at the System Large size, or at any other size:

// Draw it at its native size
DrawIconEx( hDC, nLeft, nTop, hIcon, 0, 0, 0, NULL, DI_NORMAL );

// Draw it at the System Large size
DrawIconEx( hDC, nLeft, nTop, hIcon, 0, 0, 0, 
            NULL, DI_DEFAULTSIZE | DI_NORMAL );

// Draw it at some other size (40x40 in this example)
DrawIconEx( hDC, nLeft, nTop, hIcon, 40, 40, 0, NULL, DI_NORMAL );

Note that DrawIconEx will stretch the icon as necessary to make it fit the desired output size.

What's in There?

The Win32 API provides a function for determining the characteristics of an icon, given its HICON handle. This function is GetIconInfo. GetIconInfo fills out an ICONINFO structure with the information pertaining to the HICON. The ICONINFO structure contains the following information:

typedef struct _ICONINFO { // ii  

   BOOL    fIcon;   // TRUE for icon, FALSE for cursor
   DWORD   xHotspot;   // the x hotspot coordinate for cursor
   DWORD   yHotspot;   // the y hotspot coordinate for cursor
   HBITMAP hbmMask;   // handle to monochrome AND mask bitmap
   HBITMAP hbmColor;   // handle to device dependent XOR mask bitmap
} ICONINFO;

Given this information, an application can calculate the information needed to write the icon to a file. The AND mask and XOR mask DIB bits can be obtained with calls to GetDIBits on the two bitmaps in this structure.

A Word on Cursors

Cursors, in Win32, are very similar to icons. In fact, by changing only one line in the source code for IconPro, that sample can read .CUR files. IconPro currently tests the idType member of the ICONDIR structure to make sure the file is an icon file. This check can be relaxed to allow the type for cursors (2) as well. Also, HCURSOR handles can be used interchangeably with HICON handles in most Win32 icon APIs.

Conclusion

Although the icon specification has long been able to handle icons of odd sizes and color depths, only recently has Windows responded with inherent support for such images. Developers now have the option of dealing directly with the bits of an icon, or allowing Windows to handle all the details. Windows even provides API support for loading and displaying icons of non-standard sizes and different color depths.

QT应用图标设置保姆级教程:从ico制作到pro配置,一次搞定不踩坑 本文提供QT应用图标设置的保姆级教程,涵盖从ico制作到pro配置的全流程,重点解决RC_ICONS配置、图标显示异常等常见问题。通过专业工具链操作、多平台适配方案和构建系统深度解析,帮助开发者高效完成图标集成,提升应用专业度。 阅读详情

相关推荐

Qt :设置应用的图标

设置应用程序图标

Mr.Sugarcane 381

已知HICON,如何将其保存为图标文件?以及ICO文件的格式

void CCsdn9Dlg::OnOK() {    // TODO: Add extra validation here    //CreateStreamOnHGlobal    //IPicture::Save    LPBYTE lpBits=NULL;    long size=0;    HICON hicon=LoadIcon(AfxGetInstanceHandle(),MAKE

邓学彬(泪闯天涯)的专栏 4435

【ROS】usb_cam相机标定

1. 唠叨两句 当我们要用相机做测量用途时,就需要做相机标定了,不然得到的计算结果会有很大误差,标定的内容包括三部分:内参,外参还有畸变参数。所以标定的过程就是要求得上面这些参数。 以前弄这个事估计挺麻烦,需要做实验和计算才能得到,现在通过ros的开源包几分钟就能完成相机标定,感激! 具体的内外参和畸变系数的说明,可以看看Reference里面的第一个链接,写得很详细。 2. 准备工作 要准备三样东西: usb_cam的ROS启动包 相机标定的ROS包 还有一个用于标定的棋盘格 1)usb_cam启动包

Will_Ye的博客 8206

c语言源文件保存后的图标,如何实现提取并保存图标资源

当你想要使用别的应用程序中的漂亮图标时,该怎么办呢?也许就会用到一些图标提取工具吧!那么,你知道它们是怎么实现的,想不想自己动手也做一个适合自己的图标提取工具呢?下面,就让我用我以前做过的一个工具<轻轻松松抓图标>来告诉你吧!它可以提取各种文件中的图标资源,并可将其保存为图标(ICO)、位图(BMP)两种格式。程序运行后界面如下:图一在上面的例程中,我整合出一个图标类CIcons和与之相配的一个位...

weixin_33916124的博客 927

HDMI端口辐射(EMI)超标解决方案

HDMI端口辐射(EMI)超标解决方案 一、HDMI EMC设计要求: 1、HDMI EMC设计原理图 ( 图 一 ) 2、HDMI元件选型及参数说明:(图一所示) a.L510、L511、L512、L513使用专业EMI共模滤波器(普通共模电感寄生电容太大,会导致TMDS差分阻抗匹配测试失败),阻抗值为90Ω~100Ω(两路共模滤波器型号:CMF1210DH900MFR;四路共模滤波器型号:CMF2010DH101MFR), b.U1、U2为排式ESD(ESD排型号:ESD0524PA),越低的结电容

ltqdxl的博客 1万+

量化爬虫第一步:手把手教你搞定同花顺问财的hexin-v参数(附JS逆向实战)

本文详细介绍了如何通过JS逆向技术破解同花顺问财数据接口的核心加密参数hexin-v,构建稳定可靠的量化数据采集方案。从抓包分析到Cookie Hook技术应用,再到环境补全与参数生成实现,手把手教你完成量化爬虫的第一步。文章还提供了实战注意事项与优化建议,帮助开发者规避常见问题。

weixin_42620202的博客 304

Icons

本文详细介绍了Windows中图标的格式和使用。涵盖以下主题;ICO、DLL和EXE文件中图标资源的格式,内存中图标图像的格式,Windows对图标的使用,Windows从图标资源中选择图标图像,以及操作图标图像所提供的API。为了跟上讨论,读者应该熟悉设备无关位图(DIB)及其格式。有关DIB的更多信息,请参考以下来源: BITMAPINFO结构的文档 知识库文章Q81498示例:DIB及其使用 知识库文章Q94326示例:每像素16位和32位位图格式。............

jxlzw的专栏 732

拉曼光谱仪的原理与应用——TFN 7G F660手持式拉曼光谱识别仪

拉曼光谱仪的原理与应用——TFN 7G F660手持式拉曼光谱识别仪

TFN_yzgd的博客 928

convert from HICON to file

come from http://www.vckbase.com/vckbase/vckbase12/vc/nonctrls/gdi_17/1217001.htm//h#pragma pack( push )#pragma pack( 2 )typedef struct{ BYTE bWidth;               // Width of the image BYTE bHeig

stwstw0123的专栏 1126

把 ABAP 选择屏幕 Selection Screen 打造成可维护的交互面板:常用屏幕元素与动态控制全解析

本文详细介绍了ABAP报表中Selection Screen的设计技巧,包括空行(SKIP)、横线(ULINE)、注释(COMMENT)等基础元素的使用方法,以及如何通过MODIF ID实现动态界面调整。重点讲解了行内布局(BEGIN OF LINE)、按钮(PUSHBUTTON)和区块(BLOCK)等高级功能,帮助开发者将选择屏幕从"能用"提升到"好用、易扩展、可维护"的水平。文章还分享了项目实践中的命名规范和分组策略,特别适合需要优化ABAP报表用户体验的开发人员

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 332

【100%通过率】华为od机试C卷【贪吃的猴子】Java&Go 实现

一只贪吃的猴子,来到一个果园,发现许多串香蕉排成一行,每串香蕉上有若干根香蕉。每串香蕉的根数由数组numbers给出。猴子获取香蕉,每次都只能从行的开头或者未尾获取,并且只能获取N次,求猴子最多能获取多少根香蕉。第一次获取香蕉为行的开头,第二次获取为行的末尾,因此最终根数为4+3 =7。全部获取所有的香蕉,因此最终根数为1+2+3 = 6。第二行为数组numbers的值每个数字通过空格分开。1:简单题目,两个指针分别指向头尾,逐个对比即可。第一行为数组numbers的长度。第三行输入为N,表示获取的次数。

MISAYAONE的博客 1439

icons in win32

icons in win32   john hornick  microsoft corporation created: september 29, 1995 download the iconpro sample. abstract this article describes, in detail, the format and use of icons in 32-bit

pud_zha的专栏 676

计算机组成原理(第三版)唐朔飞-第九章控制单元的功能-课后习题

计算机组成原理(第三版)唐朔飞-第九章控制单元的功能-课后习题

weixin_45735391的博客 4万+

Obtaining (and managing) file and folder icons using SHGetFileInfo in C#

Introduction This article is based upon code from the MSDN Cold Rooster Consulting case study. Included in part of the CRC Rich Client is support for file icons, something I wanted to do mysel...

djww42001的博客 177

CUDA&PCL 点云体素下采样

CUDA&PCL 点云体素下采样

dayuhaitang1的博客 1268

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

Retrieve Icons Associated To An Extension

[python-win32] Retrieve Icons Associated To An Extension?Mark Hammond mhammond at skippinet.com.au Wed Mar 30 00:08:54 CEST 2005 Previous message: [python-win32] Retrieve Ico

795

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

two_icons.cpp

  #include   #include "Two_Icons.h" #if defined (WIN32) #define IS_WIN32 TRUE#else #define IS_WIN32 FALSE#endif#define IS_NT      IS_WIN32 && (BOOL)(GetVersion() #define IS_WIN32S  IS_WIN32 && (BO

CCodes的专栏 553

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

Adding Icons to the System Tray

Download demo project (inc. CE 2.0 project) - 145.1 Kb Download Non-MFC demo project - 43.4 Kb Download source files - 22.6 Kb Example images in W

1919

QT应用图标设置保姆级教程:从ico获取到pro配置,一次搞定不踩坑

本文提供QT应用图标设置的完整教程,从ICO文件生成到pro配置,详细解析RC_ICONS方法与资源文件方法的优劣,并附赠疑难排查手册与高级技巧,助你一次搞定不踩坑。特别推荐使用ImageMagick生成多尺寸ICO文件,确保图标在不同场景下清晰显示。

weixin_30596023的博客 266

TaskbarX:让Windows任务栏图标居中,附带42种动画效果

TaskbarX是一款面向Windows 10的任务栏图标居中工具,把平时挤在屏幕左侧的任务栏图标搬到屏幕中间,并提供40多种动画效果供你挑选。不用写代码,配置一下即可生效。 ## 为什么需要它 Windows 10的任务栏图标天生靠左停靠,宽屏下显得头重脚轻;开一个窗口、关一个窗口,图标还会直接跳位,生硬又突兀。想要Mac式的居中dock布局,系统默认又给不了。TaskbarX就是补这个短板

gitblog_00491的博客 716

window_manager跨平台支持:Linux、macOS与Windows窗口管理实现对比

**window_manager** 是 Flutter 桌面应用开发中不可或缺的窗口管理插件,它为开发者提供了统一的 API 来控制和管理应用程序窗口。无论你是在开发 Linux、macOS 还是 Windows 平台的桌面应用,这个插件都能帮助你轻松实现跨平台的窗口管理功能。本文将深入探讨 window_manager 在三大主流桌面操作系统上的实现差异,帮助你更好地理解和使用这个强大的工具。

gitblog_01060的博客 311

Qt 5.12.9 项目文件*.pro 解析:3个关键配置项与跨平台编译实战

本文深入解析Qt 5.12.9项目文件*.pro的三大关键配置项(QT模块、CONFIG标志、TARGET定义)及其在跨平台编译中的实战应用。通过详细的代码示例和配置技巧,帮助开发者高效管理Qt项目构建过程,实现多平台兼容性优化和第三方库集成,提升开发效率。

weixin_34025151的博客 333

CenterTaskbar源码解析:深入理解Windows任务栏操作原理

CenterTaskbar是一款能够帮助Windows用户将任务栏图标居中显示的实用工具,它通过动态计算和调整任务栏图标的位置,实现了在不同显示设置和多显示器环境下的图标居中效果。本文将深入解析CenterTaskbar的核心工作原理,带你了解如何通过Windows API和自动化技术实现任务栏图标的精确控制。 ## 项目架构概览 CenterTaskbar采用C#开发,基于Windows F

gitblog_00091的博客 402
上一篇: 如何将32 x 32像素图标转换为16 x 16像素值的图标
下一篇: Icon Browser: An Exercise in Resource Management
普通网友
博客等级 码龄22年 1万+粉丝 3156原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值