CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2008
    Posts
    27

    can someone tell me if i did this right

    Code:
    #include <windows.h>
    #include <mmsystem.h>
    int main(int argc, char *argv[])
    
    {
    HWND hwnd = FindWindow(0, argv[0]); // Find our program window
    ShowWindow(hwnd, SW_HIDE); // Hides it
    for(;;)
    
    
    {
    mciSendString("Set CDAudio Door Open wait", 0, 0, 0); // Opens Cd Tray
    mciSendString("Set CDAudio Door Closed wait", 0, 0, 0); // Closes CD tray
    }
    }
    any suggestions on how i could improve this would be appreciated.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: can someone tell me if i did this right

    And what are you trying to achieve with this code?
    And what kind of "improvement" do you need?
    Victor Nijegorodov

  3. #3
    Join Date
    Jan 2004
    Location
    Düsseldorf, Germany
    Posts
    2,401

    Re: can someone tell me if i did this right

    Quote Originally Posted by twistedmike View Post
    any suggestions on how i could improve this would be appreciated.
    Proper indenting comes to my mind...
    More computing sins are committed in the name of efficiency (without necessarily achieving it) than for any other single reason - including blind stupidity. --W.A.Wulf

    Premature optimization is the root of all evil --Donald E. Knuth


    Please read Information on posting before posting, especially the info on using [code] tags.

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: can someone tell me if i did this right

    Quote Originally Posted by treuss View Post
    Proper indenting comes to my mind...
    Well, I can only agree with this suggestion...
    Victor Nijegorodov

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