Ankit
Ankit

Reputation: 361

Windows Application in C

Can anyone tell me how I can create a basic usable Windows application in C (I have a little idea about C++ also) ?

Upvotes: 2

Views: 383

Answers (5)

dsolimano
dsolimano

Reputation: 8986

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.

Upvotes: 1

Chris Becke
Chris Becke

Reputation: 36016

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.

Upvotes: 3

torak
torak

Reputation: 5802

Perhaps the video at this link will help. If not there's TONS of other resources available on MSDN that will get you started.

Other than that "How to write a Windows Program" is just to broad and large a topic to really address here.

Upvotes: 1

Ben Zotto
Ben Zotto

Reputation: 70998

Get Petzold's Programming Windows book; it's a classic and covers Win32 development from its core C roots.

Upvotes: 6

Billy ONeal
Billy ONeal

Reputation: 106530

#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.

Upvotes: 1

Related Questions