|
Hmm... My bad. Just forgot about it.
void CMainFrame::OnDataedit()
{
// Displays the data Edior dialog box
CDataEditor * dlg;
dlg = new CDataEditor;
dlg->DoModal();
}
|
|
|
|
|
Looks OK. What errors do you get?
Can you call your class on the stack instead of on the heap?
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
I don't get any errors. That's the thing. When I click the toolbar button, the whole programs hangs and I have to end it with ctrl-alt-del.
I tried to use Create( IDD_TEMPLATEID, NULL) instead of DoModal(). The only thing I accomplished was being able to shut down the program in a normal way. The only thing that showed up was the cancel button in the dialog, somehow.
For your second question...remember that I'm a newbie. I don't understand what that means
------------------------------
The great successful men of the world have used their imagination...they think ahead and create their mental picture in all its details, filling in here, adding a little there, altering this a bit and that a bit, but steadily building-steadily buildings. (Robert Collier)
|
|
|
|
|
Answer to second question:
void CMainFrame::OnDataedit()
{
CDataEditor dlg;
dlg.DoModal();
}
For the first question - IDD_TEMPLATEID is a valid resource (one that is actually visible with the resource editor)?
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
Well, for the code you gave me... It showed the dialog in a split second, before it disappeared again, and the whole program freezed once again.
The IDD_TEMPLATEID is a valid resource, yes. I double-checked the properties and it's set to visible and disabled is NOT checked. It has the child-style set.
I'm using VC++ 6.0 if that has anything to say.
------------------------------
The great successful men of the world have used their imagination...they think ahead and create their mental picture in all its details, filling in here, adding a little there, altering this a bit and that a bit, but steadily building-steadily buildings. (Robert Collier)
|
|
|
|
|
Do you have any odd code in the dialog's OnInitDialog() method (that might be causing it to go away)?
|
|
|
|
|
Well, no. The dialog only has a ClassWizard-generated class connected to it. I haven't edited that class by hand in any way. In fact, there is no OnInitDialog string in any of the source code. I am assuming that means that MFC does all the required "standard" work?
------------------------------
The great successful men of the world have used their imagination...they think ahead and create their mental picture in all its details, filling in here, adding a little there, altering this a bit and that a bit, but steadily building-steadily buildings. (Robert Collier)
|
|
|
|
|
Your CDataEdit is derived from CDialog ? That is, it has
class CDataEdit : public CDialog
{
...stuff...
} written in its header file?
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
Yes, it's derived from CDialog.
If you want and got the time, I can give you the source code to see if you find anything wrong...
------------------------------
The great successful men of the world have used their imagination...they think ahead and create their mental picture in all its details, filling in here, adding a little there, altering this a bit and that a bit, but steadily building-steadily buildings. (Robert Collier)
|
|
|
|
|
OldViking wrote:
It has the child-style set.
This is the problem I bet. If you are trying to show a modal dialog box, don't make it a Child, make it a Popup style. If your point was to embed the dialog on a different window, that's a whole different story.
So, for now, go change that Child style to Popup, and you don't need to create the dialog on the heap if it's a modal dialog. Just create it on the stack:
C_ICantRememberTheClassName_Dlg dlg;
dlg.DoModal();
Chris Richardson Terrain Software
|
|
|
|
|
I recommend you teach yourself via one of the many available tutorials on MSDN. I used Scribble and it helped tremendously with all this stuff.
Regards,
Alvaro
If you want to get to the top, prepare to kiss a lot of bottom. -- despair.com
|
|
|
|
|
Hi,
I want to change the Winlogon policy
programmatically. This I'm able to do by finding some of
the registry entries in the Windows registry which would
bring this policy into effect.
But changing this policy through registry don't show the
changed status in the windows 2k Local Security Policy
snap-in.
What shall I do to reflect this change in the Local
Security Policy Snap-in.
Thanks,
Abhishek.
Learning is a never ending process of Life.
|
|
|
|
|
Hello,
i have a text file where i store a number. When i read the value in my szBuffer(CString) i like to cast this to an integer because i want to increment this value.
After the incrementation i like to write the value back into the file. So cast from int to CString(szBuffer)
Any ideas, code?
Thanks, Mark
|
|
|
|
|
try this:
iInteger=atoi(LPCTSTR(csCString));
iInteger++;
csCString.Format("%d",iInteger);
this should do it!
greets,
Jason
|
|
|
|
|
yeah, works great. And how is the function to cast int to CString??;)
Thanks, Mark
|
|
|
|
|
C style:
char buf[10];
int number = 5;
sprintf(buf, "%d", number);
CString bleh = buf;
STL style:
#include <sstream>
std::ostringstream str;
int number = 5;
str << number;
CString bleh = str.str().c_str();
MFC style:
CString bleh;
int number = 5;
bleh.Format("%d", number);
Boost style (www.boost.org):
#include <boost/lexical_cast.hpp>
int number = 5;
std::string str = boost::lexical_cast<std::string>(number);
CString bleh = str.c_str();
|
|
|
|
|
Oh yes ok. I am still sleeping...
Thanks, Mark
|
|
|
|
|
As i already wrote: if you are using the MFC CString class, simply use
CString::Format();
else use
sprintf();
examples:
csCString.Format("%d",iInteger);
or
sprintf(cBuffer,"%d",iInteger); (where cBuffer is of type char*)
greets,
jason
|
|
|
|
|
everybody
i am getting problem in embedded display( i am using in place active verb for display) when ever i run program for the excel embedded display it self i am unable to resize it where as it is fine with the word or any other component with the same source code can any body help me?\
thanks in advance
naresh
|
|
|
|
|
hi
how to load a jpg/bmp image in an sdi application as the background graphics.... help help help me....
and yah how u can show ur own graphics instead of titlebar.... plz help and answer as soon as possible
happy programming u all
regards
Nauman Ghazi
Bahria University
|
|
|
|
|
The following example code can be used for loading a BMP file image in any vc++ application.
HBITMAP hbitmap;
hbitmap = (HBITMAP)LoadImage(NULL,"C:\\house.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
HDC hmemdc;
hmemdc = CreateCompatibleDC(pDC->m_hdc);
SelectObject(hmemdc,hbitmap);
BitBlt(pDC->m_hdc,0,0,image_width,image_height,hmemdc,0,0,SRCCOPY);
For viewing as a background image in an SDI application the above code can be used inside the OnDraw(CDC *pDC) method of view class.
For loading a JPEG file you can use external JPEG libraries such as the
IJL15.DLL which is freely available.
R.Balachandran
|
|
|
|
|
hi all
i want to add a list control to an sdi application which couldnt be derived fron CListView in the start(while making the software through the wizard)how can i do it and furthermore i want to display icons with each item .... please reply as soon as possible ... and plz tell with explanation as i am a beginner ...
do tell me that where to place the code as well coz i am facing problems in this regard also
take cares and
happy programming
Nauman Ghazi
Bahria University
|
|
|
|
|
Hello All,
I have a bitmap having a set of pixel values arranged in the form of a sine curve. Keeping the starting point, end point and direction of the sine curve intact I want to remove the troughs and crests in the sine curve and make it a straight line.. How to go about it.
Thanks
Rajdeep
|
|
|
|
|
hi all,
I am writing a text file..I am using BHO and when i am trying to write the data in DISPID_NAVIGATECOMPLETE2...it shows an exception and IE is closed..I am opening the file in setsite and closing it in destructor..am i doing something wrong..please help..any pointers and ideas..please..
Himanshu
|
|
|
|
|
hi all,
I am using a BHO and i want to open a popup when IE fires event DISPID_NAVIGATECOMPLETE2...can anyone help me out..any pointers and ideas are welcome..Ur help will be highly appreciated..I am in urgent need..please..
Thanks in advance..
Himanshu
|
|
|
|