Struct winsafe::ResourceInfo[][src]

pub struct ResourceInfo { /* fields omitted */ }
Expand description

Retrieves data from an embedded resource, which can be read from an executable file or a DLL.

Examples

Reading version information:

use winsafe::{HINSTANCE, ResourceInfo};

let exe_name = HINSTANCE::NULL.GetModuleFileName()?;
let ri = ResourceInfo::read_from(&exe_name)?;

if let Some(ffi) = ri.fixed_file_info() {
    let ver = ffi.dwFileVersion();
    println!("Version: {}.{}.{}.{}",
        ver[0], ver[1], ver[2], ver[3]);
}

Reading information strings. An embedded resource can have multiple string blocks, and each block is identified by a language/code page pair. Each block can have their own information strings:

use winsafe::{HINSTANCE, ResourceInfo};

let exe_name = HINSTANCE::NULL.GetModuleFileName()?;
let ri = ResourceInfo::read_from(&exe_name)?;

if let Some(langs_cps) = ri.langs_and_code_pages() {
    for (lang, code_page) in langs_cps.iter() {

        if let Some(product_name) = ri.product_name(*lang, *code_page) {
            println!("Product name: {}", product_name);
        }

        if let Some(copyright) = ri.legal_copyright(*lang, *code_page) {
            println!("Copyright: {}", copyright);
        }

    }
}

Implementations

Reads and stores the resource data from an executable file or a DLL.

Returns the version information, if any.

Return the languages and code pages available in the resource.

Retrieves the version information string, if any.

Retrieves the version information string, if any.

Retrieves the version information string, if any.

Retrieves the version information string, if any.

Retrieves the version information string, if any.

Retrieves the version information string, if any.

Retrieves the version information string, if any.

Retrieves the version information string, if any.

Retrieves the version information string, if any.

Retrieves the version information string, if any.

Retrieves the version information string, if any.

Retrieves the version information string, if any.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.