While closing the file and asking for save(if the file is not saved) in an MDI i want to identify whether its a new file made in my prog or not. If the user cliks on yes while being asked to save the file and if the file is 'new' then he gets a save as dialog box otherwise the file is just saved without asking the name. Pretty much the procedure of any word processor. One way to identify the new file is to chek for "(untitled)" on the title bar of the window. But this way any file saved with the same name would cause the save file dialog to appear. The only method i can think of right now is to make a temp databse in mem which has the name and the opened or new state of the file in it. (Though i really dont know how i am gonna do that :-) ) Isnt there any other simpler way to do this.
When you open a file in that window, set a byte to some state (non-zero), then have your save process check that bit! If you are going to keep the file handle open during editing, then this will be non-null if it an existing file. Mirno
I thought of that but the thing is that in an MDI one can open many windows. So lets say there are 2 windows in it. I open a file in the first one and the byte is set to 1. I make a new file in the second one and the byte is set to zero again. Now i go back to the first file and try to exit it without saving. Now when i clik on yes in the msg box its just gonna save the file without the showing the save dialog box cause that byte has been set to 0 by the first one.
You could set up an array for the Child Window handles and another array for for the File flags say 30 or 40 entries, the File flag can be a byte array, but make sure it's initlize to zero or blank. Then when you create a child window add that handle to your handle array, you'll have to have a counter for the number of child windows that's been created so you'll know where in the array to stick the handle. Then when you open a file loop through your handle array to find the match for the active child window handle and then take that offset and set your flag array to a 1. Then when you save your file go through the loop process again to see if you should use Save or Save As. If it was Save As then change your flag for that offset to a 1. When you close a child window you should shift the arrays to the left from the match point. I'm sure there are many other ways of doing what you want to do. Ewayne This message was edited by Ewayne, on 6/7/2001 1:58:45 PM