Struct winsafe::HINSTANCE [−][src]
#[repr(C)]pub struct HINSTANCE { /* fields omitted */ }
Expand description
Handle to an
instance,
same as HMODULE
.
Implementations
Creates a new handle instance by wrapping a pointer.
This method is common to all handle types.
Consumes the handle returning the underlying raw pointer.
This method is common to all handle types.
Tells if the handle is invalid (null).
This method is common to all handle types.
CreateDialogParam
method.
DialogBoxParam
method.
EnumResourceLanguages
method.
EnumResourceNames
method.
EnumResourceTypes
method.
FindResource
method.
For an example, see
HINSTANCE::LockResource
.
FindResourceEx
method.
For an example, see
HINSTANCE::LockResource
.
FreeLibrary
method.
GetClassInfoEx
method.
Examples
Retrieving information of a window class created in our application:
use winsafe::{HINSTANCE, WNDCLASSEX};
let mut wcx = WNDCLASSEX::default();
HINSTANCE::GetModuleHandle(None)?
.GetClassInfoEx("SOME_CLASS_NAME", &mut wcx)?;
GetModuleFileName
method.
Examples
Retrieving the full path of currently running .exe file:
use winsafe::HINSTANCE;
let exe_name = HINSTANCE::NULL.GetModuleFileName()?;
println!("EXE: {}", exe_name);
GetModuleHandle
static method.
Examples
Retrieving current module instance:
use winsafe::HINSTANCE;
let hinstance = HINSTANCE::GetModuleHandle(None)?;
GetProcAddress
method.
LoadAccelerators
method.
LoadCursor
method.
Examples
Loading a system cursor:
use winsafe::{co, HINSTANCE, IdIdc};
let sys_cursor = HINSTANCE::default()
.LoadCursor(IdIdc::Idc(co::IDC::ARROW))?;
LoadLibrary
static method.
Note: Must be paired with an
HINSTANCE::FreeLibrary
call.
LoadResource
method.
For an example, see
HINSTANCE::LockResource
.
LoadString
method.
LockResource
method.
This method should belong to HRSRCMEM
, but in order
to make it safe, we automatically call
HINSTANCE::SizeofResource
, so it’s
implemented here.
Examples
The Updating Resources example:
use winsafe::{HINSTANCE, HUPDATERSRC, LANGID};
use winsafe::{co, IdStr, RtStr};
const IDD_HAND_ABOUTBOX: u16 = 103;
const IDD_FOOT_ABOUTBOX: u16 = 110;
let hExe = HINSTANCE::LoadLibrary("hand.exe")?;
let hRes = hExe.FindResource(
IdStr::Id(IDD_HAND_ABOUTBOX),
RtStr::Rt(co::RT::DIALOG),
)?;
let hResLoad = hExe.LoadResource(hRes)?;
let lpResLock = hExe.LockResource(hRes, hResLoad)?;
let hUpdateRes = HUPDATERSRC::BeginUpdateResource("foot.exe", false)?;
hUpdateRes.UpdateResource(
RtStr::Rt(co::RT::DIALOG),
IdStr::Id(IDD_FOOT_ABOUTBOX),
LANGID::new(co::LANG::NEUTRAL, co::SUBLANG::NEUTRAL),
lpResLock,
)?;
hUpdateRes.EndUpdateResource(false)?;
hExe.FreeLibrary()?;
SizeofResource
method.
For an example, see
HINSTANCE::LockResource
.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
Mutably borrows from an owned value. Read more