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

No SetWindowLongPtrW in user32 #18

Closed
uranusjr opened this issue Nov 17, 2016 · 3 comments
Closed

No SetWindowLongPtrW in user32 #18

uranusjr opened this issue Nov 17, 2016 · 3 comments
Labels

Comments

@uranusjr
Copy link

uranusjr commented Nov 17, 2016

I tried compiling the library with the hello world program, but could not get past compiling native-windows-gui v0.1.0. There are multiple errors, but they seem to boil down to one specific problem: unable to import GetWindowLongPtrW and SetWindowLongPtrW from user32.

I’m running Rust 1.13.0 MSVC on Windows 7 (32-bit) with C++ Build Tools (as advised on rustlang.org) and Windows 8 API installed.

(Sorry if this is a dumb problem; I’m not familiar at all with Windows.)

   Compiling native-windows-gui v0.1.0
     Running `rustc C:\Users\uranusjr\.cargo\registry\src\github.com-1ecc6299db9ec823\native-windows-gui-0.1.0\src\lib.rs --crate-name native_windows_gui --crate-type lib -g -C metadata=7fc996e319240eae -C extra-filename=-7fc996e319240eae --out-dir C:\Users\uranusjr\Desktop\pepsi-nsis-builder\target\debug\deps --emit=dep-info,link -L dependency=C:\Users\uranusjr\Desktop\pepsi-nsis-builder\target\debug\deps --extern kernel32=C:\Users\uranusjr\Desktop\pepsi-nsis-builder\target\debug\deps\libkernel32-509fa9765cc5df81.rlib --extern user32=C:\Users\uranusjr\Desktop\pepsi-nsis-builder\target\debug\deps\libuser32-5ec5fd1838282aa7.rlib --extern winapi=C:\Users\uranusjr\Desktop\pepsi-nsis-builder\target\debug\deps\libwinapi-cadf002e62789fde.rlib --extern comctl32=C:\Users\uranusjr\Desktop\pepsi-nsis-builder\target\debug\deps\libcomctl32-974ac6e60a832e8e.rlib --cap-lints allow`
error[E0432]: unresolved import `user32::SetWindowLongPtrW`
  --> C:\Users\uranusjr\.cargo\registry\src\github.com-1ecc6299db9ec823\native-windows-gui-0.1.0\src\controls\base\helper.rs:42:14
   |
42 | use user32::{SetWindowLongPtrW, GetWindowLongPtrW, EnumChildWindows, ShowWindow,
   |              ^^^^^^^^^^^^^^^^^ no `SetWindowLongPtrW` in `user32`. Did you mean to use `SetWindowLongW`?

error[E0432]: unresolved import `user32::GetWindowLongPtrW`
  --> C:\Users\uranusjr\.cargo\registry\src\github.com-1ecc6299db9ec823\native-windows-gui-0.1.0\src\controls\base\helper.rs:42:33
   |
42 | use user32::{SetWindowLongPtrW, GetWindowLongPtrW, EnumChildWindows, ShowWindow,
   |                                 ^^^^^^^^^^^^^^^^^ no `GetWindowLongPtrW` in `user32`. Did you mean to use `GetWindowLongW`?

error[E0432]: unresolved import `user32::SetWindowLongPtrW`
  --> C:\Users\uranusjr\.cargo\registry\src\github.com-1ecc6299db9ec823\native-windows-gui-0.1.0\src\controls\base/mod.rs:33:31
   |
33 | use user32::{CreateWindowExW, SetWindowLongPtrW, GetWindowLongPtrW, DestroyWindow, EnumChildWindows};
   |                               ^^^^^^^^^^^^^^^^^ no `SetWindowLongPtrW` in `user32`. Did you mean to use `SetWindowLongW`?

error[E0432]: unresolved import `user32::GetWindowLongPtrW`
  --> C:\Users\uranusjr\.cargo\registry\src\github.com-1ecc6299db9ec823\native-windows-gui-0.1.0\src\controls\base/mod.rs:33:50
   |
33 | use user32::{CreateWindowExW, SetWindowLongPtrW, GetWindowLongPtrW, DestroyWindow, EnumChildWindows};
   |                                                  ^^^^^^^^^^^^^^^^^ no `GetWindowLongPtrW` in `user32`. Did you mean to use `GetWindowLongW`?

error[E0432]: unresolved import `user32::GetWindowLongPtrW`
   --> C:\Users\uranusjr\.cargo\registry\src\github.com-1ecc6299db9ec823\native-windows-gui-0.1.0\src\controls\textinput.rs:141:5
    |
141 | use user32::GetWindowLongPtrW;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^ no `GetWindowLongPtrW` in `user32`. Did you mean to use `GetWindowLongW`?

error[E0432]: unresolved import `user32::GetWindowLongPtrW`
   --> C:\Users\uranusjr\.cargo\registry\src\github.com-1ecc6299db9ec823\native-windows-gui-0.1.0\src\controls\textbox.rs:123:5
    |
123 | use user32::GetWindowLongPtrW;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^ no `GetWindowLongPtrW` in `user32`. Did you mean to use `GetWindowLongW`?

error: aborting due to 6 previous errors

error: Could not compile `native-windows-gui`.

Caused by:
  process didn't exit successfully: `rustc C:\Users\uranusjr\.cargo\registry\src\github.com-1ecc6299db9ec823\native-windows-gui-0.1.0\src\lib.rs --crate-name native_windows_gui --crate-type lib -g -C metadata=7fc996e319240eae -C extra-filename=-7fc996e319240eae --out-dir C:\Users\uranusjr\Desktop\pepsi-nsis-builder\target\debug\deps --emit=dep-info,link -L dependency=C:\Users\uranusjr\Desktop\pepsi-nsis-builder\target\debug\deps --extern kernel32=C:\Users\uranusjr\Desktop\pepsi-nsis-builder\target\debug\deps\libkernel32-509fa9765cc5df81.rlib --extern user32=C:\Users\uranusjr\Desktop\pepsi-nsis-builder\target\debug\deps\libuser32-5ec5fd1838282aa7.rlib --extern winapi=C:\Users\uranusjr\Desktop\pepsi-nsis-builder\target\debug\deps\libwinapi-cadf002e62789fde.rlib --extern comctl32=C:\Users\uranusjr\Desktop\pepsi-nsis-builder\target\debug\deps\libcomctl32-974ac6e60a832e8e.rlib --cap-lints allow` (exit code: 101)
@gabdube
Copy link
Owner

gabdube commented Nov 17, 2016

I've just checked the winapi rs docs for the definition of Get/SetWindowLongPtrW and it is only exported for "x86_64" aka 64 bits Windows.

Thank you for reporting this issue, I will add a fix that uses SetWindowLong if SetWindowLongPtr cannot be found and then It should work.

@gabdube gabdube added the bug label Nov 17, 2016
@gabdube
Copy link
Owner

gabdube commented Nov 17, 2016

@uranusjr I've just pushed the fix on master, can you check if it work now? I tested it on a 32bits rust on my machine, but I just want to be absolutely certain there are no more ARCH bugs before I release another version.

@uranusjr
Copy link
Author

uranusjr commented Nov 18, 2016

Yup, master runs as expected. Thanks! 👍

There’s another problem: The exit_on_close: true attribute doesn’t seem to work. After I close the main window, cargo run is still executing, and I can see my program in the task manager (ctrl-shift-esc). I have to hit ctrl-c to terminate the program.

I have no idea if this is related though, so feel free to close this (and put this in a seperate issue).

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

No branches or pull requests

2 participants