I dont understand this...I see this inside () is struct and BOOL is typedef for int actually ???? ,but what is (WINAPI *_CreateProcess) ?????

its loks like typedef <type><type><list of types> ?????

Can some one explain this?

typedef BOOL (WINAPI *_CreateProcess)(   //BOOL is int???
  LPCTSTR lpApplicationName,
  LPTSTR lpCommandLine,
  LPSECURITY_ATTRIBUTES lpProcessAttributes,
  LPSECURITY_ATTRIBUTES lpThreadAttributes,
  BOOL bInheritHandles,
  DWORD dwCreationFlags,
  LPVOID lpEnvironment,
  LPCTSTR lpCurrentDirectory,
  LPSTARTUPINFO lpStartupInfo,
  LPPROCESS_INFORMATION lpProcessInformation
);

can you explain it little further?


are this member of structure or args of function???

(   
  LPCTSTR lpApplicationName,
  LPTSTR lpCommandLine,
  LPSECURITY_ATTRIBUTES lpProcessAttributes,
  LPSECURITY_ATTRIBUTES lpThreadAttributes,
  BOOL bInheritHandles,
  DWORD dwCreationFlags,
  LPVOID lpEnvironment,
  LPCTSTR lpCurrentDirectory,
  LPSTARTUPINFO lpStartupInfo,
  LPPROCESS_INFORMATION lpProcessInformation
);

is BOOL bool type or typedef for int?

typedef BOOL

why is this in () ??? is this some casting types???

(WINAPI *_CreateProcess)

are this member of structure or args of function???

(   
  LPCTSTR lpApplicationName,
  LPTSTR lpCommandLine,
  LPSECURITY_ATTRIBUTES lpProcessAttributes,
  LPSECURITY_ATTRIBUTES lpThreadAttributes,
  BOOL bInheritHandles,
  DWORD dwCreationFlags,
  LPVOID lpEnvironment,
  LPCTSTR lpCurrentDirectory,
  LPSTARTUPINFO lpStartupInfo,
  LPPROCESS_INFORMATION lpProcessInformation
);

Why would they be members of a struct? They're not function args, so to speak, because this isn't a function. Since what you're looking at is a typedef for a function pointer, the part about it being a function pointer means that it's going to point to a function. This function has a "type" or signature consisting of its return value and the number and type of arguments. The list you see is the number and type of the arguments for the function type for the pointer being typedef'd.

is BOOL bool type or typedef for int?

typedef BOOL

Since it seems to be coming from the WinAPI, I would guess at in being an int. But then looking up the skirt kinda defeats part of the purpose of a typedef anyway.

why is this in () ??? is this some casting types???

(WINAPI *_CreateProcess)

To allow creation of the pointer. It's not a cast. It's grouping stuff together because without it precedence would make the meaning different. You need the parens to declare the function pointer to be typedef'd.

huh,this is new for me,I guess that this is more C thing than C++

typedef BOOL (WINAPI *_CreateProcess)(   //BOOL je int???
  LPCTSTR lpApplicationName,
  LPTSTR lpCommandLine,
  LPSECURITY_ATTRIBUTES lpProcessAttributes,
  LPSECURITY_ATTRIBUTES lpThreadAttributes,
  BOOL bInheritHandles,
  DWORD dwCreationFlags,
  LPVOID lpEnvironment,
  LPCTSTR lpCurrentDirectory,
  LPSTARTUPINFO lpStartupInfo,
  LPPROCESS_INFORMATION lpProcessInformation
);

so BOOL is returning type for this func pointer ?

and WINAPI is type that has what connection with func?

so how is he going to call this function pointer? just dereferentiate like *func(); ?? and why not write ordinary static func than using func pointer in first place :S

http://www.newty.de/fpt/index.html

so how is he going to call this function pointer? just dereferentiate like *func(); ?? and why not write ordinary static func than using func pointer in first place :S

It isn't a function pointer. It's a typedef used to declare a function pointer. You'd actually need to declare something to call a function via the pointer.

As far as the rest, I don't know where you're digging this from, so I don't know what you're really trying to ask. Windows API stuff adds its own level of typdefing into the mix, so it's got that extra level of confusion.

Edited 6 Years Ago by Dave Sinkula: n/a

from this link you gave me:

typedef int (TMyClass::*pt2Member)(float, char, char);

so its just (float,char,char) and not (float x1,char x2,char x3)

and here again we have both types and variable names ???

LPCTSTR lpApplicationName

typedef BOOL (WINAPI *_CreateProcess)( //BOOL je int???

      LPCTSTR lpApplicationName,

      LPTSTR lpCommandLine,

      LPSECURITY_ATTRIBUTES lpProcessAttributes,

      LPSECURITY_ATTRIBUTES lpThreadAttributes,

      BOOL bInheritHandles,

      DWORD dwCreationFlags,

      LPVOID lpEnvironment,

      LPCTSTR lpCurrentDirectory,

      LPSTARTUPINFO lpStartupInfo,

      LPPROCESS_INFORMATION lpProcessInformation

      );

//-------------------------------------------------------------

and here again int is returning type for all functions under this typedef?

typedef int (TMyClass::*pt2Member)(float, char, char);

so its just (float,char,char) and not (float x1,char x2,char x3)

and here again we have both types and variable names ???

It doesn't matter if you give them names or not. If you choose to do so, they are merely superfluous.

This article has been dead for over six months. Start a new discussion instead.