|
I raised this with Nish when he posted the article. You need to store your pointers into a vector or ( heaven forbid ) a CArray, so you have them all. Otherwise, you have dangling pointers, and your UI no longer has any control over the dialogs it created.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
I am going to use the registry saving stuff because when my app starts, the main screen shows up with no data in it (but configured with settings previously saved by user), the app is supposed to go check the registry, and if it finds a database name stored there, things progress, but if not, a CFIleDialog Open pops up. So I gather I''ll be using:
RegQueryValue and RegSetValue.
Have to set stuff when leaving. Which two places does one save and retrieve from? Which class and which event?
I dont have a feel for this yet.
thanks,
ns
|
|
|
|
|
Hmmmm, perhaps in your BOOL CWinAppDerived::InitInstance(), just before the creation of the CMainFrame window.
Or if you actually want the window up before you read the values, then put them in CMainFrame::OnCreate after all the stuff that's already put there by the App wizard
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Appreciate the info. I'll try it as soon as I figure out what stuff it is that I actually need to save ...something like app size configured by the user, and other details like location on the screen I suppose.Thanks again,
ns
|
|
|
|
|
I have:
void CTrain1Doc::OnSelectdatabase()
{
//CFileDialog fileDlg( TRUE, NULL, NULL, OFN_ALLOWMULTISELECT | OFN_HIDEREADONLY, "All Files (*.*)|*.*||", this);
CFileDialog fileDlg(TRUE, NULL, NULL, OFN_HIDEREADONLY|OFN_FILEMUSTEXIST, "Database Files(*.bmp)|*.bmp||",NULL);
}
The commented out line was the way I saw it in a codeproject sample. But my compiler said it needed a Cwnd* in parameter 6, not a doc *, so I made it NULL. Is this ok? Are there any dangers of saying the parent is NULL?
TIA,
ns
|
|
|
|
|
|
|
What is in the Exit Command handler? Not EndDialog right? THis is an MDI project. I didnt want to use the standard exit provided in the default menu...
Which class shall I associate this Exit item with? View? Doc? or MAinFrame?
Thanks,
ns
|
|
|
|
|
What exactly do you want to do with the Menu-Exit handler? The Menu-File-Exit basically posts a WM_CLOSE to the main frame window. So if you want to prompt the user and ask her whether she wants to quit, override WM_CLOSE in your main frame window!
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Okay!
That sounds great! Appreciate it,
ns
|
|
|
|
|
Do I say DestroyWindow() in the mainframe::onclose()?
Thanks,
|
|
|
|
|
|
Nishant S wrote:
("Sure?","?",
Short. Adn to the point. I like it.
"When a friend hurts us, we should write it down in the sand, where the winds of forgiveness get in charge of erasing it away, and when something great happens, we should engrave it in the stone of the memory of the heart, where no wind can erase it" Nish on life [methinks]
"It's The Soapbox; topics are optional" Shog 9
|
|
|
|
|
If you look up the ID for that menu handler ID_APP_EXIT on MSDN you will find the answer. It contains a short explanation how many standard menu commands are implemented.
ID_APP_EXIT: Exit the application.
CWinApp::OnAppExit handles this command by sending a WM_CLOSE message to the application's main window. The standard shutting down of the application (prompting for dirty files and so on) is handled by the CFrameWnd implementation.
Customization of this command handler is not recommended. Overriding CWinApp::SaveAllModified or the CFrameWnd closing logic is recommended.
If you choose to implement this command, we recommend you use this command ID.
|
|
|
|
|
Hi @all!
I want to use a CDragListBox. I have read inside this forum: First I must make a CListbox with a member variable of the type CListBox. Then I must change the type of the member variable in CDragListBox.
My Problem: When I run the programm I got a debug error!!!!!
What do I have to still change?
Greetings,
MFC is the Best
|
|
|
|
|
|
The programm does not start. After the linking comes the debug error:
"Debug Assertion Failed!!"
MFC is the Best
|
|
|
|
|
Okay
I am gonna make a guess here, but I think I am gonna back my guess
I just added a listbox to a new dialog and associated it with a CDragListBox object, compiled, ran and got the debug assert
The problem is that, by default the dialog resource editor will set the LBS_SORT style for the list box control. That's what causing the assert.
Take properties and make the Sort property to False , it'll be True by default.
Now you won't have the error
Regards
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Thank you very much! It works......
|
|
|
|
|
First step is to tell us where it crashes, otherwise we are just guessing.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
In the MessageBox:
File: winctrl2.cpp
The Debug makes the error in this function:
extern "C" int WINAPI
_tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPTSTR lpCmdLine, int nCmdShow)
{
// call shared/exported WinMain
return AfxWinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
}
MFC is the Best
|
|
|
|
|
I want to export from my apploication (VC++ 6.0 + MFC) an XML string. How do I use msxml to create that string ?
It should be semething like this:
<workspace>
<object>
//properties.... (other fields )
I don't know what interface to use, and what methods ...
Thank You !
|
|
|
|
|
Create a new DOMDocument object called say xdoc. Add nodes to the XML tree of the type IXMLDOMNode, and then call doc.xml to return the XML as a string.
There are a few articles on CP showing you how to #import and make use of the COM objects.
MS have provided two XML parsers. The DOM parser, and the SAX parser. The DOM parser basically does what its told as its just a series of objects and calls to manipulate them, where as the SAX paser is event based which can make it quite useful for parsing big documents in a distrubuted environment.
http://www.codeproject.com/soap/iexmlparser.asp
|
|
|
|
|
For creating high performance socket server, we use the technique of IO completion ports. We create IO completion port and related threads ourself using the function CreateIOCompletionPort().
There is also another function called BindIOCompletionCallback(). If we use this function we don't have to do the manual work. We simply let windows to create IO completion port and associate threads with it.
My question is that which solution is the more efficient, either manual creaton of IOCP or the later one.
|
|
|
|
|
what is the difference between Berkely sockets (Winsock2) and IO completion ports?
|
|
|
|