-1
 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pScmdline, int iCmdshow)

In this line, are these statements about the call parameters correct?

HINSTANCE is a class and hInstance and hPrevInstance are objects, PSTR is a class and pScmdline is an object and int is a class and iCmdshow is an object ?

paisanco
  • 4,098
  • 6
  • 27
  • 33
Inder Gill
  • 145
  • 6

2 Answers2

2

Firstly, an object is a location in memory having a value and possibly referenced by an identifier. An object can be a variable, a data structure, or a function.

A class is an extensible program-code-template for creating objects, providing initial values for state (member variables) and implementations of behavior (member functions, methods).

 int WINAPI WinMain:

- it's the function used as EntryPoint of Win32 projects.

 HINSTANCE = Handle INSTANCE:

- it's a void pointer(void, int, bool... are types), not a class, is the base address of the module in memory.

 hInstance and hPrevInstance:

- are parameters of the WinMain function, hInstance is the handle to the current instance of the application, and the hPrevInstance is a handle to the previous instance of the application, hPrevInstance is always NULL. yes, this is an object because it's in some location in the memory.

PSTR:

- it's a pointer of a 8bit string

pScmdline:

- The command line for the application. it's also an object.

int:

- Is a type not a class.

iCmdshow:

- it controls how the window is to be shown (minimized, maximized, hidden...), it's an object of a type.

see this question about the difference between types and class: What is the difference between Type and Class?

Community
  • 1
  • 1
FelipeDurar
  • 1,163
  • 9
  • 15
0

HINSTANCE is void * which is not a class, neither is int a class. They are types.

Please see this link for a definition of these types.

https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751%28v=vs.85%29.aspx

Neil Kirk
  • 21,327
  • 9
  • 53
  • 91
  • IIRC, defining `STRICT` will cause each `H____` to be its own separate pointer type instead of just `void*`. – chris Mar 01 '15 at 03:06