|
Hi Every one.
I need authentication details. Could any one please kindly helpme in this.
What is authentication, and how to check this authentication. How to use SSL concept in the Email sending program. please help me. this is urgent for me.
Nice talking to you. If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
Does CString allocate memory on the heap or on the stack?
<br />
#include "stdafx.h"<br />
<br />
#include <afxwin.h>
#include <afxext.h>
#include <afxtempl.h><br />
<br />
#include "TestCString.h"<br />
<br />
#ifdef _DEBUG<br />
#define new DEBUG_NEW<br />
#undef THIS_FILE<br />
static char THIS_FILE[] = __FILE__;<br />
#endif<br />
<br />
<br />
CWinApp theApp;<br />
<br />
using namespace std;<br />
<br />
<br />
void SomeFunc(CList<CString, CString> &oList) {<br />
CString strOriginal = L"ABCDEF";<br />
CString strNewString; << Local variable declared on Stack but seems like it allocates on heap since it can be called from "Main".<br />
<br />
strNewString = strOriginal.Mid(2);<br />
oList.AddTail(strNewString);<br />
<br />
return;<br />
}<br />
<br />
<br />
<br />
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])<br />
{<br />
int nRetCode = 0;<br />
<br />
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))<br />
{<br />
cerr << _T("Fatal Error: MFC initialization failed") << endl;<br />
nRetCode = 1;<br />
}<br />
else<br />
{<br />
CList<CString, CString> oList;<br />
CString strString;<br />
<br />
SomeFunc(oList);<br />
strString = (CString) oList.GetHead();<br />
<br />
printf("%s", strString);<br />
}<br />
<br />
return nRetCode;<br />
}<br />
|
|
|
|
|
The memory for the character array is on the heap.
|
|
|
|
|
devvvy wrote: Does CString allocate memory on the heap or on the stack
CString uses heap to create char array.
devvvy wrote: CString strNewString; << Local variable declared on Stack but seems like it allocates on heap since it can be called from "Main".
strNewString = strOriginal.Mid(2);
oList.AddTail(strNewString);
Actually, CString class uses class CStringData , which keeps tack of this buffer using reference counting.
In this case AddTail cause to increase refernce count by 1, thats why buffer contained in strNewString will not be destroyed even though object goes out of scope.
|
|
|
|
|
i am having a tab with two items. when i click cancel from one item the dialog with tab has to be closed. how to do this
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
deeps_cute wrote: when i click cancel from one item the dialog with tab has to be closed
Send custom message to dialog, which has the tab. Handle the message in the dialog and close it as you like (say OnOK or OnCancel or EndDialog ...)
or
If the dialog is the parent winodw for the tab then simply call
GetParent()->EndDialog(..);
Hope i understood your question..
Do your Duty and Don't expect the Result
|
|
|
|
|
how to control the tab dialog from parent dialog? i want to call a function declared in tabdialog from the parent parent dialog
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
deeps_cute wrote: want to call a function declared in tabdialog from the parent parent dialog
Just use the tabdialog instance to call its method (make sure the access specifier for the methos is public)
Hope i understood your question...
Do your Duty and Don't expect the Result
|
|
|
|
|
ya i created an instance and called the function. but it get crashed since m_hwnd = NULL.
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
deeps_cute wrote: but it get crashed since m_hwnd = NULL
Did u Create the tabdialog before calling the method..
Simply
CMyTabDialog m_wndMyTabDlg;
m_wndMyTabDlg.MyMethod(...)
will lead to crash, because u didn't create the tabdialog...
You have to proceed like this
CMyTabDialog m_wndMyTabDlg;
m_wndMyTabDlg.Create(...);
m_wndMyTabDlg.MyMethod(...);
Refer MSDN for Create
Do your Duty and Don't expect the Result
|
|
|
|
|
create dialog? i have created initially a dialog named landialog. this is the tab dialog.
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
deeps_cute wrote: i have created initially a dialog named landialog. this is the tab dialog
No matter how many dialog u have created already...
For every dialog you have to create it before using its methods or CDialog's APIs.
Its better u can post your code and explain wht u need?...
Do your Duty and Don't expect the Result
|
|
|
|
|
From main dialog
void NetConfig::OnClearbutton()
{
LANSettings lanPrc;
lanPrc.Create(IDD_LANSETTINGS,GetParent());
lanPrc.ClearAll((LPARAM)this);
UpdateData(TRUE);
}
this is what i need to call
void LANSettings::ClearAll(LPARAM lParam)
{
(GetDlgItem(IDC_EDIT_LSUBNET))->SetWindowText("");
(GetDlgItem(IDC_EDIT_LIPADD))->SetWindowText("");
(GetDlgItem(IDC_EDIT_LGATE))->SetWindowText("");
(GetDlgItem(IDC_EDIT_LDNS1))->SetWindowText("");
(GetDlgItem(IDC_EDIT_LDNS2))->SetWindowText("");
}
when we create the dialog its just entering in to its initdialog.
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
deeps_cute wrote: lanPrc.Create(IDD_LANSETTINGS,GetParent());
Instead of using GetParent(), use 'this'. Because the parent to the LANSettings dialog is NetConfig, not the Parent of NetConfig.
Otherwise the code seems perfect.Try the above...
Do your Duty and Don't expect the Result
|
|
|
|
|
yes thers no error but it does not clear the edit boxes(done in the function)
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
The code seems perfect. But i have a doubt, is your edit boxes values are string. If so then the code will work.
But if your edit boxes values are integer then u have to use
SetDlgItemInt(...); as StDlgItemInt(IDC_EDIT_XXXX, nValue, TRUE or FALSE);
TRUE for Signed integer and FALSE for unsigned integer
Do your Duty and Don't expect the Result
|
|
|
|
|
its string only
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
Then i didn't see anything wrong in the code...
May be for a try..
Remove the UpdateData(TRUE) statement and
Use SetDlgItemText(...) instead of using GetDlgItem(..)->SetWindowTExt(..)
Do your Duty and Don't expect the Result
|
|
|
|
|
actually the problem is its creating another dialog and the changes are upsated there. how to avoid this
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
Make the instance as a member to the parent class.
Use the Create API in the OnInitDialog() method of the Parent class.
Then use the instance (member of that class).
Actullay i forget ut class names, so see the below ex.
class CParentClass
{
CChildClass m_wndChild;
};
BOOL CParentClass::OnInitDialog()
{
CDialog::OnInitDialog();
m_wndChild.Create(IDD_XXX, this);
....
}
xxx CParentClass::ButtonClick(..)
{
m_wndChild.ClearEditControls(..);
}
Hope its clear..
Do your Duty and Don't expect the Result
|
|
|
|
|
sorry it not working again the same problem. thanks a lot for helping me. ok can you tell me how to close the parent dialog from the tabdialog. close netconfig from landialog
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
deeps_cute wrote: how to close the parent dialog
This is the first question u posted...
See my answer...
Do your Duty and Don't expect the Result
|
|
|
|
|
sorry i cant understand that can you please send me the sample code
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
GetParent()->EndDialog(nValue);
or
GetParent()->DestroyWindow();
nValue may be any numeric value... this will be the return value of DoModal
Do your Duty and Don't expect the Result
|
|
|
|
|
EndDialog gets an error "'EndDialog' : is not a member of 'CWnd'" and i cant use the other since this will close all the windows(running in background)
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|