I am trying to create a simple application that captures the desktop screen,
however, not able to find much information about how to do this. I have been
looking for some time and have had no luck. Please help. Please see the code
below.
import winim
let window = FindWindow("Window Title", nil) let rect = GetWindowRect(window)
let screenshot = captureWindow(rect.left, rect.top, rect.right - rect.left,
rect.bottom - rect.top) let filename = "window_screenshot.png" var file =
File.open(filename, "wb") file.write_png(screenshot.width, screenshot.height,
screenshot.pixels) file.close()
Error -
C:UsersuserDocumentsnimcodetest6.nim(4, 25) Error: type mismatch: got <HWND>
but expected one of:
proc GetWindowRect(hWnd: HWND; lpRect: LPRECT): WINBOOL
first type mismatch at position: 2 missing parameter: lpRect
expression: GetWindowRect(window)