Get focus status out of application in Delphi - windows

I'm trying to create an android-like keyboard in Delphi that appears when a textbox is in focus. I need to know some way to get this status of focus in all the programs so I can give a show in my form and send it forward

SetWinEventHook(EVENT_OBJECT_FOCUS, EVENT_OBJECT_FOCUS, ...) to register for focus changes. Once you know the window you check the class name for "Edit" and you can get the thread id and then get caret information from GetGUIThreadInfo if you need that...

Related

Extract Path From File Dialog

My app uses a 3rd party DLL for image processing, which opens a file dialog to choose an image file. For continuity and usability reasons, I use a separate thread to change the dialog after it appears (change the icon and title, and remove the system menu and context help button). I also introduce my own WNDPROC to capture the button clicks, which I can re-route to my app if I choose.
I want to do some specific processing of certain image types, but I need to know when one of these has been picked. Is there a way to get hold of the full file path and pass it back to my app? (The third party file dialog is not the default Windows dialog, but seems to be based on it).
In my WNDPROC, after catching the IDOK WM_COMMAND message, I used SendMessage and CDM_GETFILEPATH to get what I'm after!
Edit:
Actually, it seems I'm better off catching the WM_DESTROY message - in case the user double-clicks or presses enter instead of the 'OK' button.

how to activate SysTreeView32 when folder-select dialog window is created?

When I create SHBrowseForFolderW dialog the default control is OK, what I need to do is make SysTreeView32 active so a user can right on use arrow keys to adjust the desired folder. I tried to use this code : http://comp.newsgroups.archived.at/os.ms-windows.programmer.win32/200505/05053122835.html which wokrs ok in finding the HWND of the dialog but using WM_NEXTDLGCTL has no effect on the window.
Maybe I should send TAB keystrokes to the window, or I don't know any other opions ? Are there swiches in creating the browse dialog what control will be highlighted when the window create ?
Ok, the thing is difference between PostMessage and SendMessage. I mistakenly used the later here. They are not the same!

Is it possible to remove window by clicking button?

I am writing an app in which i want a WelcomeWindow.
WelcomeWindow contain some Text , CheckBox Button (with text- Don't want this message again) and one Ok button.
What i want is when my CheckBox state is On like ([checkBox state ]== NSOnState) and if i press Ok button then this WelcomeWindow should be close and
it won't be open again even if i Quit the app and then again run the app.
Is it possible in mac app ?
Any help will be appreciated.
Thanks in advance!!
Yes, Of course. You need to save an info that your app did already pass the welcome window. For instance NSDefaults or Sqlite. It can be stored as a boolean value. Then you just ask for that value in the beginning to display or not display mentioned window.

Command line in Visual Studio - how to close popup window?

I have situation like below.
I'm running some command and then I get a popup with Y/N answer. Is there a possibility to force answer Yes and automatically close the window through command line?
If you want to click a button in an external window, you'll need to hook the window with the button exposed. You can accomplish this by grabbing the window handle via FindWindow, finding the child button, and sending a BM_CLICK with an API call via SendMessage.
you mean a command window within VS ? I don't think there's anything generic, you could run all sorts of things, depends on what your command is - and how much control over it you have - maybe some example of what you're trying to do could help. 'picking' the window will work but depends again on what you're doing, how custom it is etc.

Windows: Language Bar will not show input method options for some of my windows

I am trying to make our application properly handle international input. Since we handle text input and font rendering ourselves, I wrote custom code to handle the respective WM_IME_* messages.
Now, this all works fine, with one exception: When our applications main window is open, the Language Bar will not let me pick any options. I can set the input language to Japanese or Korean, but the menus for choosing the input methods (like Hangul or Hiragana) are not shown. Then, when I open another window (any other window, be it one of our application windows, or a standard "save file" dialog), the options appear. Once there, they will stay, even if I close the other window. IME input will then work as expected in the main window. But, as explained, only if I open another window first.
Now, how does windows decide whether it should display the input method options or not? It appears that windows does not recognize our main window as Unicode capable for some reason. How can I fix that?
Thanks in advance for any suggestions,
jonas
Edit: One more strange thing i noticed is that for my main window (which will not let me change input methods), I will get a WM_INPUTLANGUAGECHANGEREQUEST message when i change the input language - which I pass on to DefaultWindowProcW. For the windows which let me change the input method, i don't get the request, i just get a WM_INPUTLANGUAGECHANGE message (which I don't get for the other window).
Ok, after a long search I've been able to find out what is breaking this. We are calling SetFocus on a child window in response to WM_FOCUS messages, so that a specific child window always gets focused when a window is brought to the front. Apparently, this confuses window's IME code, and makes it unaware that the window can handle IME input.
Some notes
Text Service is works per window, not system wide, so even its turn on in one window, another window will still need to turn it on, (unless user set it as default)
And Text Service is not working in any windows, to enable that, target computer need to enable following setting on

Resources