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

Add missing API to open app in foreground? #121

Closed
binChris opened this issue Apr 12, 2024 · 3 comments
Closed

Add missing API to open app in foreground? #121

binChris opened this issue Apr 12, 2024 · 3 comments
Assignees
Labels
bindings Something with the low-level WinAPI bidings enhancement New feature or request

Comments

@binChris
Copy link

First of all, thanks for this lib, it is so much better to code against than the native Windows API!

I am trying to start and open an app in foreground and this needs functions currently not covered by winsafe:

  • ShellExecuteEx - gives a chance to obtain the process handle
  • WaitForInputIdle - so that the hwnd can be found via EnumWindows

Would it be ok to create a pull request for there functions? Plus struct ShellExecuteEx internally, I think it's better to disect it in the public interface as its members are mixed input / output.

@rodrigocfd rodrigocfd self-assigned this Apr 12, 2024
@rodrigocfd rodrigocfd added the bindings Something with the low-level WinAPI bidings label Apr 12, 2024
rodrigocfd added a commit that referenced this issue Apr 12, 2024
@rodrigocfd
Copy link
Owner

I pushed an implementation for WaitForInputIdle, which is not complicated.

ShellExecuteEx, however, will need some thought... it's fine to create a pull request, but it's often useful to brainstorm such APIs. Do you have anything in mind?

@rodrigocfd rodrigocfd added the enhancement New feature or request label Apr 12, 2024
@binChris binChris changed the title Add missing API to open window in foreground? Add missing API to open app in foreground? Apr 13, 2024
@binChris
Copy link
Author

That's great, thanks for adding WaitForInputIdle!

I can understand you want to keep the winsafe API stable and avoid breaking changes. The original Windows API for ShellExecuteEx is quite horrible, mixing input/output fields in the same struct.

Let me think about this a little and we can discuss a possible API design here before making a PR.

@rodrigocfd
Copy link
Owner

Hi Chris,

I pushed an unsafe implementation of ShellExecuteEx with a very bare-bones SHELLEXECUTEINFO. If we keep thinking about the perfect design, we probably would never finish it, the API is terrible.

So my idea is that, from this starting point, you try to write your stuff. Then we can discuss your pain points and make small improvements to SHELLEXECUTEINFO, until we reach a reasonable implementation.

If you find any difficulties, just reply down here and I'll be glad to help you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bindings Something with the low-level WinAPI bidings enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants