Answer the question
In order to leave comments, you need to log in
Literature or resources on WinAPI?
Friends. After reading K&R, I decided to immediately try to look at WinAPI. I downloaded the book System Programming in the Windows Environment from Hart. Judging by the versions of Windows that he calls, he does not even mention XP. That is, the book is apparently ancient. not a drop. Even the first code from that book does not compile, outputting a crazy number of warnings and errors
C:\Users\folle\Documents\wapi\vax\winapi.c:8:8: error: conflicting types for 'hIn'
DWORD hIn, hOut;
^
C:\Users\folle\Documents\wapi\vax\winapi.c:7:9: note: previous declaration of 'hIn' was here
HANDLE hIn, hOut;
^
C:\Users\folle\Documents\wapi\vax\winapi.c:8:13: error: conflicting types for 'hOut'
DWORD hIn, hOut;
^
C:\Users\folle\Documents\wapi\vax\winapi.c:7:14: note: previous declaration of 'hOut' was here
HANDLE hIn, hOut;
^
C:\Users\folle\Documents\wapi\vax\winapi.c:15:7: warning: assignment makes integer from pointer without a cast [-Wint-conversion]
hIn = CreateFile(argv [1], GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
^
C:\Users\folle\Documents\wapi\vax\winapi.c:16:12: warning: comparison between pointer and integer
if (hIn == INVALID_HANDLE_VALUE)
^
C:\Users\folle\Documents\wapi\vax\winapi.c:22:8: warning: assignment makes integer from pointer without a cast [-Wint-conversion]
hOut = CreateFile(argv[2], GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
^
C:\Users\folle\Documents\wapi\vax\winapi.c:23:12: warning: comparison between pointer and integer
if (hOut == INVALID_HANDLE_VALUE)
^
C:\Users\folle\Documents\wapi\vax\winapi.c:28:20: warning: passing argument 1 of 'ReadFile' makes pointer from integer without a cast [-Wint-conversion]
while (ReadFile(hIn, Buffer, BUF_SIZE, &hIn, NULL) && hIn > 0)
^
In file included from c:\mingw\include\windows.h:44:0,
from C:\Users\folle\Documents\wapi\vax\winapi.c:1:
c:\mingw\include\winbase.h:2013:24: note: expected 'HANDLE {aka void *}' but argument is of type 'DWORD {aka long unsigned int}'
WINBASEAPI BOOL WINAPI ReadFile(HANDLE,PVOID,DWORD,PDWORD,LPOVERLAPPED);
^
C:\Users\folle\Documents\wapi\vax\winapi.c:30:14: warning: passing argument 1 of 'WriteFile' makes pointer from integer without a cast [-Wint-conversion]
WriteFile(hOut, Buffer, hIn, &hOut, NULL);
^
In file included from c:\mingw\include\windows.h:44:0,
from C:\Users\folle\Documents\wapi\vax\winapi.c:1:
c:\mingw\include\winbase.h:2207:24: note: expected 'HANDLE {aka void *}' but argument is of type 'DWORD {aka long unsigned int}'
WINBASEAPI BOOL WINAPI WriteFile(HANDLE,PCVOID,DWORD,PDWORD,LPOVERLAPPED);
^
C:\Users\folle\Documents\wapi\vax\winapi.c:38:15: warning: passing argument 1 of 'CloseHandle' makes pointer from integer without a cast [-Wint-conversion]
CloseHandle(hIn);
^
In file included from c:\mingw\include\windows.h:44:0,
from C:\Users\folle\Documents\wapi\vax\winapi.c:1:
c:\mingw\include\winbase.h:1328:24: note: expected 'HANDLE {aka void *}' but argument is of type 'DWORD {aka long unsigned int}'
WINBASEAPI BOOL WINAPI CloseHandle(HANDLE);
^
C:\Users\folle\Documents\wapi\vax\winapi.c:39:15: warning: passing argument 1 of 'CloseHandle' makes pointer from integer without a cast [-Wint-conversion]
CloseHandle(hOut);
^
In file included from c:\mingw\include\windows.h:44:0,
from C:\Users\folle\Documents\wapi\vax\winapi.c:1:
c:\mingw\include\winbase.h:1328:24: note: expected 'HANDLE {aka void *}' but argument is of type 'DWORD {aka long unsigned int}'
WINBASEAPI BOOL WINAPI CloseHandle(HANDLE);
^
Answer the question
In order to leave comments, you need to log in
From the literature - Richter, Petzold, from the reference book - MSDN. Again, the literature needs to be read only in order to understand the basics of WinAPI, much of the same Petzold is outdated, but work with the GUI is widely described there. Richter is already more advanced stuff API level kernel.
MSDN is the only and accurate source for information about Windows and other MS products
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question