-
Notifications
You must be signed in to change notification settings - Fork 72
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
Coordinate changes #7
Comments
Probably something like this, if you don't mind hardcoding the resolution:
If you don't want to hardcode it (perhaps you change resolution sometimes), you can get your resolution dynamically with
Hope that helps! |
thanks. Switching corners with hardcoded res. is working well. Eg. bottom-left@1080p:
however I'm using notebook with 4K build-in display in work (native resolution) and I'm connecting external FHD monitor at home. I need to test GetWindowRect out because hardcoded resolution is not working in this case - obviously. EDIT: Unfortunately, i can't make dynamic resolution works when corner is changed from default to any other. This may be an issue for notebook users with external displays if they decide to use other corner. |
You want the corner to be moved when you change resolution automatically? I understand now. Hmm, to do this I think you will need to handle LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (uMsg == WM_DISPLAYCHANGE) {
GetWindowRect(GetDesktopWindow(), &kHotCorner);
kHotCorner.top = kHotCorner.bottom - 20;
kHotCorner.bottom += 20;
kHotCorner.left = -20;
kHotCorner.right = +20;
return 0;
}
return DefWindowProc(hwnd, uMsg, wParam, lParam);
} Now you need to create an invisible message-only window to get windows messages, just add this to the top of HWND Window;
Window = CreateWindowEx(0, "Message", NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
SetWindowLong(Window, GWL_WNDPROC, WindowProc); Now when you change resolution, the corner will move. Does that work? |
I should add these to a wiki page in case someone else wants the same thing as you. |
Hi How can I change this to be the upper right corner of the screen?
} |
I think you just want something like this: GetWindowRect(GetDesktopWindow(), &kHotCorner);
kHotCorner.bottom = 20;
kHotCorner.left = kHotCorner.right - 20; |
Doesn't seem to work... Thanks |
It's just saying you need to remove the |
ok, I've changed it but it still activates on top LEFT corner, not Top Right corner.
|
You didn't call the code to change the corner unless there's i.e., copy these lines: GetWindowRect(GetDesktopWindow(), &kHotCorner);
kHotCorner.top = kHotCorner.bottom - 20;
kHotCorner.bottom = 20;
kHotCorner.left = kHotCorner.right - 20;
kHotCorner.right = +20; And put them after this line: HHOOK MouseHook; (Note: please put three backticks (```) around code on github or it's really hard to read!) Like this: |
What are left-bottom coordinates ? Tried everything and nothing work so far.
These are default left-top:
static const RECT kHotCorner = {
.top = -20,
.left = 20,
.right = +20,
.bottom = +20,
};
The text was updated successfully, but these errors were encountered: