Microsoft KB Archive/66942

{|
 * width="100%"|

EdAlign.exe Changes Text Alignment in Edit Control

 * }

Q66942

-

The information in this article applies to:


 * Microsoft Win32 Software Development Kit (SDK)
 * Microsoft Windows Software Development Kit (SDK) 3.1

-

SUMMARY
This article explains that the EdAlign.exe. is available for download.

MORE INFORMATION
The following file is available for download from the Microsoft Download Center:

"EdAlign.exe" For additional information about how to download Microsoft Support files, click the article number below to view the article in the Microsoft Knowledge Base:

"Q119591 How to Obtain Microsoft Support Files from Online Services" Microsoft used the most current virus detection software available on the date of posting to scan this file for viruses. Once posted, the file is housed on secure servers that prevent any unauthorized changes to the file.

Only multiline edit controls can be right-aligned or centered. Single-line edit controls are always left-aligned, regardless of the control style given.

Windows does not support altering the alignment style of a multiline edit control after it has been created. However, there are two methods that you can use to cause a multiline edit control in a dialog box to appear to change alignment. Note that in each of these methods, the dialog box that contains the control must be created with the DS_LOCALEDIT style.

The first method applies to all platforms. The second method does not apply to Windows 95 and Windows 98. Under Windows 95 and 98, EM_SETHANDlE and EM_GETHANDLE are not supported. For more information, please see the following articles in the Microsoft Knowledge Base:

"Q130759 : EM_SETHANDLE and EM_GETHANDLE Messages Not Supported"

Method 1
Create three controls: one left-aligned, one centered, and one right- aligned. Each has the same dimensions and position in the dialog box, but only one is initially made visible.

When the alignment is to change, call ShowWindow to hide the visible control and to make one of the other controls visible.

To keep the text identical in all three controls, use the EM_GETHANDLE and EM_SETHANDLE messages to share the same memory among all three controls.

Method 2
Initially create a single control. When the text alignment is to change, retrieve location, size, and style bits for the existing edit control. Create a new control with the same size and in the same location, but change the style bits to reflect the new alignment.

Send the EM_GETHANDLE to each control to retrieve a handle to the memory that stores the contents. Send an EM_SETHANDLE to each control to exchange the memory used by each. Finally, destroy the original control.

Additional query words:

Keywords : kbfile kbsample kbCtrl kbEditCtrl kbOSWinNT kbOSWinNT350 kbOSWinNT351 kbOSWin2000 kbSDKWin32 kbGrpDSUser kbOSWin kbOSWin95

Issue type : kbinfo

Technology : kbWin32SDKSearch kbAudDeveloper kbWin3xSearch kbSDKSearch kbWin32sSearch kbWinSDKSearch kbWinSDK310