Hi guys,
I want to get console fonts with win32 apis but i couldnt
Here is my code:
func KernelGetConsoleHandle() (e syscall.Handle) {
hwnd, _, _ := procGetConsoleWindow.Call()
return syscall.Handle(hwnd)
}
func KernelGetConsoleFont(maximumWindows bool) *CONSOLE_FONT_INFOEX {
in, err := syscall.GetStdHandle(syscall.STD_OUTPUT_HANDLE)
if err != nil {
fmt.Println("Could not get std handle")
return nil
}
fmt.Println(in)
var cfi CONSOLE_FONT_INFOEX
cfi.Size = uint64(unsafe.Sizeof(cfi))
mWindows := 0
if maximumWindows {
mWindows = 1
}
console, _, _ := procGetCurrentConsoleFontEx.Call(uintptr(in), uintptr(mWindows), uintptr(unsafe.Pointer(&cfi)))
fmt.Println("cfi", cfi)
if console == 0 {
fmt.Println(syscall.Errno(GetLastError()))
}
fmt.Println("console", console)
return &cfi
}
type CONSOLE_FONT_INFOEX struct {
Size uint64
Font uint32
FontSize COORD
FontFamily uint64
FontWeight uint64
FaceName [64]byte
}
type COORD struct {
X int16
Y int16
}
cfi := *win32.KernelGetConsoleFont(false)
I couldnt get filled cfi struct in KernelGetConsoleFont. Im not sure if this CONSOLE_FONT_INFOEX struct is correct either.
How can i solve this problem?