SpuN
December 19th, 2004, 11:05 PM
i have a static text box on my dialog box.. and i want it to print a number that increases every time i click the button on my dlg box... what have i done wrong?
// NIGGA COUNTA
#include <windows.h>
#include <stdio.h>
#include "resource.h"
HWND hWnd;
LRESULT CALLBACK NIGGADLGPROC(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
DialogBox(hInstance, MAKEINTRESOURCE(IDD_NIGGA), hWnd, (DLGPROC)NIGGADLGPROC);
return 0;
}
LRESULT CALLBACK NIGGADLGPROC(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
int NIGGACOUNT = 0;
char cNIGGACOUNT[512];
sprintf(cNIGGACOUNT,"%i", NIGGACOUNT);
switch(Msg)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
if(LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
if(LOWORD(wParam) == IDC_NIGGACOUNTBUTTON)
{
NIGGACOUNT++;
}
break;
case WM_SETTEXT:
{
SetDlgItemText(hDlg, IDC_NIGGACOUNT, cNIGGACOUNT);
break;
}
}
return FALSE;
}
// NIGGA COUNTA
#include <windows.h>
#include <stdio.h>
#include "resource.h"
HWND hWnd;
LRESULT CALLBACK NIGGADLGPROC(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
DialogBox(hInstance, MAKEINTRESOURCE(IDD_NIGGA), hWnd, (DLGPROC)NIGGADLGPROC);
return 0;
}
LRESULT CALLBACK NIGGADLGPROC(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
int NIGGACOUNT = 0;
char cNIGGACOUNT[512];
sprintf(cNIGGACOUNT,"%i", NIGGACOUNT);
switch(Msg)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
if(LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
if(LOWORD(wParam) == IDC_NIGGACOUNTBUTTON)
{
NIGGACOUNT++;
}
break;
case WM_SETTEXT:
{
SetDlgItemText(hDlg, IDC_NIGGACOUNT, cNIGGACOUNT);
break;
}
}
return FALSE;
}