Click here to Skip to main content
15,896,557 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalhelp me Pin
Wiltein25-Oct-04 21:17
Wiltein25-Oct-04 21:17 
GeneralRe: help me Pin
Maximilien26-Oct-04 1:00
Maximilien26-Oct-04 1:00 
GeneralRe: help me Pin
jan larsen26-Oct-04 3:30
jan larsen26-Oct-04 3:30 
GeneralRetain MFC Controls values for Next Open VC++6.0 Pin
Sumit Kapoor25-Oct-04 21:01
Sumit Kapoor25-Oct-04 21:01 
GeneralRe: Retain MFC Controls values for Next Open VC++6.0 Pin
Maximilien26-Oct-04 0:54
Maximilien26-Oct-04 0:54 
GeneralRe: Retain MFC Controls values for Next Open VC++6.0 Pin
BlackDice26-Oct-04 3:51
BlackDice26-Oct-04 3:51 
GeneralThanks you both, Check what I used Pin
Sumit Kapoor26-Oct-04 19:11
Sumit Kapoor26-Oct-04 19:11 
Generalit fails to retrieve newly intruduced data by the user Pin
Natural_Demon25-Oct-04 20:45
Natural_Demon25-Oct-04 20:45 
it fails to retrieve newly intruduced data by the user.

i tried this ...
AfxGetApp()->WriteProfileString("Settings", "email", EDIT1);
UpdateData(FALSE);

and this..
CDHtmlDialog::GetElementText(_T("email"));
if(CDHtmlDialog::GetElementText(_T("email")))
{
EDIT1=_T("works");
}
else
{
EDIT1=_T("it doesn't work");
}

i tried many combination and searching answer, but i can't find one right.

this is qwhat i do on init

BOOL Cfirstw32mfcDlg::OnInitDialog()
{
..
..
..
...

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

EDIT1 and EDIT2 contain values, either from the register or the alternative 'default value'and it wil be displayed in the userinterface
it's also visible in the userinterface, but if i intruduce values manualy and press ok,
'UpdateData(FALSE);' doesn't update anything, nor UpdateData();,UpdateData(TRUE); or UpdateDialogControls(this, FALSE);
i tried resting the values as u can see, but than the entries in the registry are also empty

what am i doing wrong here

thanx for your time and kind regards,

marco


// firstw32mfcDlg.cpp : implementation file
//

#include "stdafx.h"
#include "firstw32mfc.h"
#include "firstw32mfcDlg.h"
#include ".\firstw32mfcdlg.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"), OnEnChangeEdit1 )
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_EDIT2);
DDX_DHtml_ElementInnerText(pDX, _T("Temp_Text2"), m_EDIT2);
}



BEGIN_MESSAGE_MAP(Cfirstw32mfcDlg, CDHtmlDialog)
ON_WM_SYSCOMMAND()
//}}AFX_MSG_MAP
//ON_EN_CHANGE(IDC_EDIT1, OnEnChangeEdit1)
//ON_EN_CHANGE(IDC_EDIT2, OnEnChangeEdit2)
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=("");
//EDIT2=("");
EDIT1 = AfxGetApp()->GetProfileString("Settings", "email", "your login");
EDIT2 = AfxGetApp()->GetProfileString("Settings", "password", "details here..");
UpdateData(FALSE);
//EDIT1=("");
//EDIT2=("");
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);
}
}

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*/)
{
CDHtmlDialog::GetElementText(_T("email"));
if(CDHtmlDialog::GetElementText(_T("email")))
{
EDIT1=_T("works");
}
else
{
EDIT1=_T("it doesn't work");
}
AfxGetApp()->WriteProfileString("Settings", "email", EDIT1);
GetElementText(_T("password"));
AfxGetApp()->WriteProfileString("Settings", "password", EDIT2);
OnCancel();

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

HRESULT Cfirstw32mfcDlg::OnButtonCancel(IHTMLElement* /*pElement*/)
{
GetElementText(_T("email"));
if(GetElementText(_T("email")))
{
EDIT1=_T("works");
}
AfxGetApp()->WriteProfileString("Settings", "email", EDIT1);
GetElementText(_T("password"));
AfxGetApp()->WriteProfileString("Settings", "password", EDIT2);
OnCancel();
return S_OK;
//return 0;
}
HRESULT Cfirstw32mfcDlg::OnEnChangeEdit1(IHTMLElement* /*pElement*/)
{
//CDHtmlDialog::GetElementText(EDIT1);
//UpdateDialogControls(this, FALSE);
//UpdateData(FALSE);
AfxGetApp()->WriteProfileString("Settings", "email", EDIT1);
return FALSE;
}

HRESULT Cfirstw32mfcDlg::OnEnChangeEdit2(IHTMLElement* /*pElement*/)
{
//UpdateData(FALSE);
AfxGetApp()->WriteProfileString("Settings", "password", EDIT2);
return FALSE;
}



// firstw32mfcDlg.h : header file
//

#pragma once


// Cfirstw32mfcDlg dialog
class Cfirstw32mfcDlg : public CDHtmlDialog
{
// Construction
public:
Cfirstw32mfcDlg(CWnd* pParent = NULL); // standard constructor

// Dialog Data
enum { IDD = IDD_FIRSTW32MFC_DIALOG, IDH = IDR_HTML_FIRSTW32MFC_DIALOG };
CString EDIT1;
CString EDIT2;
CString m_EDIT1;
CString m_EDIT2;
CString m_TEMP_EDIT1;
CString m_TEMP_EDIT2;

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

HRESULT OnButtonOK(IHTMLElement *pElement);
HRESULT OnButtonCancel(IHTMLElement *pElement);
HRESULT OnEnChangeEdit1(IHTMLElement *pElement);
HRESULT OnEnChangeEdit2(IHTMLElement *pElement);

// Implementation
protected:
HICON m_hIcon;

// Generated message map functions
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
DECLARE_DHTML_EVENT_MAP()
public:
//char m_EDIT1;
//char m_EDIT2;
//afx_msg void OnEnChangeEdit1();
//afx_msg void OnEnChangeEdit2();
};

it gives a headache, knowing so much and stil not knowing anything
GeneralRe: it fails to retrieve newly intruduced data by the user Pin
ThatsAlok25-Oct-04 23:00
ThatsAlok25-Oct-04 23:00 
GeneralRe: it fails to retrieve newly intruduced data by the user Pin
Natural_Demon26-Oct-04 3:39
Natural_Demon26-Oct-04 3:39 
GeneralOpenProcess() issue in win XP Pin
P_JAYAPRAKASH25-Oct-04 19:08
P_JAYAPRAKASH25-Oct-04 19:08 
GeneralRe: OpenProcess() issue in win XP Pin
bryce25-Oct-04 19:48
bryce25-Oct-04 19:48 
GeneralError Link in VC++ Pin
TrungHuynh25-Oct-04 18:25
TrungHuynh25-Oct-04 18:25 
GeneralRe: Error Link in VC++ Pin
bryce25-Oct-04 19:44
bryce25-Oct-04 19:44 
GeneralRe: Error Link in VC++ Pin
Robert A. T. Káldy26-Oct-04 0:28
Robert A. T. Káldy26-Oct-04 0:28 
GeneralRe: Error Link in VC++ Pin
dharani26-Oct-04 21:24
dharani26-Oct-04 21:24 
GeneralRe: Error Link in VC++ Pin
Robert A. T. Káldy28-Oct-04 23:43
Robert A. T. Káldy28-Oct-04 23:43 
Generalplaying with edit ctrl Pin
bektek25-Oct-04 18:17
bektek25-Oct-04 18:17 
GeneralRe: playing with edit ctrl Pin
alex.barylski25-Oct-04 18:20
alex.barylski25-Oct-04 18:20 
GeneralRe: playing with edit ctrl Pin
bektek25-Oct-04 18:35
bektek25-Oct-04 18:35 
GeneralRe: playing with edit ctrl Pin
PJ Arends25-Oct-04 18:46
professionalPJ Arends25-Oct-04 18:46 
GeneralRe: playing with edit ctrl Pin
bektek25-Oct-04 19:22
bektek25-Oct-04 19:22 
Questionhow to use flash in vc++ Pin
vc-programmer-25-Oct-04 16:57
vc-programmer-25-Oct-04 16:57 
AnswerRe: how to use flash in vc++ Pin
bryce25-Oct-04 19:41
bryce25-Oct-04 19:41 
GeneralRe: how to use flash in vc++ Pin
vc-programmer-25-Oct-04 20:29
vc-programmer-25-Oct-04 20:29 

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.