Can anyone tell me how I can create a basic usable Windows application in C (I have a little idea about C++ also) ?
#include <stdlib.h>
int main()
{
printf("Hello World!");
}
Will compile and run as a windows application. If you want to do something specific, then please let us know. There is nothing that makes Windows applications any different than any other applications.
Get Petzold's Programming Windows book; it's a classic and covers Win32 development from its core C roots.
Raymond Chen's scratch program is a minimally functional white box, and a good base to work through some of the other articles that he publishes.
You can compile this in Visual Studio. In VS2005, I created a new empty C++ project and added comctl32.lib to Configuration->Linker->Input->Additional Dependencies
.
The most minimal windows C program is this :-
#include <windows.h>
#include "resource.h"
int CALLBACK WinMain(HINSTANCE hApp, HINSTANCE, LPSTR pszCmdLine, int nCmdShow)
{
return DialogBoxParam(hApp,MAKEINTRESOURCE(IDD_DIALOG1),NULL,NULL,NULL);
}
It assumes you have used the resource editor to create a dialog resource called IDD_DIALOG1. The dialog will display, and close if the Close button is clicked.