[Solved]Using mciSendString in Qt project
-
@
#include <windows.h>
void OpenCD()
{
QString qstr = "set cdaudio door open";
mciSendString((LPCTSTR)qstr.unicode(), (LPTSTR)0, (UINT)0, (HWND__)0);
}
void CloseCD()
{
QString qstr = "set cdaudio door closed";
mciSendString((LPCTSTR)qstr.unicode(), (LPTSTR)0, (UINT)0, (HWND__)0);
}
@I downloaded the Windows SDK and added to the project the reference to library.
-
wecome to devnet
Please check out the forum guidelines, especially the section with the "code wrappings":http://qt-project.org/wiki/ForumHelp#e3f82045ad0f480d3fb9e0ac2d58fb01
I have introduced those for you. This makes the code much better readable.
Concerning your problem described above. Apparently the lib is missing during linking. Do you have a library with mciSendString compatible to mingw? You need to set the "LIBS parameter":http://qt-project.org/doc/qt-4.8/qmake-variable-reference.html#libs in your pro-file
-
this is a link error, you must add the Winmm.lib
-
Thanks for the post. It helped me a lot.
-
you are welcome
-
Be sure and edit your original post and add [Solved] to the title. Thanks!