Pelles C > Add-ins

Pick a Font AddIn

(1/2) > >>

Grincheux:
I made this addin because I have lost my snippets too often.
This one genrate source code for Assembleur and C


--- Quote ---                           .Data
                           ALIGN   4

szMyFont      BYTE         "Verdana",0

                           .Code

                           ALIGN   16

                        MOV      RAX,OFFSET szMyFont                  ;   

                        MOV      QWORD PTR [rsp + 68h],RAX             ;   LOGFONT.lfFaceName
                        MOV      DWORD PTR [rsp + 60h],34              ;   LOGFONT.lfPitchAndFamily
                        MOV      DWORD PTR [rsp + 58h],1               ;   LOGFONT.lfQuality
                        MOV      DWORD PTR [rsp + 50h],2               ;   LOGFONT.lfClipPrecision
                        MOV      DWORD PTR [rsp + 48h],3               ;   LOGFONT.lfOutPrecision
                        MOV      DWORD PTR [rsp + 40h],0               ;   LOGFONT.lfCharSet (0 = ANSI_CHARSET)
                        MOV      DWORD PTR [rsp + 38h],0               ;   LOGFONT.lfStrikeOut
                        MOV      DWORD PTR [rsp + 30h],0               ;   LOGFONT.lfUnderline
                        MOV      DWORD PTR [rsp + 28h],0               ;   LOGFONT.lfItalic
                        MOV      DWORD PTR [rsp + 20h],700             ;   LOGFONT.lfWeight
                        XOR      R9D,R9D                               ;   LOGFONT.lfOrientation
                        XOR      R8D,R8D                               ;   LOGFONT.lfEscapement
                        MOV      EDX,0                                 ;   LOGFONT.lfWidth
                        MOV      ECX,-19                               ;   LOGFONT.lfHeight

                        CALL   CreateFontA                             ;

                        TEST   RAX,RAX                                 ;
                        JZ      @FontNotCreated                        ; You must define this label

                        MOV      _hYourFont,RAX                        ;

;   ****************************************************************************************************************************
;   * Don't forget to send : "SendMessage(hYourWindow,WM_SETFONT,(WPARAM) hYourFont,TRUE) ;" for using the font with a control *
;   * "WM_SETFONT" is defined as "#define WM_SETFONT 0x0030"                                                                   *
;   * Don't forget to delete the font on exit "DeleteObject(hYourFont) ;" generaly in WM_DESTROY message                       *
;   * Don't forget to add "PARAMAREA = 14* QWORD" on the "PROC" line                                                           *
;   ****************************************************************************************************************************
--- End quote ---
The C source code:

--- Quote ---   hYourFont = CreateFont(-96,0,0,0,700,0,1,1,0,3,2,1,2,"David Libre") ;

   if(!hYourFont)
      goto   ErrorFont ;

//   ****************************************************************************************************************************
//   * Don't forget to send : "SendMessage(hYourWindow,WM_SETFONT,(WPARAM) hYourFont,TRUE) ;" for using the font with a control *
//   * "WM_SETFONT" is defined as "#define WM_SETFONT 0x0030"                                                                   *
//   * Don't forget to delete the font on exit "DeleteObject(hYourFont) ;" generaly in WM_DESTROY message                       *
//   ****************************************************************************************************************************
--- End quote ---

John Z:
That was fast - I'll give it a go.

John Z

Update:  Yup, it worked.  Inserted the code right in my C program  ;)

John Z

TimoVJL:
Nice to see new Add-Ins :)

Grincheux:
I made it because it is difficult to do something without seeing what we do.
Because it was too long to do in assembly.
Now I will make others with CreateWindow, Create ListView and toolBar.
All of this was into my snippets but I re-installed Pelle and lost them.
I said to my self that it would be better if I had a program that creates the snippets.


I am happy to read you Timo.

TimoVJL:
Similar Add-In
InsertText Add-In

Navigation

[0] Message Index

[#] Next page

Go to full version