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

  • Packaged application development teams frequently operate with limited testing environments due to time and labor constraints. By virtualizing the entire application stack, packaged application development teams can deliver business results faster, at higher quality, and with lower risk.

  • On-demand Event Event Date: September 10, 2014 Modern mobile applications connect systems-of-engagement (mobile apps) with systems-of-record (traditional IT) to deliver new and innovative business value. But the lifecycle for development of mobile apps is also new and different. Emerging trends in mobile development call for faster delivery of incremental features, coupled with feedback from the users of the app "in the wild." This loop of continuous delivery and continuous feedback is how the best mobile …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds