CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Learn How to Create Dual Mode Windows Services
  • XBox live shutting down for original XBox consoles
  • Windows 7 release candidate (RC) will soon expire
  • Facebook removes Microsoft banner ads

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > C++ (Non Visual C++ Issues)
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    C++ (Non Visual C++ Issues) Ask or answer C and C++ questions not related to Visual C++. This includes Console programming, Linux programming, or general ANSI C++.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old November 23rd, 2009, 03:59 PM
    twistedmike twistedmike is offline
    Junior Member
     
    Join Date: Dec 2008
    Posts: 22
    twistedmike is an unknown quantity at this point (<10)
    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.
    Reply With Quote
      #2    
    Old November 23rd, 2009, 04:22 PM
    VictorN's Avatar
    VictorN VictorN is offline
    Elite Member
    Power Poster
     
    Join Date: Jan 2003
    Location: Wallisellen (Zürich), Switzerland
    Posts: 10,221
    VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+)
    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
    Reply With Quote
      #3    
    Old November 23rd, 2009, 06:42 PM
    treuss's Avatar
    treuss treuss is offline
    Elite Member
     
    Join Date: Jan 2004
    Location: Düsseldorf, Germany
    Posts: 2,330
    treuss is a splendid one to behold (750+) treuss is a splendid one to behold (750+) treuss is a splendid one to behold (750+) treuss is a splendid one to behold (750+) treuss is a splendid one to behold (750+) treuss is a splendid one to behold (750+) treuss is a splendid one to behold (750+) treuss is a splendid one to behold (750+)
    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

    Computer programming requires a great deal of attention to detail and an ability to read and understand abstract instructions. Posting a question to this forum in a way that it will get answered, requires the same, though too far smaller degree. Thus, if you don't get your question answered here, maybe it's time to accept that programming is not your thing. --Yours truly

    Please read Information on posting before posting, especially the info on using [code] tags.
    Reply With Quote
      #4    
    Old November 24th, 2009, 03:50 AM
    VictorN's Avatar
    VictorN VictorN is offline
    Elite Member
    Power Poster
     
    Join Date: Jan 2003
    Location: Wallisellen (Zürich), Switzerland
    Posts: 10,221
    VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+)
    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
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > C++ (Non Visual C++ Issues)


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 05:52 AM.



    Acceptable Use Policy


    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.