|
I want to change the parent of a dialog so that its parent is the top level dialog (i.e. my main app). What is the correct way of doing this as when I get a pointer to the main dialog and use that the main app stops refreshing its display.
What I want is something like this:
MainApp->Modeless Dialog->Modeless Dialog->Modal Dialog attached to MainApp
I can get this working by callbacks through the code but thought that by simply doing modal_dialog->SetParent ( main_app ) would have the same effect but it doesn't.
cheers,
Andy
|
|
|
|
|
Use the ctor.
CDialog::CDialog (MFC)[^]
explicit CDialog(
LPCTSTR lpszTemplateName,
CWnd* pParentWnd = NULL
);
explicit CDialog(
UINT nIDTemplate,
CWnd* pParentWnd = NULL
);
Maxwell Chen
|
|
|
|
|
thank you, should have thought of that myself rather than looking at more complicated ways of doing it.
many thanks
|
|
|
|
|
Hi all,
What is the use of the __fastcall calling convention ?
Many Thanks
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
|
|
|
|
I have a "Dialogbox program" COriginDlg
I want to open a new dialog box CNewDlg -> using doModal()
In the new dialog box I want to access the original dialog box's variables etc.
Is this possible ??
WHen I try the following
BOOL CNewDlg::OnInitDialog()
{
CDialog::OnInitDialog();
COriginDlg dlg ; <------ ????
int i = dlg.Len ; <----- Try to access the variable 'Len' which is part of the class COriginDlg
< ERROR generated is "ACCESS VIOLATION" ???????
}
Any Ideas on how to do this properly ?
|
|
|
|
|
|
Does COriginDlg derived of CDialog?
|
|
|
|
|
Thanks for the reply.
Yes I think both are derived from CDialog
Both have:
class COriginDlg : public CDialog
class CNewDlg : public CDialog
------
Should I have derived CNewDlg from COrginDlg ???
|
|
|
|
|
sofa_2006au wrote: Should I have derived CNewDlg from COrginDlg ???
Only if CNewDlg is a COrginDlg .
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
No box are seperate Dialog box windows with list box controls etc
|
|
|
|
|
Then why would you ask, "Should I have derived CNewDlg from COrginDlg ???"
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello
I have a function whose signature is as follows: void Encrypt(char const* in, char* result, size_t n);
to call this function, I have written the following piece of code:
CString strValid = "Sample String";
char *szTemp = strValid.GetBuffer(strValid.GetLength());
strValid.ReleaseBuffer(-1);
char szDataOut[128] = "\0";
poMethod->Encrypt(szTemp,szDataOut,128);
This piece of code, works fine as desired in the DEBUG mode, but misbehaves in the RELEASE mode. I am unable find the subtle difference. I feel I am doing something wrong while intitialzing the char variables. Please help me out.
Thanx
|
|
|
|
|
1/ You use get buffer to give you a temporary pointer to your data, then release it again.
The releasebuffer member function may well move stuff about inside the string, invalidating the pointer you had - and that behaviour could be different in debug or release modes.
To say it differently...
szTemp is only valid between the GetBuffer () and ReleaseBuffer calls. After that, all bets are off.
2/ Secondly, you don't need to use GetBuffer / ReleaseBuffer at all, as the in parameter is const...
What's wrong with...
CString strValid = "Sample String";
char szDataOut[128] = "\0";
poMethod->Encrypt(strValid,szDataOut,128);
If you look at CString, it has a LPCTSTR operator, to give a const pointer, just like you need.
Iain.
|
|
|
|
|
Hello
I need to retrieve the ID of a process, but I only have a thread ID, I know that there is a funtion for that, GetProcessIdOfThread, bit it only works on Vista but I need it to work on Windows 2000, so I need the equivalent for this operating system.
Any help please?
Thank you very much
|
|
|
|
|
Have you tried with GetCurrentProcessId() ?
Regards,
Paresh.
|
|
|
|
|
Thanks, but I need the PID of another process, not the "current one"
|
|
|
|
|
GetProcessIdOfThread(OpenThread( THREAD_ALL_ACCESS ,false ,thread id))
|
|
|
|
|
What part of "I know that there is a funtion for that, GetProcessIdOfThread, bit it only works on Vista but I need it to work on Windows 2000..." did you not understand?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Have you been wasting time with that Gugel thing again
|
|
|
|
|
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|