Thread: Big problem :(

  1. #1
    Registered User bradszy's Avatar
    Join Date
    Jan 2008
    Posts
    114

    Big problem :(

    Fixed. Thanks.
    Last edited by bradszy; 02-19-2008 at 02:01 AM.

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Which window are you trying to use ShowWindow() on?

    You are using a main (console app) not a winmain (windows app)

    You declare a variable and use it before initialising it.
    Code:
    HWND hwndMain; //not inititalised
    
    ShowWindow(hwndMain, SW_FORCEMINIMIZE);//will fail as not told WHICH window to minimise
    As a general rule I suggest you;

    Init ALL variables in the declaration.

    Check returns from WIN32 functions

    If they fail (check the return code in MSDN) use GetLastError() to find out why.
    Last edited by novacain; 02-19-2008 at 12:57 AM.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #3
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #4
    Registered User bradszy's Avatar
    Join Date
    Jan 2008
    Posts
    114
    Yeah thanks guys. I initialized it,
    Code:
    hwndMain=FindWindowA("ConsoleWindowClass",NULL);
    And now it works... I'm going to start working on my indentation too... It'll be easier to read. Thanks again to both of you.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. big number problem
    By mad_muppet in forum C Programming
    Replies: 11
    Last Post: 08-26-2008, 12:54 AM
  2. Plzzzzz Help Me >>> Big Problem
    By AHMED KHALAF in forum C Programming
    Replies: 2
    Last Post: 12-09-2004, 07:31 AM
  3. [Help] C++ Problem
    By Oxide in forum C++ Programming
    Replies: 3
    Last Post: 10-09-2004, 09:05 PM
  4. half ADT (nested struct) problem...
    By CyC|OpS in forum C Programming
    Replies: 1
    Last Post: 10-26-2002, 08:37 AM
  5. binary tree problem - help needed
    By sanju in forum C Programming
    Replies: 4
    Last Post: 10-16-2002, 05:18 AM