You will probably try to create a interactive graphical application that looks like a formal application in .NET. You can define a font for a form, and all its children inherit this font. A similar situation exists in every dialog box.
How to create a Win32 API dialog box, which you can read here: http://msdn.microsoft.com/en-us/library/ms644996%28VS.85%29.aspx . The main difference in dialog programming compared to creating forms is that you must use a resource editor (for example, inside Visual Studio or the Windows SDK) to develop dialogs. The results will be saved in an RC file (not yet compiled resource file). The results will look like this:
IDD_ABOUTBOX DIALOGEX 0, 0, 205, 98 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "About" FONT 8, "MS Shell Dlg 2", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "OK",IDOK,77,77,50,14 LTEXT "Trust to User (T2U) v1.0\n\n(c) Copyright 2003, 2004", IDC_STATIC,72,32,120,32 ICON IDR_MAINFRAME,IDC_STATIC,25,27,20,20 GROUPBOX "",IDC_STATIC,7,3,191,69 LTEXT "OK soft GmbH",IDC_OK_SOFT_GMBH,72,16,120,8 END
you can have more than one resource in different languages โโstored in the same RC file:
IDD_ABOUTBOX DIALOGEX 0, 0, 205, 98 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "ใใผใธใงใณใฎๆ
ๅ ฑ" FONT 8, "MS Shell Dlg 2", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "OK",IDOK,77,77,50,14 LTEXT "Trust to User (T2U) v1.0\n\n(c) Copyright 2003, 2004", IDC_STATIC,72,32,120,32 ICON IDR_MAINFRAME,IDC_STATIC,25,27,20,20 GROUPBOX "",IDC_STATIC,7,3,191,69 LTEXT "OK soft GmbH",IDC_OK_SOFT_GMBH,72,16,120,8 END
You will get the best results in case of internationalization if you use "MS Shell Dlg 2" or "MS Shell Dlg" instead of the font "Tahoma", but direct use of "Tahoma" is also possible:
FONT 8, "Tahoma"
You should use "MS Shell Dlg 2" with the DS_SHELLFONT flag or a combination of DS_FIXEDSYS and DS_SETFONT (see http://blogs.msdn.com/oldnewthing/archive/2005/02/07/368423.aspx ), which follows the use "Tahoma" on most computers (check the value of "MS Shell Dlg 2" in the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes ). Read http://msdn.microsoft.com/en-us/library/dd374112%28v=VS.85%29.aspx or http://support.microsoft.com/kb/282187/en about this.
By the way, you can open a resource stored in EXE, DLL or EXE.MUI / DLL.MUI in relation to Visual Studio. You just have to open the file and select "Open with" and select "Resoure Editor". In window 7, you can find C:\Windows\winsxs\x86_microsoft-windows-notepad and open a file such as C:\Windows\winsxs\x86_microsoft-windows-notepad.resources_31bf3856ad364e35_6.1.7600.16385_en-us_1dbc2e35304db501\notepad.exe.mui . Then you can save the file as notepad.rc , and then open the notepad.rc file in a text editor, and you will find the following snippets
15 DIALOGEX 30, 17, 300, 22 STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_CLIPSIBLINGS FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "&Encoding:",259,68,1,40,40,NOT WS_GROUP COMBOBOX 257,130,0,164,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_GROUP | WS_TABSTOP END 51200 DIALOGEX 0, 0, 324, 140 STYLE DS_SETFONT | DS_3DLOOK | WS_CHILD | WS_CAPTION CAPTION "Software Licensing" FONT 9, "Segoe UI", 0, 0, 0x0 BEGIN LTEXT "To use this feature without interruption, this computer needs to be running genuine Windows.",-1,0,10,250,20 LTEXT "With genuine Windows you have access to all Windows updates and can be confident that your Windows software has the latest security and reliability enhancements from Microsoft.",-1,0,35,250,30 CONTROL 51209,-1,"Static",SS_BITMAP,260,10,100,55 CONTROL "&Resolve online now",51201,"Button",BS_COMMANDLINK | BS_LEFT | WS_TABSTOP,0,75,250,24 CONTROL "<a>Read the privacy statement online</a>",51202,"SysLink",WS_TABSTOP,0,128,120,10 END
UPDATED . Try changing the WndProc function to the following:
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { static HWND hwndEdit; static HWND hwndButton; static int len; static TCHAR text[30]; HFONT hFont; LOGFONT lf; switch(msg) { case WM_CREATE: hwndEdit = CreateWindow(TEXT("Edit"), NULL, WS_CHILD | WS_VISIBLE | WS_BORDER, 50, 50, 150, 20, hwnd, (HMENU) ID_EDIT, NULL, NULL); GetObject (GetStockObject(DEFAULT_GUI_FONT), sizeof(LOGFONT), &lf); hFont = CreateFont (lf.lfHeight, lf.lfWidth, lf.lfEscapement, lf.lfOrientation, lf.lfWeight, lf.lfItalic, lf.lfUnderline, lf.lfStrikeOut, lf.lfCharSet, lf.lfOutPrecision, lf.lfClipPrecision, lf.lfQuality, lf.lfPitchAndFamily, lf.lfFaceName); SendMessage (hwndEdit, WM_SETFONT, (WPARAM)hFont, TRUE); hwndButton = CreateWindow( TEXT("button"), TEXT("Set Title"), WS_VISIBLE | WS_CHILD, 50, 100, 80, 25, hwnd, (HMENU) ID_BUTTON, NULL, NULL); SendMessage (hwndButton, WM_SETFONT, (WPARAM)hFont, TRUE); break; case WM_DESTROY: PostQuitMessage(0); break; } return DefWindowProc(hwnd, msg, wParam, lParam); }