Click here to Skip to main content
15,886,091 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
is it possible to use check_box control outdside a dialogbox

What I have tried:

I am trying to create for exercise an asci editor application with api32
so i created a rich text editor Control to show the loaded file (whole screen)+ a menu for the commands
For the <find> functionality i do NOT want use dialog box ,i am trying to use ShowWindow() api to hide/show the the controls for data input necessary for the text search
-)1 edit control for input the text to search
-)2 check boxes for the options 'match case' and 'whole word only' (is it possible to create these check box controls as children of the main HWND ?)
Posted
Updated 19-Oct-22 1:16am
v11
Comments
Richard MacCutchan 12-Oct-22 8:36am    
The Find or Find-Replace dialog boxes already provide this feature.

It is not clear where you are trying to display this window or what it contains. But a dialog would be much easier to code. Take a look at TaskDialogIndirect function (commctrl.h) - Win32 apps | Microsoft Learn[^] which probably fulfils all your requirements. There is also Find and Replace Dialog Boxes - Win32 apps | Microsoft Learn[^].
 
Share this answer
 
v2
Edit controls and checkboxes are ultimately also just a special form of window. So you can also create them with CreateWindow. Here is an example from Charles Petzold:
C
switch (message)
{
case WM_CREATE:
	cxChar = LOWORD(GetDialogBaseUnits());
	cyChar = HIWORD(GetDialogBaseUnits());
	hwndButton = CreateWindow(TEXT("button"),
		TEXT("CHECKBOX"), WS_CHILD | WS_VISIBLE | BS_CHECKBOX,
		cxChar, cyChar, 20*cxChar, 2*cyChar,
		hwnd, (HMENU)IDC_CHKBOX1,
		((LPCREATESTRUCT)lParam)->hInstance, NULL);
	return 0;
}
 
Share this answer
 
v2
MessageBox (winuser.h)


C++
int DisplayResourceNAMessageBox()
{
    int msgboxID = MessageBox(
        NULL,
        (LPCWSTR)L"Resource not available\nDo you want to try again?",
        (LPCWSTR)L"Account Details",
        MB_ICONWARNING | MB_CANCELTRYCONTINUE | MB_DEFBUTTON2
    );

    switch (msgboxID)
    {
    case IDCANCEL:
        // TODO: add code
        break;
    case IDTRYAGAIN:
        // TODO: add code
        break;
    case IDCONTINUE:
        // TODO: add code
        break;
    }

    return msgboxID;
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900