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

  • You may already know about some of the benefits of Bluemix, IBM's open platform for developing and deploying mobile and web applications. Check out this webcast that focuses on building an Android application using the MobileData service, with a walk-through of the real process and workflow used to build and link the MobileData service within your application. Join IBM's subject matter experts as they show you the way to build a base application that will jumpstart you into building your own more complex app …

  • The explosion in mobile devices and applications has generated a great deal of interest in APIs. Today's businesses are under increased pressure to make it easy to build apps, supply tools to help developers work more quickly, and deploy operational analytics so they can track users, developers, application performance, and more. Apigee Edge provides comprehensive API delivery tools and both operational and business-level analytics in an integrated platform. It is available as on-premise software or through …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds