_LogFont = Memory.CreateStructure("long, long, long, long, long, byte, byte, byte, byte, byte, byte, byte, byte, long"); -- استراکچر مربوط به اطلاعات LOGFONT
Memory.SetStructureData(_LogFont, 1, 0, 0, ""); -- lfHeight
Memory.SetStructureData(_LogFont, 2, 0, 0, ""); -- lfWidth
Memory.SetStructureData(_LogFont, 3, 0, 0, ""); -- lfEscapement
Memory.SetStructureData(_LogFont, 4, 0, 0, ""); -- lfOrientation
Memory.SetStructureData(_LogFont, 5, 0, 400, ""); -- lfWeight
Memory.SetStructureData(_LogFont, 6, 0, 1, ""); --Italic
Memory.SetStructureData(_LogFont, 7, 0, 1, ""); --Underline
Memory.SetStructureData(_LogFont, 8, 0, 1, ""); --StrikeOut
Memory.SetStructureData(_LogFont, 9, 0, 0, ""); --Ansi_CHARSET
Memory.SetStructureData(_LogFont, 10, 0, "OUT_TT_PRECIS", ""); --OutPrecision
Memory.SetStructureData(_LogFont, 11, 0, "CLIP_DEFAULT_PRECIS", ""); --ClipPrecision
Memory.SetStructureData(_LogFont, 12, 0, 4, ""); --FontQuality
Memory.SetStructureData(_LogFont, 13, 0, 1, ""); --PitchAndFamily FIXED_PITCH
Memory.SetStructureData(_LogFont, 14, 0, 0, ""); --FaceName
str = Memory.CreateStructure("long, long, long, long, long, long, long, long, long, long, long, long, long, long, long"); -- استراکچري که مربوط به اطلاعاتاستراکچر CHOOSEFONT هست
Memory.SetStructureData(str, 1, 0, Memory.Size(str), ""); -- lStructSize
Memory.SetStructureData(str, 2, 0, Application.GetWndHandle(), ""); -- hwndOwner
Memory.SetStructureData(str, 4, 0, _LogFont, ""); -- lpLogFont
Memory.SetStructureData(str, 5, 0, "0x00000100", ""); -- iPointSize
Memory.SetStructureData(str, 6, 0, "0x00000100", ""); --Flags
Memory.SetStructureData(str, 7, 0, "255", ""); -- rgbColors
Memory.SetStructureData(str, 8, 0, "", ""); -- lCustData
Memory.SetStructureData(str, 9, 0, "", ""); -- lpfnHook
Memory.SetStructureData(str, 10, 0, "", ""); -- lpTemplateName
Memory.SetStructureData(str, 11, 0, "", ""); -- hInstance
Memory.SetStructureData(str, 12, 0, "", ""); -- lpszStyle
Memory.SetStructureData(str, 13, 0, "0x0100", ""); --nFontType BOLD_FONTTYPE
Memory.SetStructureData(str, 14, 0, 6, ""); -- nSizeMin
local isOkSelect = DLL.CallFunction("comdlg32.dll", "ChooseFontA", str, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL); -- فراخوني تابع ChooseFont که در فايل Comdlg32.dll هست
if (tonumber(isOkSelect) == 1) then -- اگر کاربر ok را انتخاب کرد
fPtr = Memory.GetStructureData(_LogFont, 14, 0, ""); -- اطلاعات ذخيره شده در چهاردهمين استراکچر استراکچر _LogFont رو بگير
Dialog.Message("Notice", fPtr, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
end