Closed exelotl closed 4 years ago
@exelotl Thank you very much for your detailed explanation. I was able to reproduce the issue and fixed it by using the same way as Winim. Thanks for the hint! I want to keep NiGui as simple as possible, that's why it uses an own minimal Win32 binding and does not depend on other libraries.
This is a continuation of issue #29
I encountered this problem when running a simple Hello World on Windows 10 with msys2/mingw64. The program compiles, but fails to run, giving the following error message:
"An attempt to set the process default activation context failed because the process default activation context was already set."
Some info about my machine:
I walked a friend through the following process with fresh copies of MSYS2 and Nim, and the error occurred for him too:
Steps to reproduce
Install MSYS2 for x86_64 from https://www.msys2.org . Follow the instructions on the page to complete the installation
For this, we'll be using the
mingw64
terminal.Install git and gcc:
Now you can open your msys2 home directory in Windows explorer:
Download the latest Nim version for x86_64 from https://nim-lang.org/install_windows.html
Extract the contents to your MSYS2 home directory. So you should have a folder like this: "C:\msys32\home\exelotl\nim-1.0.2"
Edit your
~/.bashrc
to add nimble and nim's bin folders to your pathApply the changes in your current terminal:
Install nigui
Create a minimal app:
Build and run:
You should see the following error:
Possible solutions
As previously mentioned, this issue occurs due to a hacky approach for enabling the visual styles module. The proper way to do this is to create an appropriate resource file and link it into your final executable. The Winim library uses this approach, and provides a very solid set of bindings for the Win32 API. I think we should strongly consider using it.