A Line

This is a discussion on A Line within the C++ Programming forums, part of the General Programming Boards category; By not work you mean? Are you getting any compiler errors?...

  1. #16
    Super Moderater.
    Join Date
    Jan 2005
    Posts
    374
    By not work you mean?

    Are you getting any compiler errors?

  2. #17
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    Yes which I posted earlier...both on the line:
    Code:
     HWND hwnd = GetConsoleWindow();

  3. #18
    Super Moderater.
    Join Date
    Jan 2005
    Posts
    374
    I don't know then.

  4. #19
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    I will try a different compiler.

  5. #20
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,805
    Good lord. Just install a simple graphics lib, Like Allegro or SDL and draw some lines.
    http://www.libsdl.org/index.php
    http://www.talula.demon.co.uk/allegro/
    Woop?

  6. #21
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    Well, the code posted is exactly what I need but it doesn't work and I don't know why.

  7. #22
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    I there any other code that I can use?

  8. #23
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    You might try using GetForegroundWindow() instead of GetConsoleWindow(). I don't know why the code I posted doesn't work for you (it compiles fine with visual studio, so it must be an issue with your compiler's headers)
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  9. #24
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    Any reason why it wouldn't work with Dev-C++

  10. #25
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    I compile it with foreground window and I think there is a linking error...it compiles but won't run...

  11. #26
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    Anybody know what I would need to do to get the program working?

  12. #27
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    I went ahead and tried this with the latest Dev-C++ version and it works fine. You just need to link libgdi32.a and add a pause at the end so that the program doesn't terminate automatically.
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  13. #28
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    How do I link the library?

  14. #29
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    Go to project options->parameters then under "Linker" click the "Add Library or Object" button, go to the lib directory and find the lib file.
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  15. #30
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    Erm, I am using version 4 of Dev-C++

Page 2 of 3 FirstFirst 123 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to do encryption in C
    By sankarv in forum C Programming
    Replies: 33
    Last Post: 12-28-2010, 10:01 AM
  2. Reading a file line by line
    By Raskalnikov in forum C Programming
    Replies: 8
    Last Post: 03-18-2009, 11:44 PM
  3. Pointer and Polymorphism help.
    By Skyy in forum C++ Programming
    Replies: 29
    Last Post: 12-18-2008, 08:17 PM
  4. Printing Length of Input and the Limited Input
    By dnguyen1022 in forum C Programming
    Replies: 33
    Last Post: 11-29-2008, 03:13 PM
  5. Finding carriage returns (\c) in a line
    By JizJizJiz in forum C++ Programming
    Replies: 37
    Last Post: 07-19-2006, 05:44 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21