|
I have
double Total = 0;
Total += GetSubTotal(m_edit1);
Total += GetSubTotal(m_edit2);
...
sprintf(buf, "%.2f", Total); CString str = buf;
Lets say the total is a million. Then str
is 1.00e+006 which is bad. How can I get it
to display normal numbers and not this exponential?
Please, any response any one can give me will
be greatly appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
try "%10.2f". with no width spec, its acting like g instaed of f.
Some ideas are so stupid that only an intellectual could have thought of them - George Orwell
|
|
|
|
|
You could format CString before as:
double Total;
str.Format(_T("%12.2f"), Total);
|
|
|
|
|
This might be an easy question for someone out there. I put together some code so that a user can go out and select a custom program (like WinAmp, WMP, solitaire, freecell, anything that is an .exe file) and it puts the icon for that program on a toolbar and when pressed, it calls the .exe file. What I would like to do is put the program name, up to 8 chars anyway, under the icon. I was wondering if anyone knew how to get the program name from the properties of the .exe file. Right now, I use the filename but in cases like solitaire, it just puts SOL. Does anyone know how to retrieve the properties so I can determine what the application name is?
If possible, I need help in 2 areas. This will go into 2 apps, one is written in C and the other in C++/MFC. Can you help???
|
|
|
|
|
I would like to embed a video clip into a MFC dialog -- basically, I would like to embed or wrap the "functionality" of Windows Media Player into my dialog. Can you help with this?
I have looked through the numerous pages/articles here at CP and have even used the example in CAnimateCtrl before, but I haven't found what I want.
My video clip may come in the form of:
1) AVI uncompressed
2) AVI compressed
3) MPEG file (mpeg4 ? for video???)
What I want is the effect of a "picture-in-picture". I want a few controls that work with the video clip (start/stop, pause). I would also like for the controls of the clip to work with the dialog itself. If I press "pause" on the Video's control, I want my dialog to recognize that "pause" command was issued -- this is for synchronizing activity from either the video clip to dialog or vice-versa.
Thank you for helping and pointing me in the right direction.
Johnny
|
|
|
|
|
DirectShow is what you want. It's part of DirectX. You can basically embedd an instance of Media Player in your app.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
What's the message when a CSliderControl ?
For Buttons, there's BN_SETFOCUS, for edit box, EN_SETFOCUS, so what's the one for the slider control ?
I need to handle when a slider control gets the focus.
Do I need to have a WM_NOTIFY for it if it doesn't exist ?
Thanks.
Max.
|
|
|
|
|
|
|
I'm trying to implement a dynamic menu system to my program. Currently, i can add and remove the items from the menu, and make the menu items run code that i've premade.
for example i can add "section 1" to a section menu, while associating ID_SECTION_1 to the command in the menu. This will call my OnSection1() code when this command is executed.
I want this to be boundless (i.e. i dont want to have to make code for OnSection2, OnSection3, OnSection4... , or the strings in the string table, and so on.) I can currently bind each new menu item to the same id, for example section 1, section 2, and section 3 all run the OnSection() command which is bound to ID_SECTION. What i cannot do, is figure out how to determine which of the 3 i called. I would like to basically get the location of the last menu choice i picked, so if section 2 is in the second spot on the menu, i want to know this when i call OnSection().
Any ideas?
Jeff Rothenberg
Project Engineer
Vector CANtech, Inc.
|
|
|
|
|
why dont u store the currently displayed option on the menu as a numeric index somewhere and use a switch staement in the code to determine what to do?
"traffic lights are for people who can't make their own decisions" biz stuff about me
|
|
|
|
|
How can i get the currently displayed option?
Jeff Rothenberg
Project Engineer
Vector CANtech, Inc.
|
|
|
|
|
well ur setting the menu text right?
so save a value somewhere else when u change the menu text that lets u know which option is showing
?
"traffic lights are for people who can't make their own decisions" biz stuff about me
|
|
|
|
|
Many options will be showing, and i basically need to record the actual text that shows up in the menu. I cannot save the index value when i set the menu text, because i do not know which item will be chosen. I want the menu text simply to help me figure out which one i actually chose.
For example
File Edit Sections
->Section 1
I do something and create 3 more sections at runtime modifying the menu.
Now the menu looks like this
Sections
->Section 1
->Section 2
->Section 3
->Section 4
Each Menu choice is bound to ID_SECTION.
ID_SECTION corresponds to OnSection()
In my code:
void OnSection()
{
int section;
// I need to fill the section variable with
// the index of the item i picked from the menu
// since all of them have the same ID.
If(section==1)
handle section 1
If(section==2)
handle section 2
If(section==3)
handle section 3
If(section==4)
handle section 4
}
Hopefully this helps.
Thanks.
Jeff Rothenberg
Project Engineer
Vector CANtech, Inc.
|
|
|
|
|
You should be able to use GetCurrentMessage() and interrogate the wParam/lParam values to get the actual command ID of the menu option selecetd.
Roger Allen
Sonork 100.10016
This is a multiple choice question, choose wisely
Why did the hedgehog cross the road?
A: To show he had guts?
B: To see his flat mate?
|
|
|
|
|
Hello,
I need to be able to get the Serial Nº of my hard disk in order to be able to make my programs to run only in the hard disk that I want them to.
I'm using this code:
DWORD dwNumSerie = 0;
UpdateData();
GetVolumeInformation((LPCTSTR)this->m_vedPath,NULL,0,&dwNumSerie,NULL,NULL,NULL,0);
this->m_vedNumSerie.Format("%d",dwNumSerie);
UpdateData(FALSE); How do I can be sure that the code works?
As a parameter I've written down a "\" (backslash only) in an editcontrol (m_vedPath variable is a CString linked to that EditCtrl).
Is that parameter right in order to get info. of the local HDD?
Thank you in advance.
NOTE:
I've received a - number in my laptop and a positive one in other PC.
|
|
|
|
|
Hi Joan,
The disk s/n is a DWORD. For the path I use GetWindowsDirectory() and if that is a UNC I use "C:\". I also test whether GetVolumeInformation() succeeds, which you should always do when calling functions that return status information.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
i am programming in Visual C++.Net and i am working on a SDI project. i creat a Modeless Dialog box beside my document Window. and i have some button on this dialog box. i want to trap these Buttons events. So am using Event Handler and i creat a Function for one of the buttons in one of my Class to handle the Events of buttons (for example a function for BN_CLICKED on CMainFrame) but when i click on one of those Button nothing happend then(i set some Line BreakPoints on those Functions that created by Event handler, but they never Executed). i don't know why !
what is the reason ?
|
|
|
|
|
Add the event handlers in the appropriate class. In this case, it is the dialog box.
Kuphryn
|
|
|
|
|
my project name is Test.
i have to Trap Messages of that Button in CTestView.
do u mean that i can't do that ?
|
|
|
|
|
If you button is in a dialog, trap the button in your dialog class. If you want to trap the message in your main window, I am sure you can modify the command routing to deliver the message to your main window. How to do that? I don't know. I haven't use MFC in 4+ years.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Thanks for your answers. but how can i make a Connection between my Dialog button and my main Windows (CTestView). ? what can i do if i want to Trap BN_CLICKED of a butoon on a Dialog in my CTestView ?
|
|
|
|
|
when the button gets clicked in the dialog send a message to the main app and process it there ... use some custom message id's and u'll be fine
"traffic lights are for people who can't make their own decisions" biz stuff about me
|
|
|
|
|
void CMyDialog::OnBnClickedButton1() {
CTestView *e=new CTestView();
e->SendMessage(WM_MBUTTONUP, 0, 0);
}
it's not work what can i do ?
|
|
|
|
|
no no no
define some custom message id's (see msn) and send a custom message to ur app class and add a handler there for the message
"traffic lights are for people who can't make their own decisions" biz stuff about me
|
|
|
|