|
netswitcher does much more than I need... and it also defeats the purpose of doing it myself.
|
|
|
|
|
Using VC6 on Win2K:
Given the following code:
DWORD dwFlags = OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_ENABLESIZING;
CString sFile = _T("");
CFileDialog dlg(TRUE, "rc", NULL, dwFlags, "Resource Files (*.rc)|*.rc||");
if (IDOK == dlg.DoModal())
{
sFile = dlg.GetFolderPath();
}
The dialog displays, and allows me to select a file, but it asserts when I click OK.
The code is very simple and straightforward, but I get a debug assert in dlg.GetFolderPath() claiming the hwnd for the dialog is NULL. Can anyone tell me what I missed or did wrong?
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
After DoModal, calling CFileDialog::GetPathName returns the file path.
My blogs:
http://blog.joycode.com/jiangsheng
http://blog.csdn.net/jiangsheng
http://bloglines.com/public/jiangsheng
Command what is yours
Conquer what is not
---Kane
|
|
|
|
|
I don't think you understood the question.
Why does calling GetFolderPath() assert?
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
because it sends CDM_GETFOLDERPATH to the dialog window, which does not have a valid window to recieve it anymore.
My blogs:
http://blog.joycode.com/jiangsheng
http://blog.csdn.net/jiangsheng
http://bloglines.com/public/jiangsheng
Command what is yours
Conquer what is not
---Kane
|
|
|
|
|
If the dialog box is still in scope, why doesn't it still have a valid hwnd?
EDIT - Nevermind.
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
-- modified at 14:53 Saturday 31st December, 2005
|
|
|
|
|
John Simmons / outlaw programmer wrote: EDIT - Nevermind.
Were you able to resolve the problem, if yes, can you please post the solution, i am kinda interested in it
-Prakash
|
|
|
|
|
CFileDialog::GetFolderPath() is a wrapper for the CDM_GETFOLDERPATH message, and as such can only be used before the dialog is closed.
If you want just the directory part of the selected file, use CFileDialog::GetPathName() and PathRemoveFileSpec() .
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
Pinky, are you pondering what I'm pondering?
I think so Brain, but if we shaved our heads, we'd look like weasels!
|
|
|
|
|
so should CFileDialog::GetFolderPath() not been a protected/private member?
Thanks for the answer.
-Prakash
|
|
|
|
|
It should be a protected member. I called the function suggested by the first responder and everything is fine. :/
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
It's a wrapper for a message, making it protected would force you to make a new class derived from CFileDialog to call it, which wouldn't make sense.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
Come quietly or there will be... trouble.
|
|
|
|
|
Well, since you can't call the damn thing anyway unless you're calling it from a derived class, I don't see that my statement is all that incorrect.
I think this stuff was written before Microsoft started getting serious about code reviews. Oh, wait...
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
-- modified at 14:51 Sunday 1st January, 2006
|
|
|
|
|
When I link my project staticly with MFC I have problem with CAsyncSocket - it rises exception on Create function. Does anybody know is there any problem?
Another question (an opposite one) which dlls should be supported with a project when it is compiled with MFC as shared DLL?
Thanks.
DavidR
|
|
|
|
|
I am currently working with a CAsyncSocket derived class in VS 2005 in a static binary and I have not experienced any problems.
However, more information would be useful:
1.) What version of visual studio?
2.) What is the error code?
3.) Did you AfxSocketInit() before creating the CAsyncSocket object?
For your second question, a static build does not require any of the MFC DLL's to be distributed with the binary, as long as your not using any third party API's.
The shared build will require MFC42.DLL a MSVCRT.DLL if you are using Visual Studio 6.0. If you are using a newer MFC version then you will need to distribute the updated DLL's which could be MFC 7.0 , MFC 7.1 or MFC 8.0
|
|
|
|
|
First of all thanks for the attention.
1) VC 7.0 (2002)
2) Access Violation error
3) Yes I did, In fact when I performe a shared build there is no problem at all.
So if I understood right I need to deliver 3 dll files:
MFC42.dll
MSVCRT.dll
MFC7_0.dll
DavidR
|
|
|
|
|
Hi all, happy new year!!!
I am a C++ newbie. I am wondering is there any package or library availalbe like arraylist or vector in java??? If it does have, could somebody tell me how to import the library and how to use it please???
Thanks in advance!!!
Asura
|
|
|
|
|
There are template classes for strings, vectors, arrays, etc. you can search for them in the msdn.
-Prakash
|
|
|
|
|
The C++ Standard Template Library (STL) has vector , list and deque containers, which provide features like those Java classes. There are various on-line tutorials for STL you can find through Google[^], but if you are going to use C++ and STL seriously you should buy The Book[^].
|
|
|
|
|
the post is not c++ related.
includeh10
|
|
|
|
|
includeh10 wrote: the post is not c++ related.
void main(...)
{
printf("Happy new year!!!\n") // Error on this line.
}
It gives me an compiler error on the printf line, dont know what the error is. Any one with a clue?
-Prakash
|
|
|
|
|
1. add the include file
#include <stdio.h>
2. comple ...
compiler says:
error C2143: syntax error : missing ';' before '}'
did you see above info?
so add ";" before your //
includeh10
-- modified at 11:16 Saturday 31st December, 2005
|
|
|
|
|
humm, thanks, its working now and this is what i got as the output.
Happy new year!!!
-Prakash
|
|
|
|
|
I think forgot his original post and toke you seriously.
INTP
Every thing is relative...
|
|
|
|
|
John R. Shaw wrote: think forgot his original post and toke you seriously.
anyways Happy New year Sir
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
hi, i am new to usage of CListCtrl control. I want 2 display a image column as 1st column of the CListCtrl . I want 2 prevent only this column from being resized.
Cud someone suggest me a way to do the same.
Also is it possible to conditionally hide/show the images on this column?
If possible, cud some1 send a sample code as an illustration.
|
|
|
|