|
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
|
|
|
|
|
I think you can go for simple registry class known CRegKey defined in atlbase.h
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
no it works wel, but not when i click the button.
BOOL Cfirstw32mfcApp::InitInstance()
{
SetRegistryKey(_T("Natural_Demon"));
..
..
}
// this part works wel
EDIT1 = AfxGetApp()->GetProfileString("Settings", "email", "your login");
EDIT2 = AfxGetApp()->GetProfileString("Settings", "password", "details here..");
UpdateData(FALSE);
this part work wel also, i faild the retireve the data from the interface, although i use"UpdateData(FALSE);"
i can paste it anywhere in the script, but if i use this "Cfirstw32mfcDlg::OnButtonOK()"
HRESULT Cfirstw32mfcDlg::OnButtonOK(IHTMLElement* /*pElement*/)
{
UpdateData(FALSE);
AfxGetApp()->WriteProfileString("Settings", "email", EDIT1);
return FALSE; // return TRUE unless you set the focus to a control
...
..
}
it fails to retrieve the fresh data
kind regards,
marco
|
|
|
|
|
Hi
In my application i am using createprocess() function to run an exe. once if i close the application, process will get terminated automatically. thats fine. but if i call openprocess() with that old process id,still it is returning some non null process handle. this is there only in windows xp (not in windows 2000,etc).i need solution for this issue
Thanks
JP
ALL THINGS ARE POSSIBLE UNTIL THEY ARE PROVED IMPOSSIBLE-AND EVEN THE IMPOSSIBLE MAY ONLY BE SO,AS OF NOW
|
|
|
|
|
|
Hello
I create a MFC aplication, and in my cpp file, i define a variable C++
string str;
I know that, i can use CString, but i want to know why it appears "error link"
when i compile project, it appears error (error link) like that
"Linking...
msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >(void)" (??1?$basic_strin
g@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in ocl.lib(ora.obj)
msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >(class basic_string<char,s
truct std::char_traits<char="">,class std::allocator<char> >::allocator<char> const &)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV?$allocator@D@1@@Z) already defined in ocl.lib(ora.obj)
LINK : warning LNK4098: defaultlib "LIBCMTD" conflicts with use of other libs; use /NODEFAULTLIB:library
Bin/BMSOracleView.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
"
|
|
|
|
|
|
The ocl.lib is your or third-party library?
Robert-Antonio
"Friends come and leave, but teddybears stay in forever."
|
|
|
|
|
try inclding the lines at ur stdafx.h
using namespace std;
replace string with std::string and I hope u have not forgotten to include
#include <string.h>
Dharani babu S
redindian
|
|
|
|
|
I think that it isn't the case. If you forget the std namespace, you will get an Undeclared identifier error, not linker error.
Robert-Antonio
"What do you mean, I can't initialize things in an assert()?"
|
|
|
|
|
What I'd like to do is this..
When I put '1' to the edit ctrl, the contents of editctrl should be changed to '2', if '2', then should be '3' and so forth..
That's why I used EN_CHANGE event handler..
In the handler, at first I read the int value of edit ctrl by GetdlgItemInt API.
then add 1 to the value,
finally called SetDlgItemInt with the new changed value..
But the result was the infinite loop..
does that make sense?
That's because SetDlgItemInt API cause new EN_CHANGE event.. before the first event finished the job..
How can I solve that problem?
As I said before, the contents of edit ctrl should change simultaously as I typed the value..
|
|
|
|
|
Have you tried using SetWindowText() instead???
How do I print my voice mail?
|
|
|
|
|
sure..
It also cause infinite loop
|
|
|
|
|
Simply use a flag in your OnChange handler. Set it to true before calling SetDlgItemInt and set to false afterwards. At the start of your handler, check the flag.
CMyDlg::OnChangeMyEdit()
{
static bool flag = false;
if (!flag)
{
UINT number = GetDlgItemInt(IDC_MY_EDIT, NULL, FALSE);
number++;
flag = true;
SetDlgItemInt(IDC_MY_EDIT, number, FALSE);
flag = false;
}
}
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Thanks, That's what I wanted..
That's kind of trick anyway,
but it seem to be the best way..
|
|
|
|
|
i want to use flash in vc++.
please help me.
how to use flash in vc++.
|
|
|
|
|
you need to actually ask a question
what do you want to do?
Bryce
---
To paraphrase Fred Dagg - the views expressed in this post are bloody good ones.
--
Publitor, making Pubmed easy.
http://www.sohocode.com/publitor
Our kids book :The Snot Goblin
|
|
|
|
|
i need flash control in vc++.how to use it.what i use dll or ocx(activex).i want Macromedia Flash play on my application dialog.VB support flash.I don't know that VC++ is support or not.please help me.
|
|
|
|
|
Hi,
I want to create a SDI application with toolbars.
If I click on each tool, it will open up a dialog box.
I want to diaply the content of a particular edit control from a dialog box to the SDI window?
How can I do that? any help is highly appreciated.
Thanks,
|
|
|
|
|
for each buttons in the toolbar, you create an handler ( ON_COMMAND ).
in each handler, you create a dialog; which you previously created in the resource editor; and yo created classes for each dialog.
I want to diaply the content of a particular edit control from a dialog box to the SDI window?
Huh ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Maximilien wrote:
I want to diaply the content of a particular edit control from a dialog box to the SDI window?
Well to do that assume you are calling your manu dialogs from your view class .
Declare the Dialog objects in view.h and call dlg.DoModal() in the button event handler.
if( dlg.DoModal()==IDOK)
{
//access the edit control's contents and copy it to a global string ...
}
Now Dig the msdn to find out how a text editor program works so that you can display the contents in your view . ( I ha done it but forgot )
Dharani babu S
|
|
|
|
|
I am writing a Win32 application that needs to be able to detect whether or not the user has administrator privileges.
Anyone know how to detect this?
Thanks!
|
|
|
|
|
|
I am building some stochastic models for risk analysis...so I need to build things like influence diagrams, decision trees etc. These are easy to do in Excel, but we would to rebuild the model using Visual C++ 6.0. How do I build and present, using a graphical interface, distributions such as normal, lognormal, poisson, uniform and binary distributions?
|
|
|
|
|
I dunno what a stochastic model for risk analysis is, but Excel is not programming. VC++ isn't going to provide you with a graphical interface to do this stuff, you need to write code to do it.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|