|
Mean=Lin George.
|
|
|
|
|
Hello dear friend,
How can we control the system sound.
I want to control sound from my application.
I want following things to handle from the application
1)Mute/Unmute
2)Play/Pause
3)Adjustring the system volume.
How can I do these things?
Sample code would be appreciated.
Thanks in Advance.
ritz1234
|
|
|
|
|
|
|
Play and puase of other programs or your program?
|
|
|
|
|
As in the windows xp media player we can play/pause the song this what I want should be handled from the application.
ritz1234
|
|
|
|
|
|
ritz1234 wrote: 3)Adjustring the system volume.
How can I do these things?
Here is one example.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
hi, I have a sql in my program. What I want is exactly like this:
select *
from tbl t
where t.name like '%xyz%'
So in source code, I create sql like this:
CString name = "xyz";
::sprintf_s(szQuery, " select * from tbl t where t.name like '%%%s%%' ", name);
Here is szQuery when I execute
select *
from tbl t
where t.name like '%x%'
Just the first character is printed into szQuery.
What's wrong here? what should I do??
Thank you in advance.
|
|
|
|
|
Do you have UNICODE enabled ?
|
|
|
|
|
yes, Cedric. It's a Unicode project. In Project properties, The Character Set is "Use Unicode Character Set"
is that wrong?
|
|
|
|
|
Then you have to specify %S instead of %s. CString will return a wide-character string since UNICODE is enabled. If you look at the format specification[^] you can see that %S tells printf that the string is a wide-char string (when used with printf alike functions).
|
|
|
|
|
Thank you, Cedric.
I just change the Character Set property to "Use Multi-Byte Character Set" and it's ok now
modified on Thursday, July 17, 2008 9:40
|
|
|
|
|
I think your project is a unicode project. So the CString will be holding a pointer to unicode string. So you the following options.
1. use _stprintf_s() intead of sprintf_s( in this case szQuery also need to be TCHAR* or TCHAR[] ) or
2. Use CStringA instead of CString or
3. Convert CString content to multibyte characters using WideCharToMultiByte() API.
4. Undef _UNICODE.
|
|
|
|
|
5. Or simply use %S instead of %s
|
|
|
|
|
nice!!
If we use "Use Multi-Byte Character Set", it should be "%s".
Or if we use "Use Unicode Character Set", it should be "%S".
Thank you, Cedric!!
|
|
|
|
|
I will try them now. At least the option 2 works
There 're many functions similar to each other. It's so messy, and not easy to understand ....
Thank you, Naveen.
|
|
|
|
|
I have a base class A which is being inherited later & in one inherited class i had OVERLOADED one of the base class function.
The code snippet is given below.
class A{
public:
virtual void fun(){
cout<<"A";
}
};
class B: virtual public A{
public :
void fun(){
cout<<"k";
}
};
class C: virtual public A{
public:
int fun(int num){
cout<<"C";
}
};
class D: public C, public B{
};
void main(){
D dObj;
dObj.fun(4);
}
Can anyone tell me why i am getting an "ambigous" error in the fn call?
|
|
|
|
|
thenewbee wrote: dObj.fun(4);
The error came because the compiler (me also)dosent understand which function it should actually call. function of A, or B or C. Actually which class' function do u expect to get executed?
|
|
|
|
|
The call dObj.fun(4) shld call C::fun(int)
Thats wt we had learned from the concept of Overloading. .
Am i correct??
|
|
|
|
|
thenewbee wrote: Am i correct??
no. First can u tell me why didnt you expect B::fun(int) to get called. Both B and C are base classes of D. Isnt it..? is it because C is your favourite ?
|
|
|
|
|
virtual void fun(){
cout<<"A";
}
};
class B: virtual public A{
public :
void fun(){
cout<<"k";
}
};
Its not becoz C is my Fav. .
The base class B dont have fun(int). But C have.
& how will B get the fun(int)??
|
|
|
|
|
???
|
|
|
|
|
First state my invironments: OS xp sp2, vc6.0
I create a dialog based MFC program, in the CMyDlg class, I type CTRL+W to invoke the ClassWizard,
I couldn't find some messages like
WM_NCHITTEST, WM_ENDSESSION, WM_QUERYENDSESSION
messages in the MESSAGE MAPS.
I should manually add these message handles.
Does anyone knows why?
|
|
|
|
|
In the class wizard, take the last tab( Class info ). In it there will be a "Message Filter" Combo box. By default for a dialog class, it will be having value "Dialog". Change it to "Window".
Now if you took the the "Message Map" tab, all the above messages will be present
|
|
|
|