ClientLic_2017/DialogProgreso.cpp

94 lines
2.1 KiB
C++

// DialogProgreso.cpp : implementation file
//
#include "stdafx.h"
#include "ClientLic.h"
#include "DialogProgreso.h"
#include "utl.h"
// DialogProgreso dialog
IMPLEMENT_DYNAMIC(DialogProgreso, CDialog)
DialogProgreso::DialogProgreso(CWnd* pParent /*=NULL*/)
: CDialog(DialogProgreso::IDD, pParent)
{
dirProgram[0]=0;
}
DialogProgreso::~DialogProgreso()
{
}
void DialogProgreso::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_PROGRESO_BAR, progr_bar);
DDX_Control(pDX, IDC_STATIC_PROGRESO, progr_text);
DDX_Control(pDX, IDOK, ok_button);
}
BEGIN_MESSAGE_MAP(DialogProgreso, CDialog)
ON_BN_CLICKED(IDOK, &DialogProgreso::OnBnClickedOk)
ON_BN_CLICKED(IDCANCEL, &DialogProgreso::OnBnClickedCancel)
ON_MESSAGE(WMS_STATUS, OnInfo)
ON_MESSAGE(WMS_FIN, OnFin)
END_MESSAGE_MAP()
// DialogProgreso message handlers
void DialogProgreso::OnBnClickedOk()
{
// TODO: Add your control notification handler code here
char st[512];
sprintf(st,"start %s",dirProgram);
system(st);
//Cutl::lanza_exe("explorer.exe", dirProgram);
OnOK();
}
void DialogProgreso::OnBnClickedCancel()
{
*cancelar = TRUE;
if(puedeSalir)
OnCancel();
}
LRESULT DialogProgreso::OnInfo( WPARAM Wparam, LPARAM lParam )
{
int nLower, nUpper;
progr_bar.GetRange(nLower, nUpper);
progr_bar.SetPos(nLower+(int)((nUpper - nLower)*1.*(*(double*)Wparam)/100.));
//CGeofotoDoc* pdoc = (CGeofotoDoc*)GetActiveDocument();
//pdoc->docmsg((CMsgdoc *) lParam);
return 0 ;
}
LRESULT DialogProgreso::OnFin( WPARAM Wparam, LPARAM lParam )
{
//CGeofotoDoc* pdoc = (CGeofotoDoc*)GetActiveDocument();
//pdoc->docmsg((CMsgdoc *) lParam);
if(!Wparam)
progr_text.SetWindowText("Descarga cancelada");
else
progr_text.SetWindowText("Descarga completada");
ok_button.EnableWindow(Wparam!=0);
puedeSalir = true;
return 0 ;
}
BOOL DialogProgreso::OnInitDialog()
{
CDialog::OnInitDialog();
ok_button.EnableWindow(0);
puedeSalir = 0;
*espera=FALSE;
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}