Solved

max buffer size

Posted on 2002-05-24
5
436 Views
Last Modified: 2010-08-05
There is a constant that represents the maximum size of a buffer. What is his name?

something to use like

char[MAX_BUFFER_SIZE] n;
0
Comment
Question by:oleber
  • 3
5 Comments
 
LVL 4

Expert Comment

by:mblat
ID: 7032882
  Maximum size of buffer on stack?  No, because it is machine/platform/program specific.  
   Fo certain platform supplyer may provide something like this. Actually I saw it done for G-OS (it is some obscure OS I had to work with ) but it isn't part of a standard as far as I know.

   What is the real question though?  How big of a buffer you can allocation on a stack?
0
 
LVL 30

Accepted Solution

by:
Axter earned 50 total points
ID: 7033005
I belieave you can get the max size from the following

std::string().max_size()

Example:
size_t MyMaxSize = std::string().max_size();
cout << MyMaxSize << endl;

This should be a good indicator of how big your buffer can be even on a non-string object.
0
 
LVL 4

Expert Comment

by:mblat
ID: 7033148
LONG FAR PASCAL SampleMDIChildWndProc(hWnd, msg, wParam, lParam)


HWND    hWnd;
WORD    msg;
WORD    wParam;
LONG    lParam;

// This sample MDI child window procedure can be used to prevent the
// MDI child from being maximized, minimized, or sized.
//
// Note that the child will still have a maximize button, a minimize
// button, and a thick "sizing" border. Currently, there is no way to
// prevent Windows from creating MDI children with these default
// styles.
//
// We can, however, disable the maximizing, minimizing, and sizing
// functionality by:
//
// 1. Disabling system menu options
// 2. Trapping WM_SYSCOMMAND messages


{
    HMENU    hSystemMenu;    // the MDI child's system menu

    switch (msg)
        {
    case WM_INITMENU:
        // Disable and gray the Maximize, Minimize, and Size items
        // on the MDI child's system menu
        hSystemMenu = GetSystemMenu(hWnd, FALSE);
        EnableMenuItem(hSystemMenu, SC_MAXIMIZE, MF_GRAYED |
             MF_BYCOMMAND);
        EnableMenuItem(hSystemMenu, SC_MINIMIZE, MF_GRAYED |
             MF_BYCOMMAND);
        EnableMenuItem(hSystemMenu, SC_SIZE, MF_GRAYED |
             MF_BYCOMMAND);
        break;

    case WM_SYSCOMMAND:
        // "Eat" these system commands to disable maximizing,
        // minimizing, and sizing functionality.
        // Note that wParam must be combined with 0xFFF0, using
        // the C bitwise AND (&) operator, when processing
        // the WM_SYSCOMMAND message.
        switch (wParam & 0xFFF0)
            {
        case SC_MAXIMIZE:
        case SC_MINIMIZE:
        case SC_SIZE:
             return 1L;

        default:
             break;
            }
        break;

    default:
        break;
        }

    return DefMDIChildProc(hWnd, msg, wParam, lParam);

}
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7034164
Jane: Emily Litella! It's "Max size", not "Maximize"
Emily: Oh.... that's different.... never mind.
0
 
LVL 4

Expert Comment

by:mblat
ID: 7035001
It was just to wrong area..... That'll teach me not to view several questions at the same time... :-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now