Comments (3)
Actually it was more complicated than that... we also must consider the 3 OEM resource flags: OBM
, OIC
and OCR
. This demanded 3 new specific enums to deal with the 3 possibilities: ID, string or OEM resource. Which gives us 9 different possibilities.
I made a quick test and it seems to be correct and working now.
let hicon = HINSTANCE::NULL.LoadImageIcon(
IdOicStr::from_str("C:\\Temp\\foo.ico"),
SIZE::new(16, 16),
co::LR::LOADFROMFILE,
)?;
hicon.DestroyIcon()?; // don't forget this one!
Let me know if this works for you.
from winsafe.
Quick tip: IdOicStr
enum has a from_str()
constructor, so you don't need to construct the WString
explicitly:
IdOicStr::from_str("C:\\Temp\\foo.ico")
from winsafe.
Works perfectly!
let h_icon = HINSTANCE::NULL
.LoadImageIcon(
IdOicStr::Str(WString::from_str(
"C:\\Temp\\foo.ico",
)),
SIZE::new(16, 16),
LR::LOADFROMFILE,
)
.unwrap();
let window = gui::WindowMain::new(gui::WindowMainOpts {
class_icon: gui::Icon::Handle(h_icon),
..Default::default()
});
from winsafe.
Related Issues (20)
- Cannot infer type HOT 2
- File Open Dialog is broken (Segmentation Fault, etc.) HOT 2
- Null value for bind_ctx HOT 1
- Add support for IEnumShellItems HOT 3
- [0.0.11] Example from readme fails with Ordinal not found error HOT 2
- set background color of a label HOT 3
- There's SetClipboardData but not GetClipboardData yet? HOT 1
- HKEY::QueryValueEx and GetValue contain race conditions and lack length-versus-type checking
- Copyable handles are probably unsound HOT 8
- RegOpenKeyEx doesnโt work
- Transacted registry API and related transaction create/commit/rollback API
- RegQueryMultipleValuesW support
- Feature request: tab control HOT 5
- Way to instantiate an arbitrary control when using gui HOT 5
- Circular reference via event handlers causes memory leak HOT 2
- WebView2 control HOT 1
- HWDP guard does not handle changed handles nor failures correctly
- Reg{Create,Open}KeyTransacted should take transaction by reference HOT 1
- Feature request: MONITORINFOEX struct
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from winsafe.