I have converted a C++ example which compiles and runs ok but presents this warning.
Building exercise.obj.
C:\Users\David\Documents\Pelles C Projects\CompoundInterest\exercise.c(21): warning #2168: Operands of '=' have incompatible types 'int __stdcall function(HWND, unsigned int, unsigned int, long int)' and 'long int __stdcall function(HWND, unsigned int, unsigned int, long int)'.
Building CompoundInterest.exe.
Done.
The portion of code applicable appears to be:-
#define WIN32_LEAN_AND_MEAN
/* #define NOCRYPT */
/* #define NOSERVICE */
/* #define NOMCX */
/* #define NOIME */
#include <windows.h>
#include <commctrl.h>
#include "Resource.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
//---------------------------------------------------------------------------
HWND hWnd;
LRESULT CALLBACK DlgProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
//---------------------------------------------------------------------------
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
// DialogBox(hInstance, MAKEINTRESOURCE(IDD_MAIN_DLG),
// hWnd, reinterpret_cast<DLGPROC>(DlgProc));
return DialogBox(hInstance, MAKEINTRESOURCE(IDD_MAIN_DLG), 0, DlgProc);
// return FALSE;
}
//---------------------------------------------------------------------------
LRESULT CALLBACK DlgProc(HWND hWndDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
// These variables will carry the values in the text boxes
/*LPTSTR strPrincipal = new char[20],
strInterest = new char[20], strPeriods = new char[20],
strInterestEarned = new char[20], strAmountEarned = new char[20];
*/
char strPrincipal[20],strInterest[20], strPeriods[20],
strInterestEarned[20], strAmountEarned[20];
// These are handled for the various controls
HWND hWndPrincipal, hWndInterest, hWndPeriods, hWndCompound,
hWndInterestEarned, hWndAmountEarned, hWndCalculate;
double Principal, AnnualRate, InterestEarned;
double FutureValue, RatePerPeriod;
int NumberOfPeriods, CompoundType;
double i;
int n;
hWndPrincipal = GetDlgItem(hWndDlg, IDC_PRINCIPAL);
hWndInterest = GetDlgItem(hWndDlg, IDC_ANNUAL_RATE);
hWndPeriods = GetDlgItem(hWndDlg, IDC_NBR_OF_PERIODS);
hWndCompound = GetDlgItem(hWndDlg, IDC_COMPOUND);
hWndInterestEarned = GetDlgItem(hWndDlg, IDC_INTEREST_EARNED);
hWndAmountEarned = GetDlgItem(hWndDlg, IDC_AMOUNT_EARNED);
hWndCalculate = GetDlgItem(hWndDlg, IDC_CALCULATE_BTN);
Any hints would be appreciated.