/* Autor: Leandro Bernsmuller
Gerencia o dialogo */



#include <windows.h>
#include <windowsx.h>
#include "..\princip\defs.h"
#include "..\extra\arqs.h"
#include "dlgsobre.h"



/* Usado para tratar mensagens na caixa de dialogo
**********************************************************/
BOOL FAR PASCAL ProcDlgSobre ( HWND hWnd, UINT uMsg, 
                               WPARAM wParam, LPARAM lParam )
{
  switch ( uMsg ) {

    // botao clicado
    case WM_COMMAND:
      {

         // qual botao
         switch ( LOWORD ( wParam ) ) {

            case IDC_BUTTON1:  // mostra o GNU-GPL
               // tenta executar o notepad e mostrar o texto
               PROCESS_INFORMATION
                  stLic;       // informacoes sobre o processo executado

               ExecutaProcesso ( STR_ABRE_LICENSA, stLic );

               // se houve erro
               if ( ! ProcessoRodando ( stLic ) )
                  MSGSTR ( STR_ERRO_ARQLICENSA );
               break;

            case IDCANCEL:
            case IDOK:

               // termina dialogo
               ::EndDialog ( hWnd, TRUE );
               break;
         }
      }
      break;

    case WM_INITDIALOG:
      {
         return TRUE;
      }
      break;
  }

  return FALSE;
}
         


/* Faz o dialogo
hWnd - janela pai
**********************************************************/
void FazDialogo_Sobre ( HWND hWnd )
{
   ::DialogBox ( (HINSTANCE) GetWindowLong ( hWnd, GWL_HINSTANCE ),
                 MAKEINTRESOURCE ( IDD_DIALOG4 ), hWnd,
                 (DLGPROC) ProcDlgSobre );
}
