Quote:
Public Declare Function CreateFont Lib "gdi32" Alias "CreateFontA" (ByVal H As Long, ByVal W As Long, ByVal E As Long, ByVal O As Long, ByVal W2 As Long, ByVal I As Long, ByVal u As Long, ByVal S As Long, ByVal C As Long, ByVal OP As Long, ByVal CP As Long, ByVal Q As Long, ByVal PAF As Long, ByVal F As String) As IntPtr
As per
my response to your previous question[
^], your P/Invoke declaration is wrong.
Private Declare Function CreateFont Lib "gdi32" Alias "CreateFontA" (_
ByVal nHeight As Integer, ByVal nWidth As Integer, _
ByVal nEscapement As Integer, ByVal nOrientation As Integer, _
ByVal fnWeight As Integer, ByVal fdwItalic As Integer, _
ByVal fdwUnderline As Integer, ByVal fdwStrikeOut As Integer, _
ByVal fdwCharSet As Integer, ByVal fdwOutputPrecision As Integer, _
ByVal fdwClipPrecision As Integer, ByVal fdwQuality As Integer, _
ByVal fdwPitchAndFamily As Integer, ByVal lpszFace As String _
) As IntPtr
CreateFontA function (wingdi.h) - Win32 apps | Microsoft Docs[
^]
pinvoke.net: CreateFont (gdi32)[
^]
You are almost consistently using
Long
- a 64-bit integer - when you should be using
Integer
- a 32-bit integer.
That suggests to me that you are trying to convert code from VB6, where
Integer
was 16-bit and
Long
was 32-bit.
(The SendMessage
declaration looks OK to me.)