|
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.
|
|
|
|
|
It is strange that a dialog uses this much memory...
What operation is done to use this much memory? Are you freeing them proper?
- ns ami -
|
|
|
|
|
I have four buttons in my dialog, totally four dialogs for four buttons, when I click a button1 it will load the appropriate dialog1 (dlg1->DoModal()). If I click button2 then it will load the dialog2 (dlg2->Modal). Code snippet is :
<br />
Dialog1 dlg1 = new Dialog1();<br />
OnCancel();
dlg1->DoModal();<br />
<br />
Dialog2 dlg2 = new Dialog2();<br />
OnCancel();
dlg2->DoModal();<br />
<br />
<br />
Dialog3 dlg3 = new Dialog3();<br />
OnCancel();
dlg3->DoModal();<br />
<br />
<br />
Dialog4 dlg4 = new Dialog4();<br />
OnCancel();
dlg4->DoModal();<br />
<br />
|
|
|
|
|
bhanu_8509 wrote: new Dialog1();
If you are creating dialog using new, then in each button click, a new instance of dialog will be created. It might be the reason of memory leak. I think you need to create them once, and reuse it again and again.
- ns ami -
|
|
|
|
|
please tell me how to do this. i cannot create a global object to each and every dialog. frankly I dont know how to create global objects which can be accessed in other dialogs.
thanks.
|
|
|
|
|
For such an application a main dialog/window should be there to track these button selections... So that these kind of recursive DoModal can be avoided.
A sample... not perfect but only to get the idea.
void CMainDlg::ShowDlgs()
{
for( ;; )
{
int nNextDlg = 1;
switch( nNextDlg )
{
case 1:
{
Dialog1 dlg;
nNextDlg = dlg.DoModal();
}
case 2:
{
Dialog2 dlg;
nNextDlg = dlg.DoModal();
}
case ID_EXIT:
return;
}
}
}
Better is to make the use of user/registered message communication between parent (main dialog/window) and child dialogs (Dialog1, Dialog2, etc.), but I don't know exactly what you are trying to do.
- ns ami -
|
|
|
|
|
Why not...
void CMyFirstDialog::OnButtonOne ()
{
EndDialog (ID_BUTTON1);
}
....
...
CDialog *pDlg = new CMyFirstDialog ();
int nReturn = 0;
while (pDlg)
{
nReturn = pDlg->DoModal ();
delete pDlg;
pDlg = NULL;
switch (nReturn)
{
case ID_BUTTON1:
pDlg = new CFirstDlg;
break;
case ID_BUTTON2:
pDlg = new CSecondDlg;
break;
....
}
}
ASSERT(!pDlg);
OK, that was very quick and hacky - with no real error checking, but I hope it gives you an idea. The main difference is you wait till one dialog is finished and tidied up, *then* move on to the next one. Other wise, they just stack one on top of the other...
Iain.
switch (
Codeproject MVP for C++, I can't believe it's for my lounge posts...
modified on Tuesday, January 27, 2009 9:54 AM
|
|
|
|
|
I'm not certain I understand correctly what you want to achieve.
I don't have iTunes in front of me; and I don't see what you mean by "clicks on a button at the right panel".
Me think it's quite moronic to call DoModal() recursively.
If you want to create and display N dialogs M number of times, you'd better
use modeless dialogs and be conscious about managing the memory (when you
create and destroy the dialogs).
|
|
|
|
|