i have a sample program,can someone help to find the error of this program or someone to correct this program coz i don't know what is the error of this program

this is the sample program of mine

#include<windows.h>
#include<string.h>
#include<strstrea.h>
#include"mydialog.h"
void main()
{
LONG FAR PASCAL _export WindowFunc(HWND hwnd, unsigned message,
				                      WORD wParam, LONG lParam);
BOOL FAR PASCAL _export DialogFunc(HWND hdwnd, unsigned message,
					                   WORD wParam, LONG lParam);
char szWinName[] = "MyWin";

HANDLE hInst;

int PASCAL WinMain(HANDLE hThisInst, HANDLE hPrevInst,
					    LPSTR lpszArgs, int nWinMode);


}
 {
	HWND hwnd;
   MSG msg;
   WNDCLASS wcl;
   HANDLE hAccel;

   if(!hPrevInst){

  wcl.hInstance = hThisInst;
      wcl.lpszClassName = szWinName;
      wcl.lpfnWndProc =WindowFunc;
      wcl.style = NULL;

      wcl.hIcon = LoadIcon(NULL, IDI_APPLICATION);
      wcl.hCursor = LoadCursor(NULL, IDC_ARROW);
      wcl.lpszMenuName = "MYMENU";

      wcl.cbClsExtra = 0;
      wcl.cbWndExtra = 0;

      wcl.hbrBackground = GetStockObject(LTGRAY_BRUSH);

      if(!RegisterClass (&wcl)) return 0;
   }
   	hwnd=CreateWindow (
      	szWinName,
         "Dialog Boxes",
         WS_OVERLAPPEDWINDOW,
         CW_USEDEFAULT,
         CW_USEDEFAULT,
         CW_USEDEFAULT,
         CW_USEDEFAULT,
         NULL,
         NULL,
         hThisInst,
         NULL
      );
      hAccel = LoadAccelerators(hThisInst, "MYMENU");
      hInst = hThisInst;

      ShowWindow(hwnd, nWinMode);

      while(GetMessage(&msg, NULL, 0, 0))
      {
      	if(!TranslateAccelerator(hwnd, hAccel, &msg)) {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
         }
     {
      return msg.wParam;


   long FAR PASCAL WindowFunc(HWND hwnd, WORD message, WORD wParam,
   									LONG lParam)
	{
		FARPROC lpDlg;

      int response;

      switch(message) {
      	case WM_COMMAND:
         	switch(wParam) {
            	case IDM_DIALOG1:
               	lpDlg = MakeProcInstance ((FARPROC) DialogFunc, hInst);
                  DialogBox(hInst,"MYDB", hwnd, lpDlg;
                  FreeProcInstance(lpDlg);
                  break;
               case IDM_DIALOG2:
               	MessageBox(hwnd, "Not Implemented", "", MB_OK);
                  break;
               case IDM_HELP:
               	MessageBox(hwnd, "Not Impelemented", "HELP", MB_OK);
                  break;
            }
            break;
         case WM_DESTROY:
         	PostQuitMessage(0);
            break;
      }

      return DefWindowProc(hwnd, message, wParam, lParam);
   }

   BOOL FAR PASCAL DialogFunc(HWND hdwnd, unsigned message,
   						         WORD wParam, LONG lParam)
   {

   	switch(message){
      	case WM_COMMAND:
         	switch(wParam) {
              case IDCANCEL:
              	EndDialog(hdwnd, NULL);
               return 1;
              case IDD_RED:
            				MessageBox(hdwnd,"You Picked Red", "RED", MB_OK);
               return 1;
              case IDD_GREEN:
              	MessageBox(hdwnd,"You Picked Green", "GREEN", MB_OK);
               return 1;
            }
         }
         return 0;
         }

What is the error? Right off hand I can see you are mixing two entry points. void main () & WinMain. WinMain is empty. There is an example of a sekeltal app in code snippets under cplusplus. Look at that one and it will give you a good idea how to correct yours.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.