|
No, I don't. I just wanna LEARN.
Thank you masters!
|
|
|
|
|
|
Hi All,
I am writing one function that should return me a difference between given dates in months. I know it can easily be done by getting difference in years, months and days. Then calculate months like
trmMonths = 0;
trmMonths += years * 12;
trmMonths += months;
But i am not sure about what to do with days, because sometimes it may happen that difference between dates would be years = 1 months = 11 days = 28. in this case the difference between dates should be 24months.
Can anyone give me idea on how days can be handled here to get accurate difference?
Thanks,
AksharRoop
|
|
|
|
|
AksharRoop wrote: But i am not sure about what to do with days, because sometimes it may happen that difference between dates would be years = 1 months = 11 days = 28. in this case the difference between dates should be 24months.
Err I'm totally confused by your sentence here. Could you explain a bit better what is the problem exactly ?
Are you using COleDateTime and/or COleDateTimeSpan classes ? This could help you manipulating times.
|
|
|
|
|
I have a strange issue. There are 3 radio buttons that are grouped horizontally are showing wrong behavior.
By default two radio buttons are checked and one is unchecked.
When you click on any Radio button it becomes unchecked and the remaining two becomed checked.
The code is working totally fine when there is no RTL support.
However after applying the RTL support the above problem starts to occur.
I have a custom library that draws the radio buttons.
|
|
|
|
|
Using createprocess I am invoking a dialog based application and from the processid I am getting the HWND of the dailog and then setting the window position, till now it's fine.
The problem comes when we try to invoke a dialog based application(using create process) which has an error in initializing(displays warning or error message)after pressing ok on error message the dialog is invoked for which we are unable to setwindow position because of error message. How can we by-pass the error message and set the position of dialog???
Note: We do not have code for invoked process.
|
|
|
|
|
Hi everyone,
Could anyone please help me to play a wav file. Acually I have some wav data in my hand(which I converted from .vox formate). Now in order to make it play, I guess i need to add some header and all which I don't have much idea. Could anyone please tell me how to add these header using c++,..may be a standard header.
Regards,
Himangshu S
|
|
|
|
|
Member 4250705 wrote: Could anyone please help me to play a wav file
PlaySound[^] ?
|
|
|
|
|
In order to play a wav raw data, you should know more details about its sampling, bit rate, number of channels, etc.
This[^] might help you.
- ns ami -
|
|
|
|
|
Hi,
I have started using VC 2008 and MFC feature pack. Could anyone tell me as whether there is any way to make the visual style and colors of the application even applicable to the dialog boxes and the controls placed on the dialog boxes ?
Thanks in advance.
Taruni
|
|
|
|
|
I have removed caption bar of the dialog box, i want a context menu on right click event anywhere on the dialog?
and also i want to change background color of the dialog box?
|
|
|
|
|
To show context menu on right click, map WM_RBUTTONUP and write...
void CMyDlg::OnRButtonUp( UINT nFlags, CPoint point )
{
CMenu menu;
menu.LoadMenu( IDR_MENU1 );
ClientToScreen(&point);
menu.GetSubMenu( 0 )->TrackPopupMenu( 0, point.x, point.y, this );
CDialog::OnRButtonUp( nFlags, point );
}
To change the background map WM_ERASEBKGND and write...
BOOL CMyDlg::OnEraseBkgnd( CDC* pDC )
{
CRect rect;
GetClientRect( &rect );
pDC->FillSolidRect( &rect, RGB( 255, 192, 0 ));
return TRUE;
}
- ns ami -
|
|
|
|
|
thanx for reply...but problem is that whenevr i am adding menus from resource view ID can not be edited so what shoud i write in menu.LoadMenu( IDR_MENU1 )?
|
|
|
|
|
crazy_sam wrote: ID can not be edited
Why? You can set the ID in properties.
crazy_sam wrote: what shoud i write in menu.LoadMenu( IDR_MENU1 )?
Here IDR_MENU1 is only a sample. You can give your own menu's ID.
- ns ami -
|
|
|
|
|
Ok...I got it.
|
|
|
|
|
hi.i have question.this is the subject of my project:
He has a table with three face-up cards in a row: two jokers and one ace, with the ace in the middle. After you make a small wager, he turns the cards face-down and begins to manipulate the cards, swapping cards two at a time. After he completes the swaps, you are then to guess which card is the ace.
The series of card swaps will be given to you in order as a String swaps, containing only the characters 'L', 'R', 'E', and 'F'. swaps[0] indicates the first swap. The 4 characters indicate the following moves:
L: swap the left and middle cards
R: swap the right and middle cards
E: swap the cards on the ends (the left and right cards)
F: fake swap (no cards actually change position)
Write a method that returns the final position of the ace, after all the swaps have been performed. Your method should return "L" if the left card is the ace, "R" if the right card is the ace, and "M" if the ace is in the middle.
and this is the source of project:
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
class cart{
public:
cart(char a[2]="paq"){
cout << a[0]<<a[1]<<a[2];};
char left()
{
char a[2];
swap(a[0],a[1]);
for (int b=1;b>=2;b++)
cout << a[b];
return 'L';
};
char right()
{
char a[2];
swap(a[2],a[1]);
for (int b=1;b>=2;b++)
cout << a[b];
return 'R';
};
char en()
{
char a[2];
swap (a[0],a[2]);
for (int b=1;b>=2;b++)
cout << a[b];
return 'E';
};
char fo()
{
char a[2];
for (int b=1;b>=2;b++)
cout << a[b];
return 'F';
};
};
int main ()
{cout << "swap the cart juker1,ace,juker2" <<endl;
char b[50];char a[2];a[0]='p';a[1]='a';a[2]='q';
for (int i=1;i>=50;i++){
cin >>b[i];
if (b[i]='.') break;
};
cart x;
for (int i=1;i>=50;i++){
if ((b[i]='l')|(b[i]='L')) x.left();
else if ((b[i]='r')|(b[i]='R')) x.right();
else if ((b[i]='e')|(b[i]='E')) x.en();
else if ((b[i]='f')|(b[i]='F')) x.fo();
};}</cctype></string></iostream>
but my question :
i cannot understand what is the reason of error.
really i don't know what can i do.
thanks for attention.
|
|
|
|
|
possibly wrong forum too, but I'll cut some slack on that one - since I mention it on my reply
'g'
|
|
|
|
|
arad.moradi wrote: i cannot understand what is the reason of error.
What error?
arad.moradi wrote: really i don't know what can i do.
Start by telling us what you expect compared with what you are actually getting.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
i don't know what is the reason of of error.
i write it with c++ & i send what is it about.
it is the code:
<big>#include <iostream>
#include <string>
#include <cctype>
using namespace std;
class cart{
public:
cart(char a[2]="paq"){
cout << a[0]<<a[1]<<a[2];};
char left()
{
char a[2];
swap(a[0],a[1]);
for (int b=1;b>=2;b++)
cout << a[b];
return 'L';
};
char right()
{
char a[2];
swap(a[2],a[1]);
for (int b=1;b>=2;b++)
cout << a[b];
return 'R';
};
char en()
{
char a[2];
swap (a[0],a[2]);
for (int b=1;b>=2;b++)
cout << a[b];
return 'E';
};
char fo()
{
char a[2];
for (int b=1;b>=2;b++)
cout << a[b];
return 'F';
};
};
int main ()
{cout << "swap the cart juker1,ace,juker2" <<endl;
char b[50];char a[2];a[0]='p';a[1]='a';a[2]='q';
for (int i=1;i>=50;i++){
cin >>b[i];
if (b[i]='.') break;
};
cart x;
for (int i=1;i>=50;i++){
if ((b[i]='l')|(b[i]='L')) x.left();
else if ((b[i]='r')|(b[i]='R')) x.right();
else if ((b[i]='e')|(b[i]='E')) x.en();
else if ((b[i]='f')|(b[i]='F')) x.fo();
};}</big>
and it is what i want to do:
He has a table with three face-up cards in a row: two jokers and one ace, with the ace in the middle. After you make a small wager, he turns the cards face-down and begins to manipulate the cards, swapping cards two at a time. After he completes the swaps, you are then to guess which card is the ace.
The series of card swaps will be given to you in order as a String swaps, containing only the characters 'L', 'R', 'E', and 'F'. swaps[0] indicates the first swap. The 4 characters indicate the following moves:
L: swap the left and middle cards
R: swap the right and middle cards
E: swap the cards on the ends (the left and right cards)
F: fake swap (no cards actually change position)
Write a method that returns the final position of the ace, after all the swaps have been performed. Your method should return "L" if the left card is the ace, "R" if the right card is the ace, and "M" if the ace is in the middle.
thanks for attention
|
|
|
|
|
You've got the wron forum --- this is for MFC (Microsoft Foundation Classes) that use a version of Visual Studio or Visual C++.
AF Pilot
|
|
|
|
|
1) this sounds like homework - we dont do homework - at best we will give you hints, but if you're expecting us to jump in and solve all your issues, go to RentACoder or such
2) DONT GET IMPATIENT AND POST MORE THAN ONCE - most of us here have jobs we get paid to do, I doubt any of us get paid to help others on CP - except CP staff themselves, and most of them are involved with the actual running of the site, not answering questions
3) post in the correct forum - showing that you can do so indicates some level of intelligence - else, the responses you get will be rather 'trite' if not, brutal
Some suggestions :-
1) show what output you get - or where there's a compile error or such - I dont think you've actually stated what the problem/issue is
2) assuming your code compiles : learn how to use the debugger - use F10/F11 to single step through your program, inspect the contents of variables etc as you go - or at worst, print out their contents, then walk through what you're trying to do 'on paper' and see if that tells you whats going wrong.
3) comment your code - if you cant understand it, and cant tell us what each piece is doing, we wont spend much time on it either
4) looking at your code, I think you need to go back through your textbooks, a bit more .. for example char a[2]="paq" .. ok, so, if 'a' is a character array of size '2', how many characters are you trying to stuff in there - perhaps 3 ?? Im not sure what compiler you are using, but I can tell you in MSVC(6) you'll get "error C2117: 'paq' : array bounds overflow"
'g'
|
|
|
|
|
Hello ,
Even though my application does not have the manifest file,Vista shows shield icon over my exe.
Initially I thought it was because of the Installer detection Techniques,
such as:
1) Analyzing the Exe name, the OS identifies the required level of Execution.
2) Analyzing the binary content of the application, where the OS identifies the required level of execution.
I copied the Exe to the desktop, but it did not put the shield icon over my exe.
So I came to a conclusion that the above two scenarios are not the reason for this failure.
Environment:
Installed OS - Vista Business.
Account - Administrator with UAC turned on.
The Exe was displayed under Program Files directory. To run the application Admin Rights is not required.
Is there a different scenario that we need to try inorder to remove the shield icon which is displayed over the exe file
Note: Previously My application had manifest file, but now we have changed the Exe inorder to make it run in the standard user privilege. (Therefore we removed the manifest file)
The funniest part was, even though it displays the shield icon, UAC prompt did not pop up, when i am trying to launch the Exe and therefore the Application launched without any problem.
Is this a Vista bug? what can i do remove this shield icon.
Would really appreciate your help.
Thanks,
WindowsPistha.
|
|
|
|
|
WindowsPistha wrote: I copied the Exe to the desktop, but it did not put the shield icon over my exe
Do you have a standalone manifest file for it in the directory where it exists when it displays the shield? Even if the manifest does not exist in the executable as a resource, it should still look for one in the directory of the executable and use it if it fits.
I've noticed those standalone manifests suffer from caching when you try to delete or remove one, the effect can linger even though the manifest no longer exists there. Various techniques to shake it loose like rebooting ultimately prevail but not after some cursing and head scratching.
Anyway, just an idea.
|
|
|
|
|
Thanks Bob !
rebooting also did not help
|
|
|
|
|
Dear All,
I want to create GUI in MFC like the one we see in Apple iTunes or in a Sony ericsson PC suite. In the mentioned GUI's the dialog is loaded when the user clicks on a button at the right panel. When I develop an application like this, my program throw assertion error due to loading and unloading dialogs. This is due to the memory while calling DoModal() recursively while clicking the buttons.
Please guide me to develop an application where we can load 'n' number of dialogs at 'n' number of times.
Many thanks in advance.
|
|
|
|
|