flat assembler
Message board for the users of flat assembler.

Index > Windows > problem with ChooseFontA in 64 bits

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1088
Roman
I found this msdn tutorial.
https://docs.microsoft.com/ru-ru/windows/win32/dlgbox/using-common-dialog-boxes?redirectedfrom=MSDN

But i not see dialog menu ChooseFontA
Post 04 Jan 2021, 13:43
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1088
Roman
This work in 32 bit program and i see dialog CHOOSEFONT:
Code:
        mov    [cf.lStructSize],sizeof.CHOOSEFONT
        mov    [cf.lpLogFont],tmp_font
        mov    [cf.Flags], CF_SCREENFONTS + CF_EFFECTS
        mov    ebx,[hwnd]
        mov    [cf.hwndOwner],ebx
        invoke  ChooseFontA,cf

;this code work too
        mov    [cf.lStructSize],sizeof.CHOOSEFONT
        mov    [cf.lpLogFont],tmp_font
        ;mov    [cf.Flags], CF_SCREENFONTS + CF_EFFECTS
        ;mov    ebx,[hwnd]
        ;mov    [cf.hwndOwner],ebx
        invoke  ChooseFontA,cf
    


But not work in 64 bit. I not see anything messages or dialogs windows.
Post 04 Jan 2021, 13:48
View user's profile Send private message Reply with quote
Ali.Z



Joined: 08 Jan 2018
Posts: 510
Ali.Z
why not debugging your code and see what happens, or at least show what error code you got?

extras:
- who is the owner? (hwnd represent what control)
- this is definitely not fasmw issue

_________________
Asm For Wise Humans
Post 04 Jan 2021, 14:03
View user's profile Send private message Reply with quote
Walter



Joined: 26 Jan 2013
Posts: 151
Walter
In the file COMDLG64.inc (CHOOSEFONT), does lCustData have correct definition?

Code:
struct CHOOSEFONT
  lStructSize    dd ?,?
  hwndOwner      dq ?
  hDC            dq ?
  lpLogFont      dq ?
  iPointSize     dd ?
  Flags          dd ?
  rgbColors      dd ?
  lCustData      dd ?
  lpfnHook       dq ?
  lpTemplateName dq ?
  hInstance      dq ?
  lpszStyle      dq ?
  nFontType      dw ?
  wReserved      dw ?
  nSizeMin       dd ?
  nSizeMax       dd ?
ends
    
Post 04 Jan 2021, 16:07
View user's profile Send private message Reply with quote
Mikl___



Joined: 30 Dec 2014
Posts: 123
Location: Russian Federation, Irkutsk
Mikl___
it is masm
Code:
WndProc proc hwnd:qword,uMsg:qword,wParam:qword,lParam:qword
local cf:CHOOSEFONT
local lf:LOGFONT
        mov hwnd,rcx
        mov wParam,r8
        mov lParam,r9
        xor ebx,ebx

        mov ecx,(sizeof CHOOSEFONT)/4
        xor eax,eax
        lea edi,cf
        rep stosd
        mov cf.lStructSize,sizeof CHOOSEFONT
        mov rax,hwnd
        mov cf.hwndOwner,rax
        lea eax,lf
        mov cf.lpLogFont,rax
        mov eax,rgbCurrent
        mov cf.rgbColors,eax
        mov cf.Flags,CF_SCREENFONTS or CF_EFFECTS
        lea ecx,cf
        invoke ChooseFont    

_________________
wasm.in


Last edited by Mikl___ on 12 Jan 2021, 15:35; edited 1 time in total
Post 04 Jan 2021, 16:20
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1088
Roman
Now work in 64 bits ! And now i see dialog choose fonts !
Code:
cf CHOOSEFONT
tmp_font LOGFONT

Code:
mov    [cf.lStructSize],sizeof.CHOOSEFONT+12
mov    [cf.lpLogFont],tmp_font
;mov    [cf.Flags], CF_SCREENFONTS + CF_EFFECTS
invoke  ChooseFont,cf 
    


Mikl___ please show masm struct CHOOSEFONT.
Post 04 Jan 2021, 20:46
View user's profile Send private message Reply with quote
Mikl___



Joined: 30 Dec 2014
Posts: 123
Location: Russian Federation, Irkutsk
Mikl___
Hi, Roman!
Code:
CHOOSEFONTA STRUC
        lStructSize             DWORD ?
                                DWORD ?
        hwndOwner               HWND ?
        hDC                     HDC ?
        lpLogFont               LPLOGFONT ?
        iPointSize              UINT ?
        Flags                   DWORD ?
        rgbColors               COLORREF ?
                                DWORD ?
        lCustData               LPARAM ?
        lpfnHook                LPCFHOOKPROC ?
        lpTemplateName          LPSTR ?
        hInstance               HINSTANCE ?
        lpszStyle               LPSTR ?
        nFontType               WORD ?
                                WORD ?
        nSizeMin                UINT ?
        nSizeMax                UINT ?
                                DWORD ?
CHOOSEFONTA ENDS    


Description:
Download
Filename: fonts.zip
Filesize: 9.48 KB
Downloaded: 230 Time(s)


_________________
wasm.in
Post 12 Jan 2021, 15:27
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.