CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2009
    Posts
    33

    Unhappy Hook window and modify controlbox?

    Hey all,

    I'm trying to hook onto a console application and remove the controlbox buttons, minimize, maximize ect.

    using FindWindow to grab the application isn't a problem but how would I modify the form properties to set ControlBox = false; ?

    Any ideas are much appreciated!

    Thanks,

    - Mac

  2. #2
    Join Date
    Jul 2005
    Posts
    266

    Re: Hook window and modify controlbox?

    Well there is not much you can do if it is a standard win32 console - you cant remove the sysmenu ( not 100% sure on this but almost :P ). The best thing you can do is disable the buttons this way:
    Code:
    //assuming wnd is the HWND you have from FindWindow
    HMENU menu = GetSystemMenu(wnd,FALSE);
    DeleteMenu(menu,SC_MINIMIZE,MF_BYCOMMAND);
    DeleteMenu(menu,SC_MAXIMIZE,MF_BYCOMMAND);
    DeleteMenu(menu,SC_CLOSE,MF_BYCOMMAND);
    DrawMenuBar(wnd);

  3. #3
    Join Date
    Jul 2009
    Posts
    33

    Re: Hook window and modify controlbox?

    Exactly what I was looking for! Thanks a bunch!

    - Mac

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured