Non-Resizable, Non-Movable Window

If you want to work with nonresizable, nonmovable windows, insert this code into your project (SDI or MDI applications).

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
  if (BaseClass::OnCreate(lpCreateStruct) == -1)
    return -1;

  // Do something

  // Remove positions of menu
  CMenu* pTopMenu = GetSystemMenu(FALSE);
  if(pTopMenu != NULL)
  {
  pTopMenu -> RemoveMenu(SC_SIZE, MF_BYCOMMAND);      //Size
  pTopMenu -> RemoveMenu(SC_MOVE, MF_BYCOMMAND);      //Move
  pTopMenu -> RemoveMenu(SC_MAXIMIZE, MF_BYCOMMAND);  //Maximize
  }

  return 0;
}

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
  if( !BaseClass::PreCreateWindow(cs) )
    return FALSE;

  // Create a window without max button and sizable border
  cs.style &= ~(WS_MAXIMIZEBOX|WS_THICKFRAME);

  return TRUE;
}


Comments

  • How about Non-Moveable Win32 dialog (WinCE 3.0)Application

    Posted by Legacy on 04/09/2003 12:00am

    Originally posted by: Francis

    I try to apply the following code to compile a non-moveable dialog appication for Wince 3.0 platform.
    
    

    case WM_INITDIALOG:
    HMENU HandleMenu ;
    HandleMenu = GetSystemMenu(hDlg,FALSE);
    if(!RemoveMenu(HandleMenu ,0,MF_BYPOSITION))
    {
    Error = GetLastError();
    wsprintf(wcPassword,L"%x",Error);
    MessageBox(NULL,wcPassword,NULL,MB_OK);
    }

    and i get error code 120 which is ERROR_CALL_NOT_IMPLEMENTED (This function is not supported on this system.)


    May i know is that anyway to develop a Non-moveable dialog application in Wince 3.0?

    Thank you.

    Reply
  • keyboard windows key control

    Posted by Legacy on 04/03/2003 12:00am

    Originally posted by: leo

    Sir
    I am doing my MCA. I have a project. I have a doubt about how can control windows key in KEYBOARD.

    for example
    i have a login menu. My aim is user should enter into my login way.

    The Problem is
    They have to move using start button(windows key) and they can access like msword are else.
    So please kindly help me how can i control windows key. help me.
    Thanking you sir

    Reply
  • How about Dialogs

    Posted by Legacy on 02/18/2002 12:00am

    Originally posted by: Mikael

    Is it possible to make Dialog windows Nonmovable too ?

    Reply
  • How to remove resizing of window when double click in caption

    Posted by Legacy on 07/20/2001 12:00am

    Originally posted by: Sveinung Tollefsen

    I have tryed the method decribed, and it work fine exept if I double click in the caption the window resizes away from MAXIMIZE.

    I have added the line

    pFrame->ModifyStyle( 0,0,SWP_NOSIZE );

    But this did not help.

    Any sugestions?

    Reply
  • How to make ActiveX nonresizable?

    Posted by Legacy on 07/16/2001 12:00am

    Originally posted by: Dave Smith

    I am designing an ActiveX which needs nonresiable, i copy code here to
    CSampleCtrl::PreCreateWindow(CREATESTRUCT& cs),
    it does not work, ActiveX still can resize, it works for .exe.

    Reply
  • How to prevent positioning of an external program's window

    Posted by Legacy on 07/12/2001 12:00am

    Originally posted by: Peter Hentrich

    It is mentioned how to control the frame and child window properties.
    
    But what about manipulating an external program's window?

    e.g. I am running an external program MATLAB in the background and have successfully obtained a handle and set its window position using

    ::SetWindowPos(hNextApp, HWND_TOP, 745, 110, 520, 350, SWP_NOMOVE);

    However, I can't prevent the user from moving, minimizing or closing the window i.e. SWP_NOMOVE isn't working!

    Any suggestions?
    Thank you for your precious time!!

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: December 11, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT Market pressures to move more quickly and develop innovative applications are forcing organizations to rethink how they develop and release applications. The combination of public clouds and physical back-end infrastructures are a means to get applications out faster. However, these hybrid solutions complicate DevOps adoption, with application delivery pipelines that span across complex hybrid cloud and non-cloud environments. Check out this …

  • CentreCorp is a fully integrated and diversified property management and real estate service company, specializing in the "shopping center" segment, and is one of the premier retail service providers in North America. Company executives travel a great deal, carrying a number of traveling laptops with critical current business data, and no easy way to back up to the network outside the office. Read this case study to learn how CentreCorp implemented a suite of business continuity services that included …

Most Popular Programming Stories

More for Developers

RSS Feeds