程式語言 - Wine - C/C++ - Use ChooseFont Dialog



參考資訊:
http://www.winprog.org/tutorial/
http://winapi.freetechsecrets.com/win32/
https://github.com/gammasoft71/Examples_Win32
http://masm32.com/board/index.php?topic=3584.0
https://learn.microsoft.com/en-us/windows/win32/winmsg/window-styles

main.c

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
 
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
    LOGFONT stLog = { 0 };
    CHOOSEFONT stFont = { 0 };
 
    stFont.lStructSize = sizeof(CHOOSEFONT);
    stFont.lpLogFont = &stLog;
    stFont.Flags = CF_SCREENFONTS | CF_EFFECTS | CF_INITTOLOGFONTSTRUCT;
    if (ChooseFont(&stFont)) {
        char buf[255] = { 0 };

        sprintf(buf, "font=%s", stLog.lfFaceName);
        MessageBox(NULL, buf, "", MB_OK);
    }

    return 0;
}

編譯、執行

$ winegcc main.c -o main -lcomdlg32
$ wine main.exe.so