Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved]Using mciSendString in Qt project

[Solved]Using mciSendString in Qt project

Scheduled Pinned Locked Moved General and Desktop
6 Posts 5 Posters 2.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    antonyprojr
    wrote on last edited by
    #1

    @
    #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.

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      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

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mumutou
        wrote on last edited by
        #3

        this is a link error, you must add the Winmm.lib

        1 Reply Last reply
        0
        • H Offline
          H Offline
          haleygrow
          wrote on last edited by
          #4

          Thanks for the post. It helped me a lot.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mumutou
            wrote on last edited by
            #5

            you are welcome

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mlong
              wrote on last edited by
              #6

              Be sure and edit your original post and add [Solved] to the title. Thanks!

              Software Engineer
              My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved