** (C) 2001 **
****************************
** written by Yury Benesh **
** ( 2:454/21.43@fidonet )**
**       exhu@tut.by      **
** ---------------------- *********************************************
***********************************************************************

  There are some templates for building windowing applications in SPHINX C--.
 I wrote them and collected together to free some programmer's time by ignoring
 the writing of such boring procedures and structure fillings as in WinMain,
 WNDPROC, DLGPROC...

************************************************************************ 

                                WinMain
                                ~~~~~~~
                         Accelerators Handler Added

void winmain()
{
MSG msg;
HWND hmw;
DWORD haccel;
        
 haccel=LoadAccelerators(hThisInst,IDA_ACC);
//---------------//
 hmw=CreateDialogParamA(hThisInst,IDD_MAINDLG,0,#wndproc,0);
 ShowWindow(hmw,SW_SHOWNORMAL);
 UpdateWindow(hmw);
        
        while ( GetMessage( #msg, NULL, 0, 0 ) )
        {
        if(!TranslateAccelerator(hmw, haccel, #msg))
                  {
                   TranslateMessage(#msg);
                   DispatchMessage(#msg);
                  }
        }                
}

                                DLGPROC
                                ~~~~~~~
                A Simple Handler for the OK Button Added

dword okproc(dword hdlg,cmd,wpar,lpar)
{
 if (cmd==WM_INITDIALOG) return(1);
 if (cmd==WM_COMMAND)
  if (LOWORD(wpar)==IDOK) EndDialog(hdlg,0);

 return(0);
}



                                WNDPROC
                                ~~~~~~~
         A Simple Handler for a Dialog Window as a main window

dword wndproc(dword hdlg,cmd,wpar,lpar)
dword wID;
{

 EAX = cmd;
 switch (EAX)           
  {
   case WM_INITDIALOG: goto labend;
   case WM_CLOSE: PostQuitMessage(0);goto labend;
   case WM_COMMAND:
            wID = LOWORD(wpar);
           /*switch(wID)
            {
            }*/
  }
 return(0);
labend: return(1);
}
