need SetWindowPos() help

This is a discussion on need SetWindowPos() help within the C++ Programming forums, part of the General Programming Boards category; Im writing a program for win32 console using the dev-bloodsehd compiler. i need the console to open at a bigger ...

  1. #1
    Registered User
    Join Date
    Dec 2003
    Posts
    9

    need SetWindowPos() help

    Im writing a program for win32 console using the dev-bloodsehd compiler.

    i need the console to open at a bigger size then default (so ascii art can be correctly displayed).

    I searched here, and found a thread saying to use SetWindowPos() for this, but no other info on the code. I googled it and didnt find anything helpful there either. I did find this line of code though it didn't work:

    Code:
    SetWindowPos(SELF:handle(), HWND_TOP, liX,liY, 0, 0, _Or(SWP_NOSIZE))
    How does this function work(meanig parameters/arguments and what they mean), and what is the exact code for it?

  2. #2
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,161

    Re: need SetWindowPos() help

    Originally posted by nerore

    I searched here, and found a thread saying to use SetWindowPos() for this, but no other info on the code. I googled it and didnt find anything helpful there either. I did find this line of code though it didn't work:

    Code:
    SetWindowPos(SELF:handle(), HWND_TOP, liX,liY, 0, 0, _Or(SWP_NOSIZE))
    How does this function work(meanig parameters/arguments and what they mean), and what is the exact code for it?
    Googling for SetWindowPos() turned up as the 2nd hit:
    http://msdn.microsoft.com/library/de...twindowpos.asp

    Best to search the web, not just this board.
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

  3. #3
    Registered User
    Join Date
    Dec 2003
    Posts
    9

    re:

    I'm pretty sure thats just for visual c++.
    I tried using it in dev-c++ and it didnt work.

    And I still don't know anything about it, as the microsoft site didn't eplain the function very well (just the parameters).

    Best to search the web, not just this board.
    If you read my post, I say I googled it =)
    Last edited by nerore; 01-11-2004 at 03:41 AM.

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    The WinAPI is the same, no matter the compiler.

    The problem is getting the handle of your console. Better to use the windows console functions, in particular
    SetConsoleWindowInfo
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  5. #5
    Registered User
    Join Date
    Dec 2003
    Posts
    9

    re:

    Code:
    BOOL SetConsoleWindowInfo(
      HANDLE hConsoleOutput,
      BOOL bAbsolute,
      const SMALL_RECT* lpConsoleWindow
    );
    That is the most confusing piece of code I've seen, even with the parameter details. I took a crack at it, but nothing happened. Here what I put:
    Code:
    BOOL SetConsoleWindowInfo(
      HANDLE=GENERIC_READ,
      BOOL bAbsolute,
      const SMALL_RECT* lpConsoleWindow
    );
    Can someone be kind enough to explain what I am doing wrong? I' m clueless.

    heres the link where I got it:
    http://msdn.microsoft.com/libr....setconsolewindowinfo.asp

  6. #6
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Code:
    SMALL_RECT newsize;
    newsize.left = 0;
    newsize.top = 0;
    newsize.right = 160;
    newsize.bottom = 100;
    SetConsoleWindowInfo(
      GetStdHandle(STD_OUTPUT_HANDLE),
      TRUE,
      &newsize);
    This should make the console window 160 characters x 100 lines large. The function will fail, however, if the buffer is not large enough. Since the default buffer is AFAIK only 80 characters wide, you need to adjust that first.
    Code:
    COORD bufsize;
    bufsize.x = 160;
    bufsize.y = 200;
    SetConsoleScreenBufferSize(
      GetStdHandle(STD_OUTPUT_HANDLE),
      &bufsize);
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. SetWindowPos not resizing
    By axr0284 in forum Windows Programming
    Replies: 2
    Last Post: 03-10-2006, 08:33 AM
  2. SetWindowPos()
    By bigdan43 in forum C++ Programming
    Replies: 1
    Last Post: 03-21-2005, 12:58 PM
  3. SetWindowPos doesn't seem to work
    By Mithoric in forum Windows Programming
    Replies: 10
    Last Post: 12-21-2003, 09:10 PM
  4. setwindowpos()
    By kryptkat in forum Windows Programming
    Replies: 2
    Last Post: 07-08-2003, 08:56 AM

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