begin process at 2012 05 30 02:15:04
  Trouver un code source :
 
dans
 
Accueil > Forum > 

Archive C/C++

 > 

Archives

 > 

Au secours

 > 

Je debute:


Derniers messages déposésPoser une question dans le forum ou lancer une discussion

Je debute:

jeudi 9 janvier 2003 à 19:33:11 | Je debute:

phpman

Bonjour,
je debute avec devc++, quand je creer un nouveau projet il me génère le code d'une form windows:

#include <windows.h>

/* Declare Windows procedure */
LRESULT CALLBACK WindowProcedure(HWND, UINT, WPARAM, LPARAM);
/* Make the class name into a global variable */
char szClassName[ ] = "WindowsApp";
int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil)

{
HWND hwnd; /* This is the handle for our window */
MSG messages; /* Here messages to the application are saved */
WNDCLASSEX wincl; /* Data structure for the windowclass */

/* The Window structure */
wincl.hInstance = hThisInstance;
wincl.lpszClassName = szClassName;
wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */
wincl.style = CS_DBLCLKS; /* Catch double-clicks */
wincl.cbSize = sizeof(WNDCLASSEX);

/* Use default icon and mouse-pointer */
wincl.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wincl.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
wincl.hCursor = LoadCursor(NULL, IDC_ARROW);
wincl.lpszMenuName = NULL; /* No menu */
wincl.cbClsExtra = 0; /* No extra bytes after the window class */
wincl.cbWndExtra = 0; /* structure or the window instance */
/* Use light-gray as the background of the window */
wincl.hbrBackground = (HBRUSH) GetStockObject(LTGRAY_BRUSH);

/* Register the window class, if fail quit the program */
if(!RegisterClassEx(&wincl)) return 0;

/* The class is registered, let's create the program*/
hwnd = CreateWindowEx(
0, /* Extended possibilites for variation */
szClassName, /* Classname */
"Windows App", /* Title Text */
WS_OVERLAPPEDWINDOW, /* default window */
CW_USEDEFAULT, /* Windows decides the position */
CW_USEDEFAULT, /* where the window ends up on the screen */
544, /* The programs width */
375, /* and height in pixels */
HWND_DESKTOP, /* The window is a child-window to desktop */
NULL, /* No menu */
hThisInstance, /* Program Instance handler */
NULL /* No Window Creation data */
);

/* Make the window visible on the screen */
ShowWindow(hwnd, nFunsterStil);
/* Run the message loop. It will run until GetMessage( ) returns 0 */
while(GetMessage(&messages, NULL, 0, 0))
{
/* Translate virtual-key messages into character messages */
TranslateMessage(&messages);
/* Send message to WindowProcedure */
DispatchMessage(&messages);
}

/* The program return-value is 0 - The value that PostQuitMessage( ) gave */
return messages.wParam;
}

/* This function is called by the Windows function DispatchMessage( ) */
LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) /* handle the messages */
{
case WM_DESTROY:
PostQuitMessage(0); /* send a WM_QUIT to the message queue */
break;
default: /* for messages that we don't deal with */
return DefWindowProc(hwnd, message, wParam, lParam);
}
return 0;
}




Je voudrai ecrire un texte ou creer un bouton sur cette form mais je ne connais ni le code ni ou le placer...........
Merci pour votre aide.





jeudi 9 janvier 2003 à 21:57:12 | Re : Je debute:

Dean

Salut,

Je te conseille d'apprendre d'abord les bases de la programmation Windows :

http://winprog.org/tutorial/

Je suis moi-même débutant et je peux te dire que c'est un excellent tutorial.

Dean
[ Lien ]


-------------------------------
Réponse au message :
-------------------------------

> Bonjour,
> je debute avec devc++, quand je creer un nouveau projet il me génère le code d'une form windows:
>
> #include <windows.h>
>
> /* Declare Windows procedure */
> LRESULT CALLBACK WindowProcedure(HWND, UINT, WPARAM, LPARAM);
> /* Make the class name into a global variable */
> char szClassName[ ] = "WindowsApp";
> int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil)
>
> {
> HWND hwnd; /* This is the handle for our window */
> MSG messages; /* Here messages to the application are saved */
> WNDCLASSEX wincl; /* Data structure for the windowclass */
>
> /* The Window structure */
> wincl.hInstance = hThisInstance;
> wincl.lpszClassName = szClassName;
> wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */
> wincl.style = CS_DBLCLKS; /* Catch double-clicks */
> wincl.cbSize = sizeof(WNDCLASSEX);
>
> /* Use default icon and mouse-pointer */
> wincl.hIcon = LoadIcon(NULL, IDI_APPLICATION);
> wincl.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
> wincl.hCursor = LoadCursor(NULL, IDC_ARROW);
> wincl.lpszMenuName = NULL; /* No menu */
> wincl.cbClsExtra = 0; /* No extra bytes after the window class */
> wincl.cbWndExtra = 0; /* structure or the window instance */
> /* Use light-gray as the background of the window */
> wincl.hbrBackground = (HBRUSH) GetStockObject(LTGRAY_BRUSH);
>
> /* Register the window class, if fail quit the program */
> if(!RegisterClassEx(&wincl)) return 0;
>
> /* The class is registered, let's create the program*/
> hwnd = CreateWindowEx(
> 0, /* Extended possibilites for variation */
> szClassName, /* Classname */
> "Windows App", /* Title Text */
> WS_OVERLAPPEDWINDOW, /* default window */
> CW_USEDEFAULT, /* Windows decides the position */
> CW_USEDEFAULT, /* where the window ends up on the screen */
> 544, /* The programs width */
> 375, /* and height in pixels */
> HWND_DESKTOP, /* The window is a child-window to desktop */
> NULL, /* No menu */
> hThisInstance, /* Program Instance handler */
> NULL /* No Window Creation data */
> );
>
> /* Make the window visible on the screen */
> ShowWindow(hwnd, nFunsterStil);
> /* Run the message loop. It will run until GetMessage( ) returns 0 */
> while(GetMessage(&messages, NULL, 0, 0))
> {
> /* Translate virtual-key messages into character messages */
> TranslateMessage(&messages);
> /* Send message to WindowProcedure */
> DispatchMessage(&messages);
> }
>
> /* The program return-value is 0 - The value that PostQuitMessage( ) gave */
> return messages.wParam;
> }
>
> /* This function is called by the Windows function DispatchMessage( ) */
> LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
> {
> switch (message) /* handle the messages */
> {
> case WM_DESTROY:
> PostQuitMessage(0); /* send a WM_QUIT to the message queue */
> break;
> default: /* for messages that we don't deal with */
> return DefWindowProc(hwnd, message, wParam, lParam);
> }
> return 0;
> }
>
>
>
>
> Je voudrai ecrire un texte ou creer un bouton sur cette form mais je ne connais ni le code ni ou le placer...........
> Merci pour votre aide.
>
>
>
>
>
>
jeudi 9 janvier 2003 à 22:28:23 | Re : Je debute:

phpman

Merci beaucoup pour ce lien qui est tres interessant, je suis en train de le regarder.

Mais si quelqu'un peut me dire ou mettre mon code dans celui que je vous ai montrer...
Merci!!!!!!!!!!!


-------------------------------
Réponse au message :
-------------------------------

> Salut,
>
> Je te conseille d'apprendre d'abord les bases de la programmation Windows :
>
> http://winprog.org/tutorial/
>
> Je suis moi-même débutant et je peux te dire que c'est un excellent tutorial.
>
> Dean
> [ Lien ]
>
>
> -------------------------------
> Réponse au message :
> -------------------------------
>
> > Bonjour,
> > je debute avec devc++, quand je creer un nouveau projet il me génère le code d'une form windows:
> >
> > #include <windows.h>
> >
> > /* Declare Windows procedure */
> > LRESULT CALLBACK WindowProcedure(HWND, UINT, WPARAM, LPARAM);
> > /* Make the class name into a global variable */
> > char szClassName[ ] = "WindowsApp";
> > int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil)
> >
> > {
> > HWND hwnd; /* This is the handle for our window */
> > MSG messages; /* Here messages to the application are saved */
> > WNDCLASSEX wincl; /* Data structure for the windowclass */
> >
> > /* The Window structure */
> > wincl.hInstance = hThisInstance;
> > wincl.lpszClassName = szClassName;
> > wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */
> > wincl.style = CS_DBLCLKS; /* Catch double-clicks */
> > wincl.cbSize = sizeof(WNDCLASSEX);
> >
> > /* Use default icon and mouse-pointer */
> > wincl.hIcon = LoadIcon(NULL, IDI_APPLICATION);
> > wincl.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
> > wincl.hCursor = LoadCursor(NULL, IDC_ARROW);
> > wincl.lpszMenuName = NULL; /* No menu */
> > wincl.cbClsExtra = 0; /* No extra bytes after the window class */
> > wincl.cbWndExtra = 0; /* structure or the window instance */
> > /* Use light-gray as the background of the window */
> > wincl.hbrBackground = (HBRUSH) GetStockObject(LTGRAY_BRUSH);
> >
> > /* Register the window class, if fail quit the program */
> > if(!RegisterClassEx(&wincl)) return 0;
> >
> > /* The class is registered, let's create the program*/
> > hwnd = CreateWindowEx(
> > 0, /* Extended possibilites for variation */
> > szClassName, /* Classname */
> > "Windows App", /* Title Text */
> > WS_OVERLAPPEDWINDOW, /* default window */
> > CW_USEDEFAULT, /* Windows decides the position */
> > CW_USEDEFAULT, /* where the window ends up on the screen */
> > 544, /* The programs width */
> > 375, /* and height in pixels */
> > HWND_DESKTOP, /* The window is a child-window to desktop */
> > NULL, /* No menu */
> > hThisInstance, /* Program Instance handler */
> > NULL /* No Window Creation data */
> > );
> >
> > /* Make the window visible on the screen */
> > ShowWindow(hwnd, nFunsterStil);
> > /* Run the message loop. It will run until GetMessage( ) returns 0 */
> > while(GetMessage(&messages, NULL, 0, 0))
> > {
> > /* Translate virtual-key messages into character messages */
> > TranslateMessage(&messages);
> > /* Send message to WindowProcedure */
> > DispatchMessage(&messages);
> > }
> >
> > /* The program return-value is 0 - The value that PostQuitMessage( ) gave */
> > return messages.wParam;
> > }
> >
> > /* This function is called by the Windows function DispatchMessage( ) */
> > LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
> > {
> > switch (message) /* handle the messages */
> > {
> > case WM_DESTROY:
> > PostQuitMessage(0); /* send a WM_QUIT to the message queue */
> > break;
> > default: /* for messages that we don't deal with */
> > return DefWindowProc(hwnd, message, wParam, lParam);
> > }
> > return 0;
> > }
> >
> >
> >
> >
> > Je voudrai ecrire un texte ou creer un bouton sur cette form mais je ne connais ni le code ni ou le placer...........
> > Merci pour votre aide.
> >
> >
> >
> >
> >
> >
>
vendredi 10 janvier 2003 à 07:12:46 | Re : Je debute:

cmarsc

salut,
je confirme le conseil de Dean. ;-)
va sur le site de devc++ pour des informations sur les cours c'est plus simple



-------------------------------
Réponse au message :
-------------------------------

> Salut,
>
> Je te conseille d'apprendre d'abord les bases de la programmation Windows :
>
> http://winprog.org/tutorial/
>
> Je suis moi-même débutant et je peux te dire que c'est un excellent tutorial.
>
> Dean
> [ Lien ]
>
>
> -------------------------------
> Réponse au message :
> -------------------------------
>
> > Bonjour,
> > je debute avec devc++, quand je creer un nouveau projet il me génère le code d'une form windows:
> >
> > #include <windows.h>
> >
> > /* Declare Windows procedure */
> > LRESULT CALLBACK WindowProcedure(HWND, UINT, WPARAM, LPARAM);
> > /* Make the class name into a global variable */
> > char szClassName[ ] = "WindowsApp";
> > int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil)
> >
> > {
> > HWND hwnd; /* This is the handle for our window */
> > MSG messages; /* Here messages to the application are saved */
> > WNDCLASSEX wincl; /* Data structure for the windowclass */
> >
> > /* The Window structure */
> > wincl.hInstance = hThisInstance;
> > wincl.lpszClassName = szClassName;
> > wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */
> > wincl.style = CS_DBLCLKS; /* Catch double-clicks */
> > wincl.cbSize = sizeof(WNDCLASSEX);
> >
> > /* Use default icon and mouse-pointer */
> > wincl.hIcon = LoadIcon(NULL, IDI_APPLICATION);
> > wincl.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
> > wincl.hCursor = LoadCursor(NULL, IDC_ARROW);
> > wincl.lpszMenuName = NULL; /* No menu */
> > wincl.cbClsExtra = 0; /* No extra bytes after the window class */
> > wincl.cbWndExtra = 0; /* structure or the window instance */
> > /* Use light-gray as the background of the window */
> > wincl.hbrBackground = (HBRUSH) GetStockObject(LTGRAY_BRUSH);
> >
> > /* Register the window class, if fail quit the program */
> > if(!RegisterClassEx(&wincl)) return 0;
> >
> > /* The class is registered, let's create the program*/
> > hwnd = CreateWindowEx(
> > 0, /* Extended possibilites for variation */
> > szClassName, /* Classname */
> > "Windows App", /* Title Text */
> > WS_OVERLAPPEDWINDOW, /* default window */
> > CW_USEDEFAULT, /* Windows decides the position */
> > CW_USEDEFAULT, /* where the window ends up on the screen */
> > 544, /* The programs width */
> > 375, /* and height in pixels */
> > HWND_DESKTOP, /* The window is a child-window to desktop */
> > NULL, /* No menu */
> > hThisInstance, /* Program Instance handler */
> > NULL /* No Window Creation data */
> > );
> >
> > /* Make the window visible on the screen */
> > ShowWindow(hwnd, nFunsterStil);
> > /* Run the message loop. It will run until GetMessage( ) returns 0 */
> > while(GetMessage(&messages, NULL, 0, 0))
> > {
> > /* Translate virtual-key messages into character messages */
> > TranslateMessage(&messages);
> > /* Send message to WindowProcedure */
> > DispatchMessage(&messages);
> > }
> >
> > /* The program return-value is 0 - The value that PostQuitMessage( ) gave */
> > return messages.wParam;
> > }
> >
> > /* This function is called by the Windows function DispatchMessage( ) */
> > LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
> > {
> > switch (message) /* handle the messages */
> > {
> > case WM_DESTROY:
> > PostQuitMessage(0); /* send a WM_QUIT to the message queue */
> > break;
> > default: /* for messages that we don't deal with */
> > return DefWindowProc(hwnd, message, wParam, lParam);
> > }
> > return 0;
> > }
> >
> >
> >
> >
> > Je voudrai ecrire un texte ou creer un bouton sur cette form mais je ne connais ni le code ni ou le placer...........
> > Merci pour votre aide.
> >
> >
> >
> >
> >
> >
>
dimanche 15 mai 2005 à 14:47:37 | Re : Je debute:

Pierro246

ah, moi aussi,  je débutes, mais y aurait pas un tutorial comme ça... mais en français, pleaze

parceque, l'anglais, j'y comprends rien!!

 lol



Cette discussion est classée dans : windows, messages, wincl, hwnd, window


Répondre à ce message

Sujets en rapport avec ce message

Application [ par Arnauti ] Bonjour, je suis nul et j'ai presque jamais fait de C/C++. Enfin, si quelque truc sous dos. Mais j'aimerais créé une aplication mais pas sous dos. Al tjr aide applications windows [ par chinois57 ] je suis desoler de denouveau vous enbeteer avec sa mais je ne comprend pas comment afficher un message dans une fenetre windows applicatios j'utilise C++ windows [ par notour ] bonjourj'ai réalyser un programme de cryptage de texte sous page DOS mais pour des raison pratique je souh probleme de compilation (débutant) [ par cddvdcopy ] je suis débutant, merci de m'éclairer !! ce code marche : #include #define ID_SFC 100 #define ID_RECHERCHE 200 #define ID_EXIT 300 insertion d'une phrase [ par chinois57 ] ou doige mettre une phrase du style sa va#include /*  Declare Windows procedure  */LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM); /*  couleur fond appli win32 [ par fredsor ] Salu a vous,Je créé une appli win32 sous devc++ en C.Je créé la fenetre avec CreateWindow, et j'aimerais que le fond soit blanc. Or l'appli se met dés siouplait la charite pour un pov newbie [ par seichettmorru ] je compile, ca marcheje lance ca me dit "impossible de communiquer avec la carte"j'ai une geforce ti+directx 8.vous etes mon dernier recours:#include Problème d'initailisation objet IDirect3DDevice9 [ par olivierpot2 ] Bonjour à tous,je débutes en c++ directx et j'avoue que j'ai un peu (beaucoup) de mal...Dans le code suivant je n'arrives pas à initilalisé la variabl Windows.h faire disparaitre la console [ par wxccxw ] Mon code est : #include #include #include #include #ifdef __BORLANDC__ #pragma argsused#endifLRESULT CALLBACK WindowProcedure (HWND, UIN probleme pour mon petit carré [ par mortaurat ] bonjour alors je debute en C et je veux faire mon petit carré .donc j'ai commancé par initialiser une fenetre opengl ce qui donne :#include LRESULT C


Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Mai 2012
LMMJVSD
 123456
78910111213
14151617181920
21222324252627
28293031   

Consulter la suite du CalendriCode

Photothèque

A découvrir



 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 3,994 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales