|
Hmmm ... seems like I wasted too much time writing my answer ... now you have the same solution for your problem 3 times. ;P
|
|
|
|
|
How do I prevent the current working directory from being changed after calling CFileDialog. Or when loading a file when the program starts up (called from the command line parameters)? This is really throwintg my program off course and thinking files are where they really aren't (i'm using the full path name when calling these files oddly enough.
-Steven
CP Addict
By reading this message you are held fully responsible for any of the mispelln's or grammer, issues, found on, codeproject.com.
For those who were wondering, actual (Linux) Penguins were harmed in creating this message.
|
|
|
|
|
(i'm using the full path name when calling these files oddly enough.
This is most weird. How can the current working directory affect your app if using full paths?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Well say document c:\Documents And Settings\Crash\My Documents\22.404 is opened from windows.. The current working directory is set to c:\Documents And Settings\Crash\My Documents (which is a program). When I try to get the currrent directory without opening a file in the begining it doesn't return one which is prefectly fine with me, because it doesn't mess up anything.
-Steven
CP Addict
By reading this message you are held fully responsible for any of the mispelln's or grammer, issues, found on, codeproject.com.
For those who were wondering, actual (Linux) Penguins were harmed in creating this message.
|
|
|
|
|
What about a save and restore by calling GetCurrentDirectory() before the file dialog and SetCurrentDirectory() afterwards?
Jeremy Falcon
Imputek
<nobr>Excrement escapes everyone - even elders.
|
|
|
|
|
How would I prevent it from choosing the wrong directory when it starts up? I fixed the CFileDialog one (with a flag).
-Steven
CP Addict
By reading this message you are held fully responsible for any of the mispelln's or grammer, issues, found on, codeproject.com.
For those who were wondering, actual (Linux) Penguins were harmed in creating this message.
|
|
|
|
|
I know that CListCtrl is newer and has more functionality, but I'm wondering what are the major differences between these 2 classes. In other words, why would people still use CListBox and why didn't MS just change it to incorporate new functionality? Sorry if this is a obvious question, newbie here. Thanks!
|
|
|
|
|
why would people still use CListBox
It's simpler, if you don't want nifty features.
why didn't MS just change it to incorporate new functionality
Well this is just guessing, but the list control is a common control (which the list box is not), all of which are shipped in comctl32.dll . This DLL is frequently updated (by IE, for instance) to easily add more controls/features, and maybe changing the core list box control finds more restrictions from the point of view of software control in MS or anything. Maybe the've been developed by different teams.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
The list box is a builtin Windows control. It's purpose is to let the user select one or more items (usually strings) from a list that scrolls as necessary. The list box is relatively simple easy to use.
The list control is one of the common controls. It provides a much broader range of interaction with the user (multiple views, bitmap support, multiple columns, sorting, etc.). This broader range comes at a price, however. The list control takes more effort (on the part of the application) to set up and use.
Your choice of one over the other depends on what you need the application to do. The list box is good for simple selection tasks in a dialog. The list control handles tabular data, bitmaps, and drag-and-drop better. From the point of view of the programmer, the list box is much simpler to set up and use, as long as you're not trying anything fancy. The list control makes fancy interactions much easier.
Software Zen: delete this;
|
|
|
|
|
Hy people!
I have a problem
I'm doing an program in VC++ 6 under Win2K sp3, and I'm using a RichEditCtrl and works fine under 2k, but when I run the program under Win9x, the RichEditCtrl loses my CHARFORMAT formatation.
Does anybody know why?
Is this something about the version of RichEdit DLL?
What must I do?
thanks all of you for the atention,
cheers!;)
Ricky
|
|
|
|
|
I have a CDialog derived class and I'm storing pointers to the modeless objects I spawn in an STL vector. I use it like this in the View class :
int vecSize = ImageDisplayVector.size();
for (int i = 0; i < vecSize; i++)
{
CImageDisplay * pImageTemp = ImageDisplayVector[i];
pImageTemp->ShowWindow(SW_HIDE);
}
where
std::vector <CImageDisplay*> ImageDisplayVector; is global
and
class CImageDisplay : public CDialog
In the OnDestroy of the mainframe class i do the exact same thing:
int vecSize = ImageDisplayVector.size();
for (int i = 0; i < vecSize; i++)
{
CImageDisplay * pImageTemp = ImageDisplayVector[i];
WINDOWPLACEMENT wp;
pImageTemp->GetWindowPlacement(&wp);
}
It asserts in GetWindowpLacement at IsWindow()..........
So if this function (in mainframe class) thinks my pointer isnt a window (and its not null I checked) then how come SHowWindow (VIew class)happily works with the pointer?
Appreciate your help,
ns
|
|
|
|
|
Could you try the following please. In the place where you call GetWindowPlacement
int vecSize = ImageDisplayVector.size();
for (int i = 0; i < vecSize; i++)
{
CImageDisplay * pImageTemp = ImageDisplayVector[i];
pImageTemp->ShowWindow(SW_SHOW);///!!!! this is the change
WINDOWPLACEMENT wp;
pImageTemp->GetWindowPlacement(&wp);
}
I suspect at the time you call GetWindowPlacement your dialog windows are already destroyed. It could mean (depends on implementation) also that the pointer you store in the vector is invalid as well. Some MFC classes use "delete this" construct; I am not sure what you derived from.
|
|
|
|
|
Thanks a million. I have to wait a bit then I cant wait t check it out....
Appreciate your help,
ns
|
|
|
|
|
Tried it ...................wasnt the fix...;;( but thanks so much for trying.....
Appreciate your help,
ns
|
|
|
|
|
Where else could I store the placements of my dialogs? I thought OnDestroy was the place....any suggestions?
Appreciate your help,
ns
|
|
|
|
|
Please check out Joaquín's suggestion. OnDestroy of what? What is parent of the dialogs? How do create them?
P.S. When you tried the change did ShowWindow worked right?
|
|
|
|
|
I'm using the OnClose() instead.......thanks,
ShowWindow in OnDestroy didnt work .....but the WM_CLOSE is where I needed to be it seems. Have a good weekend!
Appreciate your help,
ns
|
|
|
|
|
What window is the parent of those modeless dialogs? If they have no parent, it could be they've been destroyed by the time CYourFrameWnd::OnDestroy is called.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquin, I spawned the CDialogs fromn CView. WHat I've now done is not trapped WM_DESTROY in the mainframe, but WM_CLOSE, and its doing its registry saving quite happily in there......
Thanks to both of you!
I'll have to get more info on what exactly happens when these msgs are received. All I know is WM_CLOSE first then WM_DESTROY......
Appreciate your help,
ns
|
|
|
|
|
Hello,
I'm handling the LVN_ITEMCHANGED message for my ListCtrl (listview) derived class. And when I click the listCtrl I receive more than one message.
I would like to know the differences between those messages and their meaning in order to handle the notification as I need to.
I would like to receive any link to where I could find info about it or direct help about how to filter the message.
Thank you in advance.
|
|
|
|
|
I need to do two things in my VC++ 6 (MFC) application:
- Close it automatically when some processes have finished.
- Start automatically the process.
This last point I can do, however, when the dialog doesn't appear until the process has finished. I have a dialog with a progress bar and I want it to appear and then immediately start the process (the process is a file exploration that works fine!).
Thanks a lot.
-- n
|
|
|
|
|
AfxGetMainWnd()->PostMessage(WM_CLOSE);
is one way
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
Thanks so much. The application is closed programatically without any problem.
Now, reagrding the other problem I had:
I start some processes automatically whne the applicaction is started, but the dialog doesn't appear until the end of the process. I have a progress bar and an edit box controls that monitor the progress of the processes, so I need to see them, what can I do?
thanks.
-- n
|
|
|
|
|
What kind of processes do you start? If it's only some functions you should call them in their own thread, otherwise your gui won't be updated.
|
|
|
|
|
Thanks so much.
Solved.
-- na
|
|
|
|