Recently I started learning WIN API from Microsoft documentation and I decided to look at every detail with my IDE features. LoadIconA is a function that takes HINSTANCE and LPCSTR as parameters. we pass IDI_APPLICATION as the second parameter. This is a macro That expands as
#define IDI_APPLICATION MAKEINTRESOURCE(32512) // winuser.h
Moreover, MAKEINTRESOURCE expands as ANSI or UNICODE equivalent. I am looking at ANSI equivalent.
#define MAKEINTRESOURCEA(i) ((LPSTR)((ULONG_PTR)((WORD)(i)))) // winuser.h
This where I noticed that integer I (here 32512) is ultimately typecasted into LPSTR which is passed into the LoadIconA function. But when I do the same as
#include <windows.h>
#include <iostream>
int main(){
LPCSTR hello = MAKEINTRESOURCEA(32512);
std::cout << hello << std::endl;
}
My program crashes. Does someone have any idea what's going over here?
Also, I didn't notice any library dependencies. sorry for the Ques Title, I didn't find any Proper title.