I'm developing an application to help the user write common text faster.
What I have in mind is a Windows app where the user can configure his key combinations, so that when he's, for instance, writing an email on Outlook or Gmail, he just has to press those keys and the text he configured before will be pasted into whatever app he's using.
So, instead of a user having to write "Dear sir, your order has been received succesfully" every time he receives an order and wants to send a confirmation email, he could just press something like "Crtl + O + R", and the corresponding text will be written for him.
I think that in order to achieve that my app has to do two things:
Intercept the key combination pressed buy the user when he's focused on a different app.
"Paste" the corresponding text to that app.
I have no real clue on how to achieve this, because what my app will be doing is something like "pasting" text on another app (otlook, word, notepad or whatever thing a user can type into), replacing the short text the user wrote with the long text he defined.
Any suggestions? I've looked into hot keys, but I'm not sure they're the way to go, and I also have no idea on how to "paste" the new text.
Thanks.
Have you considered simply adding text to the clipboard? Show the text next to a button that says "Copy to clipboard", and the user can just grab it and click Ctrl-V.
Can't think of a Windows app that does it this way, but I know it's possible; heck, Bit.ly can do it from your browser.
Related
I am trying to develop a custom credential provider. Trying to learn the basics. I implemented ICredentialProvider and ICredentialProviderCredential.
I added a custom credential tile, edit text and command link to windows logon UI.
What i want to do is, when i click on CommandButton i try to read textbox value but i could not do that.
I want to open a custom windows form (e.g MFA form), how can i open a custom form?
I am using phaetto/windows-credentials-provider implementation as example
There is not much information about this topic.
1. Text field
You must collect and keep securely the value(s) of text box(ex) field(s) as far as it is updated and your tile implementation class is notified about the change of that value.
You will be notified about every single character user entered into the text field. Be ready for this.
As far as user type info input text box your provider's method ICredentialProviderCredential::SetStringValue will be called on every text box update.
2. Popup window (dialog)
If you want to open any window you must acquire a parent window handle from Logon UI / Cred UI. Handle acquisition method is ICredentialProviderCredentialEvents::OnCreatingWindow.
You can find more details in the answer and it's comments: https://stackoverflow.com/a/52089207/3868464 .
I am currently working on a Windows Presentation Foundation app and I need to make use of Message boxes. I want to get few information from user inside Message Box popup.
But they appear always like this:
But I think the actual look of it should be like that:
Does anybody know, why this is, and how to solve it? I tried all everything listed
here
, but nothing worked.
I agree with Keithernet, build your own. Its more of an Input Dialog box. You may want to plan it to create a window, create it with ex: 4 parameters which you could override so you can apply them in the form including
The title,
The prompt you want the user to fill in
optional default button 1 text
optional default button 2 text.
have the input value stored into a public property in the window for the text to be bound to during entry.
If the user clicks the cancel button (or similar), clear the text entry and close the window. If ok button, just close the window.
Then, when you call it with a YourWindow.ShowDialog(), upon return, you can look at the public property for that input text value.
You could even do with a property / flag if the user cancelled directly or not. I have done similar in a couple of my WPF apps.
MessageBox is very limited. Based on your screenshot, you should just create your own child Window with your own XAML so you can get the user input.
You can find sample service implementations/NuGets for this on GitHub. Here is one I've created sometime ago: https://github.com/Dirkster99/MsgBox
Just create your own is an oversimplifying statement in my opinion because this is usually a dialog that you want to show in different parts of the application. Therefore, you have to settle for a software design pattern (I chose a service implementation as suggested here).
Likewise, there are other design decisions that should be taken. I have for instance made sure that the API has a compatible subset of Show API calls with the standard .Net MessageBox to make its application as flexible as possible. I also settled for light and dark themes hoping this will make its application easy in any other theme...
Can someone tell me how to read selected text with C#?
I need it to work outside of my app.
For example, the user opens a Notepad, writes something, selects text, and presses a hotkey.
I need to store the text in a variable in my program. How can I do that?
Thank you in advance.
you could read the text from a notepad window via PInvoke. SendMessage function from user32.dll...
Here is a example http://loyaltyhf.blogspot.com/2013/01/source-chrome-class.html that reads the address from Google Chrome's Address bar. It might not work for the current version of Google Chrome but it'll give you a pretty good idea.
I am trying to create a way or inserting text anywhere on the system in Windows, much like the clipboard works. For example, pressing ctrl+shift+1 would 'paste' text set in my application into where the user is currently pointing the cursor.
For example, if my application sets it to be 'local.network' and the user presses ctrl+shift+1 in their browser address bar, it would paste in 'local.network'. I then want to have different values set, depending on what number the user presses. Is this possible or can I not create a system wide function like this?
What you're looking for is how to register a hotkey.
Register more than one hotkey with RegisterHotKey
Set global hotkeys using C#
in response to your followup comment, sorry, I though the question was more about the capturing the key press event. If you need to paste text to a window that you don't own, then this question would be a near duplicate. That question uses WM_SETTEXT but you can easily use WM_PASTE instead.
Is it possible to programmatically change the process that starts once the user click the LifeChat LX-3000 center button?
I don't have any kind of experience programming with hardware so don't know if it's even possible. The problem is, a client of us has a lot of this headphones and we want to be able to change the default behavior of that button from open live messenger to open our CRM. I try to follow this instructions to modify the registry as doing (not programmatically):
Find HKEY_CLASSES_ROOT\CLSID{F5F545A6-39C4-40B5-814D-B45040A89FB5}\LocalServer32
Remove the (Default) value by double clicking it and deleting the text
Change the value to OurCRMExePath
But this doesn't work. I suppose things changed since the date that web page was wrote. Any idea? I suppose first step would be to know which registry entry does that button modify and then go and change it. But, how can one get to know that?