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

Fix poor detection of a dupe instance #148

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

eugenesvk
Copy link

Old FindWindow() function could mistake an Explorer folder 'UI for ETW'
for another instance of 'UI for ETW' (since window title is identical)
New custom function registers a unique window message that allows to
uniquely identify another instance of 'UI for ETW'
Bonus: restore the minimized window of 'UI for ETW'

Resolves: #147

Old FindWindow() function could mistake an Explorer folder 'UI for ETW'
for another instance of 'UI for ETW' (since window title is identical)
New custom function registers a unique window message that allows to
uniquely identify another instance of 'UI for ETW'
Bonus: restore the minimized window of 'UI for ETW'

Resolves: google#147
@google-cla
Copy link

google-cla bot commented Feb 8, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@randomascii
Copy link
Contributor

It looks basically good but I'll need the cla/google signed before I can accept the patch.

@eugenesvk
Copy link
Author

@googlebot I signed it!

@randomascii
Copy link
Contributor

I get four instances of this error when compiling:

1>C:\src\github\UIforETW\UIforETW\Settings.cpp(17,10): fatal error C1853: 'x64\Release\UIforETW_devrel.pch' precompiled header file is from a different version of the compiler, or the precompiled header is C++ and you are using it from C (or vice versa)

I don't mind switching to C++17 but I don't think that global constructors are a great idea. How about:

int GetAreYouMeId() {
static const UINT uwmAreYouMe = RegisterWindowMessage(L"678fd291e05741edb987c0a4f5650866");
return uwmAreYouMe;
}

Then it gets constructed on first use instead of before WinMain

@randomascii
Copy link
Contributor

The return type in my sample function should be UINT.

@randomascii
Copy link
Contributor

I noticed this was still open and decided to see why. Part of the reason is that I pasted the wrong error message into my last comment. The actual error message is:

1>C:\src\github\UIforETW\UIforETW\UIforETW.h(46,19): error C7525: inline variables require at least '/std:c++17' (compiling source file Settings.cpp)

That message happens on this line:

inline const UINT uwmAreYouMe = RegisterWindowMessage(L"678fd291e05741edb987c0a4f5650866");

I continue to think that that isn't a great idea. Inline data is great. Global constructors that run before main are not.

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

Successfully merging this pull request may close these issues.

UIforETW shortcut doesn't launch from within a folder named 'UI for ETW'
2 participants