|
Hi,
I never used different desktops, but why not try ...
I've paste youre code into a test project and used the CAabout to show in the other desktop.
could used a warning that everithing would hang.
In my case the function SetThreadDesktop(hNewDesktop); fails giving me an
error code 170: meaning, requested rescource is busy.
When continueing the function SwitchDesktop(hNewDesktop); works switching the desktop.
But the main thread is still located running at the original desktop.
Sorry , don't know anything else to test. Will test some more
codito ergo sum
|
|
|
|
|
Hi, i would like to ask, if there is a way to add this controls for dynamically added CEDit.
i make do for example this :
my_CEdit = new CEdit();
DWORD dwStyle = WS_CHILD | WS_VISIBLE|WS_TABSTOP | ES_AUTOHSCROLL;
CRect rect(380,201,445,224);
my_CEdit->CreateEx(WS_EX_CLIENTEDGE,_T("EDIT"),"Test",dwStyle,rect,this,0,0);
But i don't know what how to apply DDV and DDX to this CEdit in DoDataExchange(CDataExchange* pDX) method.
|
|
|
|
|
I do not think this is possible, but I am not 100% positive about that. What do you want to achieve exactely ? Trap messages for a dynamically created CEdit ?
~RaGE();
|
|
|
|
|
You have to emulate what the DDX and DDV do in yur own code within the DoDataExchange function.
First, examine the pDX->m_bSaveAndValidate
To handle the 'ddx' part of your control, you could do something like this in code:
To properly handl the DDV, you should give your edit control an identifier.
my_CEdit->CreateEx(WS_EX_CLIENTEDGE,_T("EDIT"),"Test",dwStyle,rect,this,MY_EDIT_IDENTIFIER,0);
// transfer data to or from control and member variable
if( m_bSaveAndValidate ){
CString csTemp;
// prepare data exchange in case of abort
pDX->PrepareEditCtrl(MY_EDIT_IDENTIFIER);
my_CEdit->GetWindowText(csTemp);
// do some validation on the contents of the string
if( contents of string are 'bad' ){
// abort if it is bad data
pDX->Fail();
} else {
// data was good, so transfer to member variable
m_MyStringVariable = csTemp;
}
} else {
// transfer from member variable to control
my_CEdit->SetWindowText(m_MyStringVariable);
}
Okay so I winged this one, if there are syntax errors, fix them yourself
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|
|
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
|
|
|
|