hi
i want to display windows volume control wizard with a button click. i also want to control volume (microphone and speaker) using slider.how to do these??
advance thanx
Printable View
hi
i want to display windows volume control wizard with a button click. i also want to control volume (microphone and speaker) using slider.how to do these??
advance thanx
You could implement the IAudioVolumeLevel interface?
http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx
how to implement??
give some link or reference.
thanks
I included a link/reference in my post. Perhaps you missed it?
how to implement in qt??
hi masuk,
In windows XP u can use windows.h (api)
hope it helps
Bala
hi bala
can you give sample source code??
You implement as per any other COM object, using REFIID IID_IAudioVolumeLevel.
If you don't want the complexity of COM objects, then the best thing to do is just alter your own volume output only, rather than trying to adjust the system volume.
hi all,
i need Qt documentation/samples to solve.
thanks
You mean you want working code ?Quote:
i need Qt documentation/samples to solve.
I need Qt documentation. how can i add windows api,how to adjust with slider.
thanks
You can use windows API calls in the same way regardless of whether you use Qt or not, as Qt is just another library that you use, like Win API.
Qt itself does not support altering the system volume control.
i tried this
Code:
#include "form1.h" #include "ui_form1.h" #include <phonon/AudioOutput> #include <phonon/MediaObject> #include <phonon/VolumeSlider> ui(new Ui::Form1) { ui->setupUi(this); connect(ui->horizontalSlider,SIGNAL(sliderMoved(int)),this,SLOT(setAudioOutput())); Phonon::MediaObject *mediaObject = new Phonon::MediaObject(this); Phonon::AudioOutput *audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory); Phonon::createPath(mediaObject, audioOutput); Phonon::VolumeSlider *volumeSlider = new Phonon::VolumeSlider; volumeSlider->setAudioOutput(audioOutput); }
but showing these errors:
Code:
cpp:59: undefined reference to `_imp___ZN6Phonon11MediaObjectC1EP7QObject' cpp:60: undefined reference to `_imp___ZN6Phonon11AudioOutputC1ENS_8CategoryEP7QObject' cpp:61: undefined reference to `_imp___ZN6Phonon10createPathEPNS_9MediaNodeES1_' cpp:61: undefined reference to `_imp___ZN6Phonon4PathD1Ev' cpp:63: undefined reference to `_imp___ZN6Phonon12VolumeSliderC1EP7QWidget' cpp:64: undefined reference to `_imp___ZN6Phonon12VolumeSlider14setAudioOutputEPNS_11AudioOutputE' cpp:59: undefined reference to `_imp___ZN6Phonon11MediaObjectC1EP7QObject' cpp:60: undefined reference to `_imp___ZN6Phonon11AudioOutputC1ENS_8CategoryEP7QObject' cpp:61: undefined reference to `_imp___ZN6Phonon10createPathEPNS_9MediaNodeES1_' cpp:61: undefined reference to `_imp___ZN6Phonon4PathD1Ev' cpp:63: undefined reference to `_imp___ZN6Phonon12VolumeSliderC1EP7QWidget' cpp:64: undefined reference to `_imp___ZN6Phonon12VolumeSlider14setAudioOutputEPNS_11AudioOutputE' collect2: ld returned 1 exit status
Is possible to solve in this way?
thanks
did you made changes to your .pro file to link to phonon?
hi
thanks nish.
after link to phonon there is no error. but i can not solve my problem means when i moved slider(horizontal slider) it does not change the volume level of "windows volume control"
thanks
That is correct, phonon only changes the volume control of application. To change the system volume control, it is more difficult and requires WinAPI.
i tried this
Code:
#include "form1.h" #include "ui_form1.h" #include <phonon/AudioOutput> #include <phonon/MediaObject> #include <phonon/VolumeSlider> #include <QLibrary> #include <windows.h> ui(new Ui::Form1) { ui->setupUi(this); myLib.load(); if (myLib.isLoaded()) { connect(ui->horizontalSlider,SIGNAL(sliderMoved(int)),this,SLOT(setAudioOutput())); } //Phonon::MediaObject *mediaObject = new Phonon::MediaObject(this); //Phonon::AudioOutput *audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory); //Phonon::createPath(mediaObject, audioOutput); //mediaObject->setCurrentSource(Phonon::MediaSource("C:/Windows/Suiystem32/MMSYSTEM.DLL")); //Phonon::VolumeSlider *volumeSlider = new Phonon::VolumeSlider; //volumeSlider->setAudioOutput(audioOutput); } void Form1::showForm2() //<----error show here { Form2 *frm2 = new Form2; //<----error show here frm2->show(); //<----error show here }
As phonon only changes the volume control of application so i comments those lines.
But when use #include<windows.h> these errors shown:
Code:
form1.cpp: In member function 'void Form1::showForm2()': form1.cpp:182: error: expected unqualified-id before numeric constant form1.cpp:182: error: expected initializer before numeric constant form1.cpp:183: error: base operand of '->' is not a pointer
this is .pro file
Code:
QT += core gui QT += phonon LIBS += -luser32 -lshell32 -lgdi32 TARGET = untitled2 TEMPLATE = app SOURCES += main.cpp\ mainwindow.cpp \ form1.cpp HEADERS += mainwindow.h \ form1.h FORMS += mainwindow.ui \ form1.ui
my problem is not solved."is the signal and slot is right that i used for horizontal slider" and "is the selected .dll is right to solve my problem"?
thanks
Where is Form2 defined?
Hi squidge
actually in my program i defined #include "form2.h" but in post that missed.
Code:
#include "form1.h" #include "ui_form1.h" #include "form2.h" #include <phonon/AudioOutput> #include <phonon/MediaObject> #include <phonon/VolumeSlider> #include <QLibrary> #include <windows.h> ui(new Ui::Form1) { ui->setupUi(this); myLib.load(); if (myLib.isLoaded()) { connect(ui->horizontalSlider,SIGNAL(sliderMoved(int)),this,SLOT(setAudioOutput())); } //Phonon::MediaObject *mediaObject = new Phonon::MediaObject(this); //Phonon::AudioOutput *audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory); //Phonon::createPath(mediaObject, audioOutput); //mediaObject->setCurrentSource(Phonon::MediaSource("C:/Windows/Suiystem32/MMSYSTEM.DLL")); //Phonon::VolumeSlider *volumeSlider = new Phonon::VolumeSlider; //volumeSlider->setAudioOutput(audioOutput); } void Form1::showForm2() //<----error show here { Form2 *frm2 = new Form2; //<----error show here frm2->show(); //<----error show here }
but my problem is not solved.....:(
thanks
Ok, I'm confused. The error is on line 182, but there are only 36 lines in your post.
Secondly, what is content of Form2.h ?