WinMain en programmation windows
masterx_goldman
Messages postés
84
Statut
Membre
-
Pseudo -
Pseudo -
Bonjour,
Je veux savoir la différence entre APIENTRY , WINAPI et CALLBACK dans la déclaration de WinMain() dans la programmation windows , les 3 exemples suivant marchent bien et donne le même résultat :
#include <windows.h>
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
MessageBox(NULL, " hello world :) !", "My first windows app", (int)NULL);
return 0;
}
****************************************
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
MessageBox(NULL, " hello world :) !", "My first windows app", (int)NULL);
return 0;
}
****************************************
#include <windows.h>
int CALLBACK WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
MessageBox(NULL, " hello world :) !", "My first windows app", (int)NULL);
return 0;
}
merci pour vos réponses :)
Je veux savoir la différence entre APIENTRY , WINAPI et CALLBACK dans la déclaration de WinMain() dans la programmation windows , les 3 exemples suivant marchent bien et donne le même résultat :
#include <windows.h>
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
MessageBox(NULL, " hello world :) !", "My first windows app", (int)NULL);
return 0;
}
****************************************
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
MessageBox(NULL, " hello world :) !", "My first windows app", (int)NULL);
return 0;
}
****************************************
#include <windows.h>
int CALLBACK WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
MessageBox(NULL, " hello world :) !", "My first windows app", (int)NULL);
return 0;
}
merci pour vos réponses :)
5 réponses
Il n'y a pas de différence, ce sont exactement les mêmes choses.
Si tu ouvres windef.h, tu pourras trouver :
Si tu ouvres windef.h, tu pourras trouver :
#define CALLBACK __stdcall #define WINAPI __stdcall #define WINAPIV __cdecl #define APIENTRY WINAPI #define APIPRIVATE __stdcall #define PASCAL __stdcall
et il servent à faire quoi ?
parceque lorsque je les ai enlevé pour rendre la déclaration de WinMain comme celle de main() en Standard ANSI C , ça ne marche pas !
#include <windows.h>
int WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
MessageBox(NULL, " hello world :) !", "My first windows app", (int)NULL);
return 0;
}
parceque lorsque je les ai enlevé pour rendre la déclaration de WinMain comme celle de main() en Standard ANSI C , ça ne marche pas !
#include <windows.h>
int WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
MessageBox(NULL, " hello world :) !", "My first windows app", (int)NULL);
return 0;
}
https://www.microsoft.com/en-us/download/details.aspx?id=55979
Le problème d'un prog avec API, c'est qu'il faut demander à Win de faire une fenêtre. Et comme il gère son machin un peu comme il veux, c'est la merde.
Le problème d'un prog avec API, c'est qu'il faut demander à Win de faire une fenêtre. Et comme il gère son machin un peu comme il veux, c'est la merde.
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question