Home > Software engineering >  (high price) for current attains the focal control handle (embedded control dialog)
(high price) for current attains the focal control handle (embedded control dialog)

Time:10-06


The final assignment, asked to write a formula editor, as shown, this small program is based on the dialog box, including the red line area is a built-in dialog box, in the built-in dialog will generate a lot of different positions according to different situations and the size of the text box, when click the button above, need to write the corresponding text into the text box, at this time for coke, the younger brother by GetFocus () function to obtain the handle, but the handle is not correct, can't operate text boxes, such as online great god answer to thank!!!!!!!!!!!!!!!

CodePudding user response:

Focus point button, you don't run to the button, get the button handle, I guess so? You embedded coding improvements in the dialog box, when a text box click on the handle, and then you click button to handle the corresponding text box under the current save operation

CodePudding user response:

Methods should be 1/f, suggest another consider using RichEdit, a control is enough, can display the symbols, need not such dynamic set more edit,

CodePudding user response:

Own program, as long as the associated control, access control variables

CodePudding user response:

"When click the above button" pDlg - & gt; GetDlgItem (IDC_EDITX);

CodePudding user response:

FindWindowEx
The FindWindowEx function retrieves a handle to a window whose class name and window name match The specified strings. The function searches The child Windows, beginning with The one following The given child window. This function does not perform a case - sensitive search.

The HWND FindWindowEx (
The HWND hwndParent,//handle to the parent window
The HWND hwndChildAfter,//handle to a child window
LPCTSTR lpszClass,//a pointer to the class name
LPCTSTR lpszWindow//pointer to window name
);

The Parameters
HwndParent
Handle to the parent window whose child Windows are to be searched.
If hwndParent is NULL, the function USES the desktop window as the parent window. The function searches among Windows that are child Windows of the desktop.

Windows NT 5.0 and later: If hwndParent is HWND_MESSAGE, the function searches all the message - only Windows.

HwndChildAfter
Handle to a child window. The search begins with The next child window in The Z order. The child window must be a direct child window of hwndParent, not just a descendant window.
If hwndChildAfter is NULL, the search begins with the first child window of hwndParent.

Note that if both hwndParent and hwndChildAfter are NULL, the function searches all top - level and message - only Windows.

LpszClass
Pointer to a null - terminated string that specifies the class name or is an atom that identifies the class - the name string. If this parameter is an atom, it must be a global atom created by a previous call to theGlobalAddAtom function. The atom, a 16 - bit value, must be placed in the low - order word of lpszClass; The high - order word must be zero.
LpszWindow
Pointer to a null - terminated string that specifies the window name (the window 's title). If this parameter is null, all window names match.
The Return Values
If the function succeeds, the return value is a handle to the window that has the specified class and window names.

If the function fails, the return value is NULL. To get extended error information, callGetLastError.

QuickInfo
Windows NT: Requires version 4.0 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in winuser. H.
The Import Library: Use user32. Lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT.

See Also
Windows, the Overview Window Functions provides EnumWindows, FindWindow, GetClassName, GlobalAddAtom


CodePudding user response:

Have to do is put a RichEdit, click the button to the built-in dialog message, dialog messages are received on the RichEdit input character

CodePudding user response:

Dialog box is not a class, give this dialog to define the corresponding class variables, send a message to that variable
  • Related