Increase the height of Windows native edit control as the user is typing in text - winapi

We have a text box which is in fact an instance of the standard native Windows edit control used to enter text. The control was created using CreateWindowsEx without the ES_AUTOHSCROLL flag specified. It implies that word wrapping for entered text is used automatically.
Our goal is to fix the control's width and increase the height of the control automatically as the number of text lines is increased to show all them. An example: by default, the text box is empty. The user starts typing, and as soon as the end of the first line is reached, the text box automatically increases its height by one text line so the last word is put into the beginning of the second line due to word wrap.
How to gain this? Our development environment is VB6, but any WinAPI-based code is also welcome.

Related

RichEdit20A line selection mode similar to Notepad

I'm trying to change the way RichEdit20A Windows control selects line so it's similar to how it works in Notepad.
By default, if I select a line (e.g. Shift-End), then all the characters and the end of line is selected:
Sample text
^^^^^^^^^^^^ <- this is the selection
In Notepad it selects just the text:
Sample text
^^^^^^^^^^^
As a result, pressing delete (or backspace) in RichEdit20A control removes the line while in Notepad it just removes the text and keeps the line empty.
Is there any simple way (other than handling selection on my own) to configure the RichEdit20A control to keep formatting but make the line selection to work like in Notepad?
I don't know such a setting to influence the RTF control. But pressing Shift+End is a key input that is possible to trap with a WM_KEYDOWN handler, when you subclass the control.
You can use EM_LINEINDEX with -1 to get the current line start index.
Now with this index you can use EM_LINELENGTH.
Get the current selection (EM_GESTEL) and now you are free to use EM_SETSEL with the values you like to extend it.

How do I write a script that will change the size of text and app when opening a program?

I have a Windows 7 laptop with the size of text and apps set to small. However, one program I use needs this setting to be set on medium. I'm sick of changing this setting every time I have to use the program.
How do I use a batch file to change the size and text of this program to medium without impacting other programs and keep the resolution at 1280x960?
I have no previous experience in writing batch files.
If the program is a batch file or its cmd.exe, you can just create a shortcut to that program, go into shortcut properties, go into the Layout tab and set the window size by changing Width to the width you want the window to be and the Height to the height you want to window to be. For the text go into the Font tab and set the text size to an option already there or input a custom one by clicking in the box that tells you the size selected and type in your own. Then press enter. This will close the properties. You must do this or it will go to the nearest option to your custom size. Now simply run the shortcut instead of running said program and it should have custom size and text.

PowerPoint addin: Justify alignment in a text-box

Explaining the problem
I am developing an addin in powerpoint and i am trying to create a textbox with justify alignment:
Shape newTextBox = currentSlide.Shapes.AddTextbox(...);
TextRange boxTextRange = newTextBox.TextFrame.TextRange;
textRange.ParagraphFormat.Alignment = PpParagraphAlignment.ppAlignJustify;
The results are not as expected. When i type an 'enter' character in this box, the line is not justified. Why? Because with every 'enter' character, a 'paragraph' character is automatically inserted. Here is a screen shot of the copy-pasted text from the powepoint text-box to a word document:
In every case, the line is considered the last line of the paragraph and it is not justified.
However, if i try to do the same thing on the title textbox in the default title layout slide, there are no 'paragraph' characters.
Question time ...
Is there a way to stop these characters from being automatically entered in the text box? Maybe an option that i can set via code?

vb6 text control when property set to multiline cannot hightlight text past box length, have to use right directional key

When I set the multiline property of the text control to true, when in use, if the text control is used as a basic one line textbox and the text typed in goes past the length of the box, it only highlights text up the end of the box, you have to press the right arrow key to highlight the rest. I need the multiline property set to true because in some scenarios it is necessary. I've thought of creating the text control twice with the property turned off in one and on in the other but wanted to know if anyone knew a solution?

Visual Studio - Scroll AND move cursor

As a preface I'm using ViEmu although I dont think this affects anything. I would simply like to scroll up in the Text Editor along with moving the cursor to the relative screen position.
As an example, if my text editor displays 100 lines of viewable code (1 - 100) and my cursor is on line 20, when I scroll down to the next viewable 100 lines (101 -200) I would like the cursor to be at 120.
Using the VS command Edit.ScrollDown scrolls the code down as expected but leaving the cursor at line 20 instead of moving it to 120. Is there another command to use or any way to alter this behavior?
As noted in the question you seem to be wanting to re-map Page Down to another key (due to limited keyboard).
To identify which command a key is mapped to open the keyboard customisation dialogue and type in the current key into the short key text box and then look at what it is currently mapped to.
Unfortunately this doesn't work for page down (control-page down does work, but that doesn't help here).
Entering "page" into the command filter does: Edit.PageDown is mapped to Page Down in the text editor. Map this command to another shortcut.

Resources