Click here to Skip to main content
15,897,032 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: about convert bmp to jpg Pin
yingkou27-Oct-04 15:17
yingkou27-Oct-04 15:17 
GeneralRe: about convert bmp to jpg Pin
Christian Graus27-Oct-04 15:20
protectorChristian Graus27-Oct-04 15:20 
GeneralRe: about convert bmp to jpg Pin
yingkou27-Oct-04 16:55
yingkou27-Oct-04 16:55 
Generalabout listing processes in system Pin
yanping wang26-Oct-04 15:20
yanping wang26-Oct-04 15:20 
GeneralRe: about listing processes in system Pin
vikramlinux26-Oct-04 20:17
vikramlinux26-Oct-04 20:17 
Questionprogress bar-can you help me? Pin
hou_12626-Oct-04 14:48
hou_12626-Oct-04 14:48 
AnswerRe: progress bar-can you help me? Pin
Xzyx987X26-Oct-04 15:51
Xzyx987X26-Oct-04 15:51 
GeneralCDHtmlDialog::GetElementText( _T("email")); Pin
Natural_Demon26-Oct-04 13:41
Natural_Demon26-Oct-04 13:41 
could u please help me out?
i'm trying to the the value of a html form on OnButtonOK().
but i fail, i'm already about 48 hours on it and i can't find anyone who is beable to help.
i tried news groups, the codeproject.com forum, tek-tips.com.
i tried using msdn, goodle.
bt i can't find good example abut retrieving value from html form

thank for your time.

kind regards,

Marco


// firstw32mfcDlg.cpp : implementation file
//

#include "stdafx.h"
#include "firstw32mfc.h"
#include "firstw32mfcDlg.h"
#include ".\firstw32mfcdlg.h"
#include <atlbase.h>
//#include <afxpriv.h>
#include <oleauto.h>

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
CAboutDlg();

// Dialog Data
enum { IDD = IDD_ABOUTBOX };

protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support

// Implementation
protected:
DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
END_MESSAGE_MAP()


// Cfirstw32mfcDlg dialog

BEGIN_DHTML_EVENT_MAP(Cfirstw32mfcDlg)
DHTML_EVENT_ONCLICK(_T("ButtonOK"), OnButtonOK)
DHTML_EVENT_ONCLICK(_T("ButtonCancel"), OnButtonCancel)
//DHTML_EVENT_ONCHANGE(_T("email"), OnChangeEdit1 )
//DHTML_EVENT_ONCHANGE(_T("password"), OnEnChangeEdit2 )
END_DHTML_EVENT_MAP()


Cfirstw32mfcDlg::Cfirstw32mfcDlg(CWnd* pParent /*=NULL*/)
: CDHtmlDialog(Cfirstw32mfcDlg::IDD, Cfirstw32mfcDlg::IDH, pParent)
//, m_EDIT1(0)
//, m_EDIT2(0)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void Cfirstw32mfcDlg::DoDataExchange(CDataExchange* pDX)
{
CDHtmlDialog::DoDataExchange(pDX);
DDX_DHtml_ElementInnerText(pDX, _T("email"), EDIT1);
DDX_DHtml_ElementInnerText(pDX, _T("password"), EDIT2);
DDX_DHtml_ElementInnerText(pDX, _T("Temp_Text1"), m_EDIT1);
DDX_DHtml_ElementInnerText(pDX, _T("Temp_Text2"), m_EDIT2);
}



BEGIN_MESSAGE_MAP(Cfirstw32mfcDlg, CDHtmlDialog)
ON_WM_SYSCOMMAND()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()


// Cfirstw32mfcDlg message handlers

BOOL Cfirstw32mfcDlg::OnInitDialog()
{
CDHtmlDialog::OnInitDialog();

// Add "About..." menu item to system menu.

// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);

CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}

// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon

EDIT1 = AfxGetApp()->GetProfileString("Settings", "email", "your login");
EDIT2 = AfxGetApp()->GetProfileString("Settings", "password", "details here..");
UpdateData(FALSE);
return FALSE; // return TRUE unless you set the focus to a control
}

void Cfirstw32mfcDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDHtmlDialog::OnSysCommand(nID, lParam);
}
}

// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.

void Cfirstw32mfcDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting

SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);

// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;

// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDHtmlDialog::OnPaint();
}
}

// The system calls this function to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR Cfirstw32mfcDlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hIcon);
}


HRESULT Cfirstw32mfcDlg::OnButtonOK(IHTMLElement* /*pElement*/)
{
UpdateData(TRUE);

/*
BSTR bstr = SysAllocString(GetElementText( _T("email")));
CStringW str = bstr;
SysFreeString(bstr);
*/

if(CDHtmlDialog::GetElementText("email"))
{
m_EDIT1=("TRUE");
UpdateData(FALSE);
}
else
{
m_EDIT1=("FALSE");
m_EDIT2=CDHtmlDialog::GetElementText("email");
UpdateData(FALSE);
}
//GetElementText(_T("email"));

//CString strEmail = CDHtmlDialog::GetElementText( _T("email"));
//AfxGetApp()->WriteProfileString("Settings", "email", strEmail.SysAllocString());

//BSTR bstrTable = EDIT1.AllocSysString();
BSTR bstrTable = GetElementText( _T("email"));
CString strEmail = bstrTable;
AfxGetApp()->WriteProfileString("Settings", "email", strEmail);

/*
CComBSTR bstr;
BSTR bstr = SysAllocString(get_innerText( _T("email")));
CString str = CString(bstr);
SysFreeString(bstr);
m_EDIT1=bstr;
UpdateData(FALSE);
*/

//CString strEmail = "email";
//AfxGetApp()->WriteProfileString("Settings", "email", SysAllocString(GetElementText( _T("email"));
//UpdateData(TRUE);
//SysAllocString(EDIT1);
//CString strEmail = "EDIT1";
//AfxGetApp()->WriteProfileString("Settings", "email", strEmail.SysAllocString());

//AfxGetApp()->WriteProfileString("Settings", "email", EDIT1);
//AfxGetApp()->WriteProfileString("Settings", "email", );
AfxGetApp()->WriteProfileString("Settings", "password", EDIT2);
//UpdateData(FALSE);
return NULL;
}

HRESULT Cfirstw32mfcDlg::OnButtonCancel(IHTMLElement* /*pElement*/)
{
UpdateData();
if(m_EDIT1)
{
AfxGetApp()->WriteProfileString("Settings", "email", m_EDIT1);
}
else
{
m_EDIT1=_T("i failed");
UpdateData();
}
if(m_EDIT2)
{
AfxGetApp()->WriteProfileString("Settings", "password", m_EDIT2);
}
else
{
m_EDIT2=_T("i failed too");
UpdateData(FALSE);
}

//UpdateData(FALSE);
return NULL;

}

//HRESULT Cfirstw32mfcDlg::OnChangeEdit1(IHTMLElement* /*pElement*/)
//{
// //UpdateData(FALSE);
// //AfxGetApp()->WriteProfileString("Settings", "email", EDIT1);
// //AfxGetApp()->WriteProfileString("Settings", "email", "gsdsgj");
//return FALSE;
//}

//HRESULT Cfirstw32mfcDlg::OnEnChangeEdit2(IHTMLElement* /*pElement*/)
//{
// //UpdateData(FALSE);
// ///AfxGetApp()->WriteProfileString("Settings", "password", EDIT2);
//return FALSE;
//}
GeneralAnd another one Pin
Rassul Yunussov26-Oct-04 13:12
Rassul Yunussov26-Oct-04 13:12 
GeneralRe: And another one Pin
Christian Graus26-Oct-04 13:48
protectorChristian Graus26-Oct-04 13:48 
GeneralAn algorithm question Pin
Rassul Yunussov26-Oct-04 13:10
Rassul Yunussov26-Oct-04 13:10 
GeneralRe: An algorithm question Pin
Ryan Binns26-Oct-04 18:21
Ryan Binns26-Oct-04 18:21 
GeneralRe: An algorithm question Pin
Rassul Yunussov1-Nov-04 18:28
Rassul Yunussov1-Nov-04 18:28 
Generalplotting library Pin
Wonho Oh26-Oct-04 12:02
sussWonho Oh26-Oct-04 12:02 
GeneralRe: plotting library Pin
Arsalan Malik27-Oct-04 0:11
Arsalan Malik27-Oct-04 0:11 
Generalget Windows username Pin
Anonymous26-Oct-04 11:44
Anonymous26-Oct-04 11:44 
GeneralRe: get Windows username Pin
Anonymous26-Oct-04 11:57
Anonymous26-Oct-04 11:57 
GeneralRe: get Windows username Pin
Ryan Binns26-Oct-04 18:25
Ryan Binns26-Oct-04 18:25 
GeneralRe: get Windows username Pin
ThatsAlok26-Oct-04 18:20
ThatsAlok26-Oct-04 18:20 
GeneralInteracting with a Digital Camera Pin
Franz Klein26-Oct-04 11:22
Franz Klein26-Oct-04 11:22 
GeneralRe: Interacting with a Digital Camera Pin
Jörgen Sigvardsson26-Oct-04 11:38
Jörgen Sigvardsson26-Oct-04 11:38 
GeneralRe: Interacting with a Digital Camera Pin
markkuk26-Oct-04 12:30
markkuk26-Oct-04 12:30 
GeneralCancel button in window not working Pin
Xzyx987X26-Oct-04 9:55
Xzyx987X26-Oct-04 9:55 
GeneralStreaming Audio Pin
nlecren26-Oct-04 9:09
nlecren26-Oct-04 9:09 
GeneralRe: Streaming Audio Pin
NietzscheDisciple26-Oct-04 9:45
NietzscheDisciple26-Oct-04 9:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.