|
Hi guys
I'm trying to do a tricky thing with CFileDialog but I don't know how to do it.
I want that once the dialog is opened, when I change the type of the file, the directory where the CFileDialog class looks for the files change for one that I decided before.
Ex:
If I choose "*.mdb" files look for files on "c:\mdb" directory
if I choose "*.txt" files go on "c:\txt" directory
Is this possible?
What I have to change?
Thanks
Doc
|
|
|
|
|
I think the best way to do it is to make your own file dialog that inherits from CFileDialog. Then you override the OnLBSelChangedNotify[^] function and in this function, you change the folder (for this part, I don't know exactly how to do it).
|
|
|
|
|
You could provide a hook procedure (see OFN_ENABLEHOOK ) and look for the WM_NOTIFY message.
On the other hand, this may not work to the extent that you desire. You can easily get the name of the selected file in the hook procedure. You could even go so far as to "click" the "Up One Level" button. You might even be able to plug a folder name into the edit control and "click" the "Open" button. Wouldn't hurt to try...
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
I am having a confusing problem, please see
double d = 34.637632;
float f;
when, i execute f = d;
it returns f = 34.6376 that's fine because float has less capacity than double so it stores as much as it can, and discards remaining ones.
Now see the real problem,
if.
float f = 34.6376;
double d;
when, i execute d = f; it returns d holding value of f but along with trainling numbers, which are different always.
d should be equal to 34.6376, but is not so, its 34.637669945068 or some thing like it.
if u closely look above number then u will find that in the begining it is 34.6376 which is f but the remaing ones are I dont know come from where or why?
what is the reason? How can i avoid this problem, i.e. double should hold the value of float, with no extra garbage?
Thanks
|
|
|
|
|
From MSDN:
Floating Conversions
An object of a floating type can be safely converted to a more precise floating
type — that is, the conversion causes no loss of significance.
For example, conversions from float to double or from double to long double are
safe, and the value is unchanged.
An object of a floating type can also be converted to a less precise type, if it
is in a range representable by that type. (See Floating Limits in Chapter 2 for
he ranges of floating types.)
If the original value cannot be represented precisely, it can be converted to
either the next higher or the next lower representable value.
If no such value exists, the result is undefined.
Consider the following example:
cout << (float)1E300 << endl;
The maximum value representable by type float is 3.402823466E38 — a much
smaller number than 1E300.
Therefore, the number is converted to infinity, and the result is 1.#INF.
What I think is that f=34.6376 is already "saved" as f=34.63759999, but you do
not see it explicitely. Try and debug-step through this:
float f=34.6376;
double d;
d=(double)f;
if (f==34.6376)
{
f=0;
}
if (d==34.6376)
{
d=0;
}
and you will see that it does not run into the if brackets.
~RaGE();
-- modified at 6:37 Thursday 26th January, 2006
|
|
|
|
|
Floating-point numbers are not stored in memory exactly as you might think. There is always a precision concern when storing a floating-point number in a binary computer. The float type only has 6-7 digits of precision, while the double type has 15-16 digits of precision. See the following MSDN articles for more: Q36068 and Q125056.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
|
Does anyone of you know what AFX stands for?
|
|
|
|
|
|
Great! Thank you!
I'm what you'd call newbie in the subject -- for the time being
-- modified at 6:39 Thursday 26th January, 2006
|
|
|
|
|
I love this..
Since Microsoft was only a budding monopoly then, Borland had OWL which was better than AFX at the time.
And if we had OWL for 32-bits, it would STILL be better than MFC/AFX
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|
|
|
hai everyone..is it possible to do voice with visual C++?. Let say, when user started to using a my application, i want the application pop-up together with voice, for example "welcome to my software( in voice )"
|
|
|
|
|
You can use the PlaySound[^] function from the multimedia SDK. Of course, you have first to record your welcome message yourself (or use an existing one).
|
|
|
|
|
Thanks for your fast feedback. I alredy record my welcome message, but my problems now is how i want to add the record to my C++ application. Got any application sample or article?..i will appreciate your help.
|
|
|
|
|
Did you bother reading the link I gave you in my previous post ??
|
|
|
|
|
Maybe off-topic, since I do not know what kind of application you are working on, but if you do something like that, do not forget to provide an option to deactivate it. Seems like a cool feature the first three times you use the software, but can become really annoying.
~RaGE();
|
|
|
|
|
nevermind, thats a good idea.thanks for remind me. Do you got any sample or article that i can refer how can i add the record into my application?..thanks
-- modified at 20:43 Thursday 26th January, 2006
|
|
|
|
|
Insert the Microsoft Agent Activex control (agentctl.dll) into your project and then you can use code like:
CAgentCtlCharacters m_AgentCharacters;
CAgentCtlCharacterEx m_AgentCharacter;
...
m_AgentCharacters = m_agent.GetCharacters();
m_AgentCharacters.Load("Robby", _variant_t("robby.acs"));
m_AgentCharacter = m_AgentCharacters.Character("Robby");
m_AgentCharacter.Show(_variant_t());
m_AgentCharacter.Speak(_variant_t("My name is Robby. What is your name?"), _variant_t());
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
Hi,
How do we change the color of the button?
Thanks,
Wax
|
|
|
|
|
You will need to implement an ownerdrawn button, if you need to change the appearance such as the face colour. Try one of the many button controls[^] thats here at CodeProject.
I Dream of Absolute Zero
|
|
|
|
|
Handle the WM_CTLCOLORBTN notification message in the parent window of the button.
Steve
|
|
|
|
|
Stephen Hewitt wrote: Handle the WM_CTLCOLORBTN notification message in the parent window of the button.
This won't work.
Jesus Loves <marquee direction="up" height="40" scrolldelay="1" step="1" scrollamount="1" style="background:#aabbcc;border-bottom:thin solid 1px #6699cc">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
I tried it just then and you are correct, it doesn't work. A more careful read of the documentation (as you often find yourself doing when stuff won't work) reveals the following:
"only owner-drawn buttons respond to the parent window processing this message".
Steve
|
|
|
|
|
Stephen Hewitt wrote: I tried it just then and you are correct, it doesn't work
Even I kept trying for sometime.
What puzzles me is that what purpose does it accomplish?
Jesus Loves <marquee direction="up" height="40" scrolldelay="1" step="1" scrollamount="1" style="background:#aabbcc;border-bottom:thin solid 1px #6699cc">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|