/// <summary>Loads an icon.</summary> /// <param name="hinst"> /// A handle to the module of either a DLL or executable (.exe) that contains the image to be loaded. For more information, see /// GetModuleHandle. Note that as of 32-bit Windows, an instance handle (HINSTANCE), such as the application instance handle exposed /// by system function call of WinMain, and a module handle (HMODULE) are the same thing. /// <para>To load an OEM image, set this parameter to NULL.</para> /// <para>To load a stand-alone resource (icon, cursor, or bitmap file)—for example, c:\myimage.bmp—set this parameter to NULL.</para> /// </param> /// <param name="lpszName"> /// The image to be loaded. If the hinst parameter is non-NULL and the fuLoad parameter omits LR_LOADFROMFILE, lpszName specifies the /// image resource in the hinst module. If the image resource is to be loaded by name from the module, the lpszName parameter is a /// pointer to a null-terminated string that contains the name of the image resource. If the image resource is to be loaded by /// ordinal from the module, use the MAKEINTRESOURCE macro to convert the image ordinal into a form that can be passed to the /// LoadImage function. For more information, see the Remarks section below. /// <para> /// If the hinst parameter is NULL and the fuLoad parameter omits the LR_LOADFROMFILE value, the lpszName specifies the OEM image to load. /// </para> /// <para> /// To pass these constants to the LoadImage function, use the MAKEINTRESOURCE macro. For example, to load the OCR_NORMAL cursor, /// pass MAKEINTRESOURCE(OCR_NORMAL) as the lpszName parameter, NULL as the hinst parameter, and LR_SHARED as one of the flags to the /// fuLoad parameter. /// </para> /// <para> /// If the fuLoad parameter includes the LR_LOADFROMFILE value, lpszName is the name of the file that contains the stand-alone /// resource (icon, cursor, or bitmap file). Therefore, set hinst to NULL. /// </para> /// </param> /// <param name="cxDesired"> /// The width, in pixels, of the icon or cursor. If this parameter is zero and the fuLoad parameter is LR_DEFAULTSIZE, the function /// uses the SM_CXICON or SM_CXCURSOR system metric value to set the width. If this parameter is zero and LR_DEFAULTSIZE is not used, /// the function uses the actual resource width. /// </param> /// <param name="cyDesired"> /// The height, in pixels, of the icon or cursor. If this parameter is zero and the fuLoad parameter is LR_DEFAULTSIZE, the function /// uses the SM_CYICON or SM_CYCURSOR system metric value to set the height. If this parameter is zero and LR_DEFAULTSIZE is not /// used, the function uses the actual resource height. /// </param> /// <param name="fuLoad">Loading options.</param> /// <returns> /// If the function succeeds, the return value is the handle of the newly loaded image. If the function fails, the return value is /// NULL.To get extended error information, call GetLastError. /// </returns> public static SafeHICON LoadImage_Icon(HINSTANCE hinst, SafeResourceId lpszName, int cxDesired, int cyDesired, LoadImageOptions fuLoad) => new SafeHICON(LoadImage(hinst, lpszName, LoadImageType.IMAGE_ICON, cxDesired, cyDesired, fuLoad), true);
/// <summary>Loads a cursor or animated cursor.</summary> /// <param name="hinst"> /// A handle to the module of either a DLL or executable (.exe) that contains the image to be loaded. For more information, see /// GetModuleHandle. Note that as of 32-bit Windows, an instance handle (HINSTANCE), such as the application instance handle exposed /// by system function call of WinMain, and a module handle (HMODULE) are the same thing. /// <para>To load an OEM image, set this parameter to NULL.</para> /// <para>To load a stand-alone resource (icon, cursor, or bitmap file)—for example, c:\myimage.bmp—set this parameter to NULL.</para> /// </param> /// <param name="lpszName"> /// The image to be loaded. If the hinst parameter is non-NULL and the fuLoad parameter omits LR_LOADFROMFILE, lpszName specifies the /// image resource in the hinst module. If the image resource is to be loaded by name from the module, the lpszName parameter is a /// pointer to a null-terminated string that contains the name of the image resource. If the image resource is to be loaded by /// ordinal from the module, use the MAKEINTRESOURCE macro to convert the image ordinal into a form that can be passed to the /// LoadImage function. For more information, see the Remarks section below. /// <para> /// If the hinst parameter is NULL and the fuLoad parameter omits the LR_LOADFROMFILE value, the lpszName specifies the OEM image to load. /// </para> /// <para> /// To pass these constants to the LoadImage function, use the MAKEINTRESOURCE macro. For example, to load the OCR_NORMAL cursor, /// pass MAKEINTRESOURCE(OCR_NORMAL) as the lpszName parameter, NULL as the hinst parameter, and LR_SHARED as one of the flags to the /// fuLoad parameter. /// </para> /// <para> /// If the fuLoad parameter includes the LR_LOADFROMFILE value, lpszName is the name of the file that contains the stand-alone /// resource (icon, cursor, or bitmap file). Therefore, set hinst to NULL. /// </para> /// </param> /// <param name="cxDesired"> /// The width, in pixels, of the icon or cursor. If this parameter is zero and the fuLoad parameter is LR_DEFAULTSIZE, the function /// uses the SM_CXICON or SM_CXCURSOR system metric value to set the width. If this parameter is zero and LR_DEFAULTSIZE is not used, /// the function uses the actual resource width. /// </param> /// <param name="cyDesired"> /// The height, in pixels, of the icon or cursor. If this parameter is zero and the fuLoad parameter is LR_DEFAULTSIZE, the function /// uses the SM_CYICON or SM_CYCURSOR system metric value to set the height. If this parameter is zero and LR_DEFAULTSIZE is not /// used, the function uses the actual resource height. /// </param> /// <param name="fuLoad">Loading options.</param> /// <returns> /// If the function succeeds, the return value is the handle of the newly loaded image. If the function fails, the return value is /// NULL.To get extended error information, call GetLastError. /// </returns> public static SafeHCURSOR LoadImage_Cursor(HINSTANCE hinst, SafeResourceId lpszName, int cxDesired, int cyDesired, LoadImageOptions fuLoad) => new SafeHCURSOR(LoadImage(hinst, lpszName, LoadImageType.IMAGE_CURSOR, cxDesired, cyDesired, fuLoad), true);
/// <summary>Loads an enhanced metafile.</summary> /// <param name="hinst"> /// A handle to the module of either a DLL or executable (.exe) that contains the image to be loaded. For more information, see /// GetModuleHandle. Note that as of 32-bit Windows, an instance handle (HINSTANCE), such as the application instance handle exposed /// by system function call of WinMain, and a module handle (HMODULE) are the same thing. /// <para>To load an OEM image, set this parameter to NULL.</para> /// <para>To load a stand-alone resource (icon, cursor, or bitmap file)—for example, c:\myimage.bmp—set this parameter to NULL.</para> /// </param> /// <param name="lpszName"> /// The image to be loaded. If the hinst parameter is non-NULL and the fuLoad parameter omits LR_LOADFROMFILE, lpszName specifies the /// image resource in the hinst module. If the image resource is to be loaded by name from the module, the lpszName parameter is a /// pointer to a null-terminated string that contains the name of the image resource. If the image resource is to be loaded by /// ordinal from the module, use the MAKEINTRESOURCE macro to convert the image ordinal into a form that can be passed to the /// LoadImage function. For more information, see the Remarks section below. /// <para> /// If the hinst parameter is NULL and the fuLoad parameter omits the LR_LOADFROMFILE value, the lpszName specifies the OEM image to load. /// </para> /// <para> /// To pass these constants to the LoadImage function, use the MAKEINTRESOURCE macro. For example, to load the OCR_NORMAL cursor, /// pass MAKEINTRESOURCE(OCR_NORMAL) as the lpszName parameter, NULL as the hinst parameter, and LR_SHARED as one of the flags to the /// fuLoad parameter. /// </para> /// <para> /// If the fuLoad parameter includes the LR_LOADFROMFILE value, lpszName is the name of the file that contains the stand-alone /// resource (icon, cursor, or bitmap file). Therefore, set hinst to NULL. /// </para> /// </param> /// <param name="cxDesired"> /// The width, in pixels, of the icon or cursor. If this parameter is zero and the fuLoad parameter is LR_DEFAULTSIZE, the function /// uses the SM_CXICON or SM_CXCURSOR system metric value to set the width. If this parameter is zero and LR_DEFAULTSIZE is not used, /// the function uses the actual resource width. /// </param> /// <param name="cyDesired"> /// The height, in pixels, of the icon or cursor. If this parameter is zero and the fuLoad parameter is LR_DEFAULTSIZE, the function /// uses the SM_CYICON or SM_CYCURSOR system metric value to set the height. If this parameter is zero and LR_DEFAULTSIZE is not /// used, the function uses the actual resource height. /// </param> /// <param name="fuLoad">Loading options.</param> /// <returns> /// If the function succeeds, the return value is the handle of the newly loaded image. If the function fails, the return value is /// NULL.To get extended error information, call GetLastError. /// </returns> public static SafeHENHMETAFILE LoadImage_EnhMetaFile(HINSTANCE hinst, SafeResourceId lpszName, int cxDesired, int cyDesired, LoadImageOptions fuLoad) => new SafeHENHMETAFILE(LoadImage(hinst, lpszName, LoadImageType.IMAGE_ENHMETAFILE, cxDesired, cyDesired, fuLoad), true);
/// <summary>Loads a bitmap.</summary> /// <param name="hinst"> /// A handle to the module of either a DLL or executable (.exe) that contains the image to be loaded. For more information, see /// GetModuleHandle. Note that as of 32-bit Windows, an instance handle (HINSTANCE), such as the application instance handle exposed /// by system function call of WinMain, and a module handle (HMODULE) are the same thing. /// <para>To load an OEM image, set this parameter to NULL.</para> /// <para>To load a stand-alone resource (icon, cursor, or bitmap file)—for example, c:\myimage.bmp—set this parameter to NULL.</para> /// </param> /// <param name="lpszName"> /// The image to be loaded. If the hinst parameter is non-NULL and the fuLoad parameter omits LR_LOADFROMFILE, lpszName specifies the /// image resource in the hinst module. If the image resource is to be loaded by name from the module, the lpszName parameter is a /// pointer to a null-terminated string that contains the name of the image resource. If the image resource is to be loaded by /// ordinal from the module, use the MAKEINTRESOURCE macro to convert the image ordinal into a form that can be passed to the /// LoadImage function. For more information, see the Remarks section below. /// <para> /// If the hinst parameter is NULL and the fuLoad parameter omits the LR_LOADFROMFILE value, the lpszName specifies the OEM image to load. /// </para> /// <para> /// To pass these constants to the LoadImage function, use the MAKEINTRESOURCE macro. For example, to load the OCR_NORMAL cursor, /// pass MAKEINTRESOURCE(OCR_NORMAL) as the lpszName parameter, NULL as the hinst parameter, and LR_SHARED as one of the flags to the /// fuLoad parameter. /// </para> /// <para> /// If the fuLoad parameter includes the LR_LOADFROMFILE value, lpszName is the name of the file that contains the stand-alone /// resource (icon, cursor, or bitmap file). Therefore, set hinst to NULL. /// </para> /// </param> /// <param name="cxDesired"> /// The width, in pixels, of the icon or cursor. If this parameter is zero and the fuLoad parameter is LR_DEFAULTSIZE, the function /// uses the SM_CXICON or SM_CXCURSOR system metric value to set the width. If this parameter is zero and LR_DEFAULTSIZE is not used, /// the function uses the actual resource width. /// </param> /// <param name="cyDesired"> /// The height, in pixels, of the icon or cursor. If this parameter is zero and the fuLoad parameter is LR_DEFAULTSIZE, the function /// uses the SM_CYICON or SM_CYCURSOR system metric value to set the height. If this parameter is zero and LR_DEFAULTSIZE is not /// used, the function uses the actual resource height. /// </param> /// <param name="fuLoad">Loading options.</param> /// <returns> /// If the function succeeds, the return value is the handle of the newly loaded image. If the function fails, the return value is /// NULL.To get extended error information, call GetLastError. /// </returns> public static SafeHBITMAP LoadImage_Bitmap(HINSTANCE hinst, SafeResourceId lpszName, int cxDesired, int cyDesired, LoadImageOptions fuLoad) => new SafeHBITMAP(LoadImage(hinst, lpszName, LoadImageType.IMAGE_BITMAP, cxDesired, cyDesired, fuLoad), true);
public static extern IntPtr LoadImage(HINSTANCE hinst, SafeResourceId lpszName, LoadImageType uType, int cxDesired, int cyDesired, LoadImageOptions fuLoad);
public static extern IntPtr LoadImage(SafeLibraryHandle hinst, SafeResourceId lpszName, LoadImageType uType, int cxDesired, int cyDesired, LoadImageOptions fuLoad);
public static extern HRESULT TaskDialog(HWND hwndParent, HINSTANCE hInstance, string pszWindowTitle, string pszMainInstruction, string pszContent, TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons, SafeResourceId pszIcon, out int pnButton);
public static extern bool UpdateResource([In] HUPDRES hUpdate, SafeResourceId lpType, SafeResourceId lpName, ushort wLanguage, [In] IntPtr lpData, uint cbData);