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

Why can a u32 not be accepted as IntoParam<VARIANT> #1037

Closed
psmit opened this issue Aug 12, 2021 · 5 comments
Closed

Why can a u32 not be accepted as IntoParam<VARIANT> #1037

psmit opened this issue Aug 12, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@psmit
Copy link

psmit commented Aug 12, 2021

I'm having the following code:

    let hwnd = GetForegroundWindow();
    let acc_obj : IAccessible  = AccessibleObjectFromWindow(hwnd,0 )?;
    println!("{:?}", acc_obj.get_accName(CHILDID_SELF)?);

But this fails to compile:

error[E0277]: the trait bound `u32: windows::traits::into_param::IntoParam<'_, VARIANT>` is not satisfied
  --> src\main.rs:18:42
   |
18 |     println!("{:?}", acc_obj.get_accName(CHILDID_SELF)?);
   |                                          ^^^^^^^^^^^^ the trait `windows::traits::into_param::IntoParam<'_, VARIANT>` is not implemented for `u32`

Why is it not possible to do this? Abi is implemented for u32, and IntoParam<'_, VARIANT> should be implemented for Abi? I'm I doing something wrong?

@kennykerr
Copy link
Collaborator

There is very minimal support for VARIANT at the moment. #539

I hope to address this soon.

@kennykerr kennykerr added the enhancement New feature or request label Aug 12, 2021
@psmit
Copy link
Author

psmit commented Aug 12, 2021

Thanks for your quick reply. As you mention minimal support, is there a workaround to initialize or read a VARIANT at this moment?

@kennykerr
Copy link
Collaborator

You can of course initialize and read the values within the underlying VARIANT struct yourself.

@riverar
Copy link
Collaborator

riverar commented Aug 12, 2021

PROPVARIANT initialization example may help here:
#976 (comment)

@kennykerr
Copy link
Collaborator

Duplicate of #539

@kennykerr kennykerr marked this as a duplicate of #539 Apr 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants