<commit_before>#include <windows.h>
#include <tchar.h>
#include "resource.h"

// project properties

#pragma comment(linker,"\"/manifestdependency:type='win32' \
name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \
processorArchitecture='*' publicKeyToken='<KEY>' language='*'\"")

// common data

HINSTANCE hInstance = NULL;
TCHAR szUserText[1024] = TEXT("Hello world!");
int iColorButton = IDC_BLACK;
HWND hTextDlg = NULL;

// text modeless dialog procedure

void UpdateTextDialog()
{
	if (hTextDlg)
		SetDlgItemText(hTextDlg, IDC_TEXT, szUserText);
}

INT_PTR CALLBACK TextProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
{
	switch (uiMsg)
	{
	case WM_INITDIALOG:
		SetDlgItemText(hDlg, IDC_TEXT, szUserText);
		return TRUE;

	case WM_COMMAND:
		switch (LOWORD(wParam))
		{
		case IDC_TEXT:
			if (HIWORD(wParam) == EN_CHANGE)
			{
				GetDlgItemText(hDlg, IDC_TEXT, szUserText, 1024);
				InvalidateRect(GetParent(hDlg), 0, TRUE);
				return TRUE;
			}
			break;
		case IDCANCEL:
			DestroyWindow(hDlg);
			hTextDlg = NULL;
			return TRUE;
		}
		break;
	}
	return FALSE;
}


// options dialog procedure

INT_PTR CALLBACK OptionsProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
{
	switch (uiMsg)
	{
	case WM_INITDIALOG:
		SetDlgItemText(hDlg, IDC_TEXT, szUserText);
		CheckRadioButton(hDlg, IDC_RED, IDC_BLACK, iColorButton);
		return TRUE;

	case WM_COMMAND:
		switch (LOWORD(wParam))
		{
		case IDOK:
			GetDlgItemText(hDlg, IDC_TEXT, szUserText, 1024);
			if (BST_CHECKED == IsDlgButtonChecked(hDlg, IDC_RED)) iColorButton = IDC_RED;
			if (BST_CHECKED == IsDlgButtonChecked(hDlg, IDC_GREEN)) iColorButton = IDC_GREEN;
			if (BST_CHECKED == IsDlgButtonChecked(hDlg, IDC_BLACK)) iColorButton = IDC_BLACK;
		case IDCANCEL:
			EndDialog(hDlg, 0);
			return TRUE;

		case IDC_APPLY:
			GetDlgItemText(hDlg, IDC_TEXT, szUserText, 1024);
			if (BST_CHECKED == IsDlgButtonChecked(hDlg, IDC_RED)) iColorButton = IDC_RED;
			if (BST_CHECKED == IsDlgButtonChecked(hDlg, IDC_GREEN)) iColorButton = IDC_GREEN;
			if (BST_CHECKED == IsDlgButtonChecked(hDlg, IDC_BLACK)) iColorButton = IDC_BLACK;
			InvalidateRect(GetParent(hDlg), 0, TRUE);
			UpdateTextDialog();
			break;<commit_msg>small bugfix in dlg sample<commit_after>#include <windows.h>
#include <tchar.h>
#include "resource.h"

// project properties

#pragma comment(linker,"\"/manifestdependency:type='win32' \
name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \
processorArchitecture='*' publicKeyToken='<KEY>' language='*'\"")

// common data

HINSTANCE hInstance = NULL;
TCHAR szUserText[1024] = TEXT("Hello world!");
int iColorButton = IDC_BLACK;
HWND hTextDlg = NULL;

// text modeless dialog procedure

void UpdateTextDialog()
{
	if (hTextDlg)
		SetDlgItemText(hTextDlg, IDC_TEXT, szUserText);
}

INT_PTR CALLBACK TextProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
{
	switch (uiMsg)
	{
	case WM_INITDIALOG:
		SetDlgItemText(hDlg, IDC_TEXT, szUserText);
		return TRUE;

	case WM_COMMAND:
		switch (LOWORD(wParam))
		{
		case IDC_TEXT:
			if (HIWORD(wParam) == EN_CHANGE)
			{
				GetDlgItemText(hDlg, IDC_TEXT, szUserText, 1024);
				InvalidateRect(GetParent(hDlg), 0, TRUE);
				return TRUE;
			}
			break;
		case IDCANCEL:
			DestroyWindow(hDlg);
			hTextDlg = NULL;
			return TRUE;
		}
		break;
	}
	return FALSE;
}


// options dialog procedure

INT_PTR CALLBACK OptionsProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
{
	switch (uiMsg)
	{
	case WM_INITDIALOG:
		SetDlgItemText(hDlg, IDC_TEXT, szUserText);
		CheckRadioButton(hDlg, IDC_RED, IDC_BLACK, iColorButton);
		return TRUE;

	case WM_COMMAND:
		switch (LOWORD(wParam))
		{
		case IDOK:
			GetDlgItemText(hDlg, IDC_TEXT, szUserText, 1024);
			if (BST_CHECKED == IsDlgButtonChecked(hDlg, IDC_RED)) iColorButton = IDC_RED;
			if (BST_CHECKED == IsDlgButtonChecked(hDlg, IDC_GREEN)) iColorButton = IDC_GREEN;
			if (BST_CHECKED == IsDlgButtonChecked(hDlg, IDC_BLACK)) iColorButton = IDC_BLACK;
		case IDCANCEL:
			EndDialog(hDlg, 0);
			return TRUE;

		case IDC_APPLY:
			GetDlgItemText(hDlg, IDC_TEXT, szUserText, 1024);
			if (BST_CHECKED == IsDlgButtonChecked(hDlg, IDC_RED)) iColorButton = IDC_RED;
			if (BST_CHECKED == IsDlgButtonChecked(hDlg, IDC_GREEN)) iColorButton = IDC_GREEN;
			if (BST_CHECKED == IsDlgButtonChecked(hDlg, IDC_BLACK)) iColorButton = IDC_BLACK;
			InvalidateRect(GetParent(hDlg), 0, TRUE);
			UpdateTextDialog();
			return TRUE;
{'fraction_non_alphanumeric': 0.11836458098034787, 'fraction_numerical': 0.0112943302462164, 'mean_word_length': 5.0, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7621406', 'n_tokens_mistral': 1882, 'n_tokens_neox': 1770, 'n_words': 360}