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

  • The hard facts on SaaS adoption in over 80,000 enterprises: Public vs. private companies Mid-market vs. large enterprise GoogleApps, Office365, Salesforce & more Why security is a growing concern Fill out the form to download the full cloud adoption report.

  • On-demand Event Event Date: December 18, 2014 The Internet of Things (IoT) incorporates physical devices into business processes using predictive analytics. While it relies heavily on existing Internet technologies, it differs by including physical devices, specialized protocols, physical analytics, and a unique partner network. To capture the real business value of IoT, the industry must move beyond customized projects to general patterns and platforms. Check out this webcast and join industry experts as …

Most Popular Programming Stories

More for Developers

RSS Feeds