Encore un pb de timer!!!!!

melkiorlenecrarque Messages postés 97 Date d'inscription dimanche 6 juillet 2003 Statut Membre Dernière intervention 20 janvier 2008 - 25 août 2003 à 11:48
cs_JCDjcd Messages postés 1138 Date d'inscription mardi 10 juin 2003 Statut Membre Dernière intervention 25 janvier 2009 - 25 août 2003 à 13:36
je souhaite, en appuyan sur un boutton, declancher un timer ki ajoute a chak seconde une unité au caption de ce meme bouton mé sa marche pa!!!

voici mon code:

#include <windows.h>
#include "resource.h"

HINSTANCE hinst;

BOOL CALLBACK AppProc(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{

case BN_CLICKED:
switch(wParam)
{
case IDC_BUTTON1:
SetTimer(hdlg,0001,1000,NULL);
default:;
}


case WM_COMMAND:
switch(wParam)
{
case IDCANCEL:
KillTimer(hdlg,0001);
EndDialog(hdlg, 0);
default :;

}

case WM_TIMER :
SetDlgItemInt(hdlg,IDC_BUTTON1,GetDlgItemInt(hdlg,IDC_BUTTON1,NULL,TRUE)+1,TRUE);
}
return 0;
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, PSTR, int)
{
hinst = hInstance;
DialogBox(hInstance, MAKEINTRESOURCE(IDD_APP1), NULL, AppProc);
return 0;
}

je bosse sous VC++ sans MFC

merci a tous

2 réponses

BruNews Messages postés 21040 Date d'inscription jeudi 23 janvier 2003 Statut Modérateur Dernière intervention 21 août 2019
25 août 2003 à 11:54
switch(msg) case BN_CLICKED: NON !!!
case WM_COMMAND:
switch(wParam)
{
case IDBUTTON: ok ici pour BN_CLICKED = 0
BruNews, ciao...
0
cs_JCDjcd Messages postés 1138 Date d'inscription mardi 10 juin 2003 Statut Membre Dernière intervention 25 janvier 2009 4
25 août 2003 à 13:36
je tiens juste a preciser poue l'ecriture du nombre 0001

si ton nombe commence par 0, alors en C/C++ c'est un nombre octatdecimal (en base 8)
Donc tu ne pourras pas faire 0009 !

juste une precision ...

:-p :-p :-p :shy) :-p :-p :-p :shy) :-p :-p :shy)
:shy) :-p :shy) :shy) :-p :shy) :shy) :shy) :-p :shy) :-p
:shy) :-p :shy) :shy) :-p :shy) :shy) :shy) :-p :shy) :-p
:-p :-p :shy) :shy) :-p :-p :-p :shy) :-p :-p :shy)
0
Rejoignez-nous