Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows-sys crate breaks native-windows-gui (GetWindowSubclass could not be found on .exe load) #251

Open
bmorin opened this issue May 23, 2022 · 3 comments

Comments

@bmorin
Copy link

bmorin commented May 23, 2022

I updated to the latest curl, which brought in schannel. schannel switched from winapi to windows-sys. windows-sys seems incompatible with native-windows-gui.

Was able to work around via adding the following to Cargo.toml:

# 0.1.20 broke native-windows-gui because it brings in windows-sys
schannel = "=0.1.19"
@githik999
Copy link

githik999 commented Jun 17, 2022

similar problems here.trying to make native-windows-gui work with mio-0.8.3

[dependencies] mio = {version = "0.8",features = ["os-poll", "net"]} native-windows-gui = "1.0" native-windows-derive = "1.0"

compile succeed but can not start.

(exit code: 0xc0000139, STATUS_ENTRYPOINT_NOT_FOUND)

the procedure entry point GetWindowSubclass could not be located in the dynamic link library

Update:

microsoft/windows-rs#1294

https://crates.io/crates/embed-resource

https://docs.microsoft.com/en-us/windows/win32/api/commctrl/nf-commctrl-getwindowsubclass

fixed by links above

@mbartlett21
Copy link

I've been using the embed-manifest crate for this:

https://crates.io/crates/embed-manifest

It's just a couple of functions that you add to your build.rs

@ryankopf
Copy link

ryankopf commented Mar 2, 2023

For those searching for this issue, the previous comments had the solution but it was quite a time to read them.

Add to your root dir:
appname.exe.manifest
appname-manifest.rc
build.rs

appname.exe.manifest

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
    version="1.0.0.0"
    processorArchitecture="*"
    name="app"
    type="win32"
/>
<dependency>
    <dependentAssembly>
        <assemblyIdentity
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0"
            processorArchitecture="*"
            publicKeyToken="6595b64144ccf1df"
            language="*"
        />
    </dependentAssembly>
</dependency>
</assembly>

appname-manifest.rc

#define RT_MANIFEST 24
1 RT_MANIFEST "aiapp.exe.manifest"

build.rs

extern crate embed_resource;
fn main() {
    embed_resource::compile("aiapp-manifest.rc");
}

Add to your Cargo


[build-dependencies]
embed-resource = "1.8"

Note: it's a BUILD dep, not a regular dependancy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants