CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Thread: mcisendstring

  1. #1
    Join Date
    Apr 2008
    Posts
    214

    mcisendstring

    I am using mcisendstring in my code, and was quite happy to find that it was easy to implement.

    Code:
    mciSendString("open myFile type mpegvideo alias myFile", NULL, 0, 0); 
    
    mciSendString("play myFile", NULL, 0, 0);
    Is there a way to use a variable as myFile.

    Code:
    string myFile;
    
    mciSendString("open " + myFile + " type mpegvideo alias myFile", NULL, 0, 0); 
    
    mciSendString("play myFile", NULL, 0, 0);
    If i use a string it errors this:

    Code:
    49 C:\Documents and Settings\user\My Documents\SharpDevelop Projects\c++\winapi\main2.cpp cannot convert `std::basic_string<char, std::char_traits<char>, std::allocator<char> >' to `const CHAR*' for argument `1' to `MCIERROR mciSendStringA(const CHAR*, CHAR*, UINT, HWND__*)'
    if i use char*:


    Code:
    49 C:\Documents and Settings\user\My Documents\SharpDevelop Projects\c++\winapi\main2.cpp invalid operands of types `char*' and `const char[100]' to binary `operator+'

  2. #2
    Join Date
    May 2002
    Location
    Lindenhurst, NY
    Posts
    867

    Re: mcisendstring

    Thats a problem with strings. Nothing to do with mciSendString. You should write yourself a small test program to solidify your understanding of std::string, string literals, char*, etc, etc. For instance, before trying to create that string & use it as an argument to mciSendString, I'd write a small program to create that string & print it out with std::cout.

    Here's a tutorial on strings:

    http://www.cprogramming.com/tutorial/string.html

  3. #3
    Join Date
    Apr 2008
    Posts
    214

    Re: mcisendstring

    I figured it out without your insulting link of printing out strings, especially since i have a c++ class, making an "A", and the teacher tells me to help the other students. I was thinking c# thats what was wrong. But then again I probably deserved that insult as to thinking that people had higher intelligences, especially when I dont post all the code, cuz im thinking people are smarter than that.
    Last edited by zaryk; April 26th, 2008 at 03:05 PM.

  4. #4
    Join Date
    Jun 2006
    Location
    M31
    Posts
    885

    Re: mcisendstring

    Quote Originally Posted by zaryk
    I figured it out without your insulting link of printing out strings, especially since i have a c++ class, making an "A", and the teacher tells me to help the other students.
    Congratulations, you're awesome.

    At least have the decency to thank Martin for replying to your post, instead of calling his link "insulting"...

  5. #5
    Join Date
    Apr 2008
    Posts
    214

    Re: mcisendstring

    well, at least have the decency to post something useful.

  6. #6
    Join Date
    Jun 2006
    Location
    M31
    Posts
    885

    Re: mcisendstring

    Teaching you some manners is useful, indeed.

  7. #7
    Join Date
    Apr 2008
    Posts
    214

    Re: mcisendstring

    this has nothing to do with me not knowing manners, but that I choose not to use them, so your post was useless. Plus, my mother always told me to tell the truth, and I was telling the truth when I said that his link was insulting.
    Last edited by zaryk; April 27th, 2008 at 01:21 PM.

  8. #8
    Join Date
    Jun 2006
    Location
    M31
    Posts
    885

    Re: mcisendstring

    Quote Originally Posted by zaryk
    this has nothing to do with me not knowing manners, but that I choose not to use them, so your post was useless.
    Get over yourself.

    How can you expect to receive help if you're going to act like a little kid?

  9. #9
    Join Date
    Apr 2008
    Posts
    214

    Re: mcisendstring

    You better be glad that Jim fell asleep before he saw that, he would have taken that as an insult too, especially since he is 7. This is James, Im the main person in this head of mine or maybe that was Bob but anyway, Im 19. I have multiple-personality disorder. I am one out of 15, that I have counted so far. Sorry for his behavior.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured