Please Correct this Code about "ChooseFont Structure"

Aquí puedes preguntar o compartir tus dudas y conocimientos acerca del programa
hi all

i have activated the Memory Action Plugin and Create this Code "ChooseFont Structure" from this Page
https://msdn.microsoft.com/en-us/librar ... 85%29.aspx
local str = Memory.CreateStructure("long, long, long, long, long, long, long, long, long, long, long, long, long, long, long");
 
 Memory.SetStructureData(str, 1, 0, Memory.Size(str), "");
 Memory.SetStructureData(str, 2, 0, Application.GetWndHandle(), "");
 
 Memory.SetStructureData(str, 5, 0, 10, "");
 
 Memory.SetStructureData(str, 6, 0, 256, ""); 
 
 Memory.SetStructureData(str, 7, 0, 255, "");
 
 Memory.SetStructureData(str, 13, 0, 1024, "");
 Memory.SetStructureData(str, 14, 0, 6, "");
 
 local result = DLL.CallFunction("comdlg32.dll", "ChooseFontA", str, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);

Memory.FreeStructure(str);
it is Work Good for Show the Font Dialog Imagen
Imagen But i want to get all returns But I can not know what it is the returns name Which can catch it :hypno: :hypno: :hypno:

Help Me ........ Please Correct this Code So can find all returns
So they can be used later

Imagen Note : I know that there are many of the Plugin can perform the required, but I do not want to use any One Of Them .
veamos :pc: :pc: :pc:
this is the last But it is not completely incomplete :

Código: Seleccionar todo

local _LogFont = Memory.CreateStructure("long, long, long, long, long, long, long, long, long, long, long, long, long, long");
 Memory.SetStructureData(_LogFont, 1, 0, "<0", "");
 Memory.SetStructureData(_LogFont, 2, 0, "0", "");
 Memory.SetStructureData(_LogFont, 3, 0, "20", "");
 Memory.SetStructureData(_LogFont, 4, 0, "20", "");
 Memory.SetStructureData(_LogFont, 5, 0, "400", "");
 
 Memory.SetStructureData(_LogFont, 6, 0, true, ""); --Italic
 
 Memory.SetStructureData(_LogFont, 7, 0, true, "");  --Underline
 Memory.SetStructureData(_LogFont, 8, 0, true, "");  --StrikeOut
 Memory.SetStructureData(_LogFont, 9, 0, "0xB2", "");  --ARABIC_CHARSET
 Memory.SetStructureData(_LogFont, 10, 0, "OUT_TT_PRECIS", "");  --OutPrecision  
 Memory.SetStructureData(_LogFont, 11, 0, "CLIP_DEFAULT_PRECIS", "");   --ClipPrecision
 Memory.SetStructureData(_LogFont, 12, 0, "0x04", "");    --FontQuality
 Memory.SetStructureData(_LogFont, 13, 0, "1", "");    --PitchAndFamily  FIXED_PITCH

 Memory.SetStructureData(_LogFont, 14, 0, "Arial", "");    --FaceName

local str = Memory.CreateStructure("long, long, long, long, long, long, long, long, long, long, long, long, long, long, long");

 Memory.SetStructureData(str, 1, 0, Memory.Size(str), "");
 Memory.SetStructureData(str, 2, 0, Application.GetWndHandle(), "");
 
 Memory.SetStructureData(str, 4, 0, _LogFont, "");
 
 Memory.SetStructureData(str, 5, 0, "0x00000100", "");
 
 Memory.SetStructureData(str, 6, 0, "0x00000100", "");   --Flags
 
 Memory.SetStructureData(str, 7, 0, "255", "");
 
 Memory.SetStructureData(str, 8, 0, "", "");
 
 Memory.SetStructureData(str, 9, 0, "", "");
 Memory.SetStructureData(str, 10, 0, "", "");
 Memory.SetStructureData(str, 11, 0, "", "");
 Memory.SetStructureData(str, 12, 0, "", "");
 
 Memory.SetStructureData(str, 13, 0, "0x0100", "");  --BOLD_FONTTYPE
 Memory.SetStructureData(str, 14, 0, 6, "");
 
 
 local result = DLL.CallFunction("comdlg32.dll", "ChooseFontA", str, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);

 if result~=false then
     _c = Memory.GetStructureData(str, 5, 0, "");  --  _GetFontSize

     Dialog.Message("", _c);
 end 
Memory.FreeStructure(_LogFont);
Memory.FreeStructure(str);
where are you Pabloko :) :rofl: I'm stuck in a problem
i will be honest
Before you can get any returns
try to understand c variables

long values are just numbers :google:
But you declare long values Structure
then you fill them with Strings and Booleans :normas: ????
then you wait for returns ??

the only good return here is :-
Return to c basics :)
As geneus points youre creating structs with incorrect size, use documentation of that plugin to know if you are using bytes, words, dword/char, long, double or any other kind of data that consumes different memory lenghts.

Also to set strings allocate it with corresponding method of memory api, then use the ptr on the structure, anyways, as i see in your coude youre setting some flags as string instead the correct value.

I dont know api for this plugin so i cannot help, but also its weird that you store numbers with strings, thats some weird ass api.
Thanks to Mr/ Sajjadkhati from another forum :
for Get Font Name :

local _LogFont = Memory.CreateStructure("long, long, long, long, long, byte, byte, byte, byte, byte, byte, byte, byte, char[32]");
 Memory.SetStructureData(_LogFont, 1, 0, "<0", "");
 Memory.SetStructureData(_LogFont, 2, 0, "0", "");
 Memory.SetStructureData(_LogFont, 3, 0, "20", "");
 Memory.SetStructureData(_LogFont, 4, 0, "20", "");
 Memory.SetStructureData(_LogFont, 5, 0, "400", "");
 
 Memory.SetStructureData(_LogFont, 6, 0, true, ""); --Italic
 
 Memory.SetStructureData(_LogFont, 7, 0, true, "");  --Underline
 Memory.SetStructureData(_LogFont, 8, 0, true, "");  --StrikeOut
 Memory.SetStructureData(_LogFont, 9, 0, "0xB2", "");  --ARABIC_CHARSET
 Memory.SetStructureData(_LogFont, 10, 0, "OUT_TT_PRECIS", "");  --OutPrecision  
 Memory.SetStructureData(_LogFont, 11, 0, "CLIP_DEFAULT_PRECIS", "");   --ClipPrecision
 Memory.SetStructureData(_LogFont, 12, 0, "0x04", "");    --FontQuality
 Memory.SetStructureData(_LogFont, 13, 0, "1", "");    --PitchAndFamily  FIXED_PITCH
Memory.SetStructureData(_LogFont, 14, 4, 73, "");    --FaceName "Impact"
 	 Memory.SetStructureData(_LogFont, 14, 5, 109, "");    --FaceName "Impact"
 	 Memory.SetStructureData(_LogFont, 14, 6, 112, "");    --FaceName "Impact"
 	 Memory.SetStructureData(_LogFont, 14, 7, 97, "");    --FaceName "Impact"
 	 Memory.SetStructureData(_LogFont, 14, 8, 99, "");    --FaceName "Impact"
 	 Memory.SetStructureData(_LogFont, 14, 9, 116, "");    --FaceName "Impact"

	 
 
 
local str = Memory.CreateStructure("long, long, long, long, long, long, long, long, long, long, long, long, long, long, long");
 Memory.SetStructureData(str, 1, 0, Memory.Size(str), "");
 Memory.SetStructureData(str, 2, 0, Application.GetWndHandle(), "");
 
 Memory.SetStructureData(str, 4, 0, _LogFont, "");
 
 Memory.SetStructureData(str, 5, 0, "0x00000100", "");
 
 Memory.SetStructureData(str, 6, 0, "0x00000100", "");   --Flags
 
 Memory.SetStructureData(str, 7, 0, "255", "");
 
 Memory.SetStructureData(str, 8, 0, "", "");
 
 Memory.SetStructureData(str, 9, 0, "", "");
 Memory.SetStructureData(str, 10, 0, "", "");
 Memory.SetStructureData(str, 11, 0, "", "");
 Memory.SetStructureData(str, 12, 0, "", "");
 
 Memory.SetStructureData(str, 13, 0, "0x0100", "");  --BOLD_FONTTYPE
 Memory.SetStructureData(str, 14, 0, 6, "");
 
 
 
 local isOkSelect = DLL.CallFunction("comdlg32.dll", "ChooseFontA", str, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);  -- فراخوني تابع ChooseFont که در فايل Comdlg32.dll هست

if (tonumber(isOkSelect) == 1) then  
    myString = Memory.GetString(_LogFont + 28, -1, "Ascii");
	Dialog.Message("Notice", myString, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
end