WinAPI create window with standard behavior [duplicate] - winapi

This question already has answers here:
Handling AeroSnap message in WndProc
(2 answers)
Closed 9 years ago.
This question is a result of a discussion. I was wondering if a window that is created via WinAPI can behave like explorer windows e.g. can be controlled by the Windows and the arrow keys. (if you press Windows + ArrowKey the focused window should move and snap in that direction on the side).
Is it possible to tell that a window should behave like this or would one have to handle such control commands by himself?

All "standard" behavior is provided by DefWindowProc. As long as you pass all unhandled messages to DefWindowProc, you'll get it.

Related

Display message box on CTRL + ALT + DEL [duplicate]

This question already has answers here:
How can I intercept all key events, including ctrl+alt+del and ctrl+tab?
(13 answers)
Closed 8 years ago.
I want to display a message to the user when they try to lock the computer using CTRL + ALT + DEL, when they see the message then they will click OK and the computer will lock. How could I accomplish something like this? I have looked around but have found no solution.
You CAN'T. It is designed to prevent you doing that. No windows function supports CAD. It's about preventing password capturing.
And the reason we press those keys is that the IBM keyboard designer refused MS request for a special purpose key for logon.
From WSDK
Initializing Winlogon
When Winlogon initializes, it registers the CTRL+ALT+DEL secure attention sequence (SAS) with the system, and then creates three desktops within the WinSta0 window station.
Registering CTRL+ALT+DEL makes this initialization the first process, thus ensuring that no other application has hooked that key sequence.

How to hook WIN32 WM_SYSCOMMAND and SC_SIZE and still enable window resizing? [duplicate]

This question already has an answer here:
When (and how) to lay out the children of a Win32 window in response to a resize?
(1 answer)
Closed 8 years ago.
I'm intercepting (hooking) WMSYSCOMMAND and SC_SIZE messages for my application with intention of resizing child controls as user resizes the main window.
I'm successful at my primary goal, but a side effect occurred: main window is now not resized and user can not drag its borders to do so.
How do I react upon SC_SIZe to resize child controls and not block main window resize (I wan't it to work).
Thanks.
Resize your child controls in WM_SIZE and leave those other messages alone (letting them go to DefWindowProc).
There's a user-setting that controls whether windows are updated as they're sized. If you try to do what you're doing, you'll be overriding that setting, which is a rude thing to do to your users.
If the setting is enabled (which it is by default on modern version of Windows), your top-level window will receive WM_SIZE messages and WM_PAINT during the resize operation.

Windows API to attach window to the left or to right of desktop [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to dock an application in the Windows desktop?
I need the behavior of window like Google Desktop does.
Main window of Google Desktop can be attached to the left or to the right of desktop and DOESN'T overlap desktop icons.
Icons automatically move from this place!
If maximize another window it uses only available space and doesn't use area took by attached Google Desktop window.
It work on Windows XP as well
What API does Google Desktop use for such behavior?
The UI element you're talking about is an application bar, or appbar for short. It's created and operated by using the API function `SHAppBarMessage'.
For instance, to create a new appbar, you sent it the ABM_NEW message with a message identifier Windows can use to communicate with it. To position the bar along one edge of the desktop, you send it the ABM_SETPOS message. There are quite a few messages defined; they're listed on the page I linked above.

How can I Consume Key Events only on a Keyboard with a Specific HID in Mac OSX? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
OSX HID Filter for Secondary Keyboard?
I would like to write a Mac OSX Application that captures keyboard events on a second keyboard and consume them before other apps get notified? I don't my app to be notified of a keystroke on the main computer keyboard, just the second one. And I don't want other apps to get the keystroke, I want to consume it. Anyone here know the best way to go about this?
You will need IOKit to do this. The code would involve writing a kext and intercepting keyboard events and choosing whether to pass them on to the user space. Writing the entire approach here would be too complex and big but I can suggest a few references.
The code at KeyRemap4MacBook has quite a bit of low level code for device reading and interception.
Here is the custom kext that the author has written: https://github.com/tekezo/KeyRemap4MacBook/tree/master/src/core/kext
I suggest you look into the code to see how he has intercepted the keys, remapped them according to the user configuration and send them to the user space.

Getting the Window Title? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Ok i specify:
My problem is that I want to assign a keyboardshortcut for Dreamweaver CS4 and I have it like this: "C:\Program Files\Adobe\Adobe Dreamweaver CS4\Dreamweaver.exe" Thats ok so far.
But when I press the key it doesn't place itself infront of everything else like Outlook and Visual Studio does, instead it blinks in the taskbar, and I have to click there anyway to get back to Dreamweaver.
Is there any switch or something I can assign for Dreamweaver to get back AND have it "popup?"
OR some coding with the window title property that fixes this?
The Win32 API has a function for enumerating all top level windows on the desktop - EnumWindows ( http://msdn.microsoft.com/en-us/library/ms633497(VS.85).aspx ). Using the enumerated window handle with the Win32 API GetWindowText call ( http://msdn.microsoft.com/en-us/library/ms633520(VS.85).aspx ) would get you that information.
I am unfamiliar with the C# based methods, but I expect there is a similar way there too.
But you did not specify enough information really, what language/tool are you trying to do this within?
Windows tries very hard to prevent applications from shoving themselves in the foreground. For some reason Windows thinks that CS4 is trying to move itself to the foreground and instead of stealing the focus from the current app in the foreground, it's flashing the icon for the app to let you know that it needs attention.

Resources