gabdube / native-windows-gui

A light windows GUI toolkit for rust
https://gabdube.github.io/native-windows-gui/
MIT License
1.93k stars 125 forks source link

The procedure entry point "GetWindowSubclass" could not be located #282

Open fkusche opened 7 months ago

fkusche commented 7 months ago

I am getting a message box saying

The procedure entry point "GetWindowSubclass" could not be located in the dynamic link library MY_RUST_PROGRAM.EXE

This seems to happen, when another create pulls the crate windows-targets in. Which is something, that for example current versions of chrono do.

Here is a sample program to reproduce:

use chrono;

fn main() {
    nwg::init().expect("Failed to init Native Windows GUI");
    let mut _name_edit: nwg::TextInput = Default::default();
    println!("Hello, world!")
}

And the corresponding Cargo.toml:

[package]
name = "rust-nwg-error"
version = "0.1.0"
edition = "2021"

[dependencies]
chrono = "=0.4.27"
nwg = {version = "^1.0.13", package = "native-windows-gui", default-features = false, features = ["no-styling"]}

When I run this, I immediately get the message box.

However if I either lower the chrono version to "0.4.26" or if I just remove the use chrono; in the program, the hello world message is printed.

chrono versions 0.4.27 and newer depend on windows-targets. That's why I suspect it has something to do with that crate (and not chrono itself).

fkusche commented 7 months ago

Looks like this is a duplicate to https://github.com/gabdube/native-windows-gui/issues/251

I swear I searched the issues for GetWindowSubclass - looks like I mistyped it