-
Notifications
You must be signed in to change notification settings - Fork 10
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
Integrate with windows better to protect the app from easy closing #5
Comments
It appears we need to detect |
Alternatively, we can build it as a "GUI" app, which requires special flags and, of course, a special way to close the app (especially if we implement issue #6), because it will no longer have a windowed command line presence. A related issue on the Go project is being tracked as issue 2565 which, when fixed, will make special build flags unnecessary. |
This change is intended to be used with the app running in "GUI mode", which currently requires special build flags. It runs the app itself as well as enumerateDevices()in a "hidden window". This means that, unlike the Linux/OSX versions of the app, there is no commandline presence, so the app has to be killed from the task manager. This change is intended to address issue #5, though there will likely be further tweaks, so I'm keeping the issue open.
The current consideration is having the windows version of the app open a port bound to localhost and then adding a |
For better integration with windows, use the following code: import (
"fmt"
"syscall"
"unsafe"
)
var (
kernel32, _ = syscall.LoadLibrary("kernel32.dll")
getModuleHandle, _ = syscall.GetProcAddress(kernel32, "GetModuleHandleW")
user32, _ = syscall.LoadLibrary("user32.dll")
messageBox, _ = syscall.GetProcAddress(user32, "MessageBoxW")
) These functions have been called as an example, You can call functions like |
Way ahead of you, buddy. It's a lot more complicated than that, though. |
I'm sure. I was just giving an example. I don't know much about the language, I'm still learning it. |
I think I read somewhere that you can call C++ code from Go. If that is true, I can write the code in C++ for windows and you can call it from Go. I'm learning the language but I am not as comfortable with it as I am with java or C++. |
I'm trying to avoid using cgo so that the build process stays simple and cross-platform and doesn't become a mess. This means limiting it to syscall only (no |
Windows 7/8 do not send SIGINT to console apps when the window is closed. This needs to be detected and handled as a reboot scenario, or, if it cannot be handled, the app will need to be compiled with
-ldflags -H=windowsgui
and rewritten to be GUI-centric.The text was updated successfully, but these errors were encountered: