CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Deploying Windows Server 2008 with System Center
  • Remote Desktop Protocol Performance Improvements in Windows Server 2008 R2 and Windows 7
  • The Microsoft Dynamics CRM Security Model
  • SQL Server Modeling Services with Microsoft Visual Studio 2010 Beta 2

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Visual C++ Programming
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Visual C++ Programming Ask questions about Windows programming with Visual C++ and help others by answering their questions.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old June 24th, 2002, 03:39 PM
    RoboTact's Avatar
    RoboTact RoboTact is offline
    Elite Member
     
    Join Date: Jun 2002
    Location: Moscow, Russia.
    Posts: 2,176
    RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+)
    Howto destroy border of window thich parent is CFrameWnd?

    I use only styles WS_VISIBLE|WS_POPUP, but my window has a border(but actually has not WS_BORDER style). How can I destroy a border?
    __________________
    "Programs must be written for people to read, and only incidentally for machines to execute."
    Reply With Quote
      #2    
    Old June 24th, 2002, 03:47 PM
    JohnCz's Avatar
    JohnCz JohnCz is offline
    Microsoft MVP
    Power Poster
     
    Join Date: May 1999
    Location: DELAWARE, USA
    Posts: 9,733
    JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+)
    Quote:
    use only styles WS_VISIBLE|WS_POPUP
    • Are you sure window has only WS_VISIBLE|WS_POPUP styles?
    • Is this window a CView derived or is it from other class?
    \
    __________________
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

    Warning!
    There's nothing more dangerous than a resourceful idiot.
    Reply With Quote
      #3    
    Old June 24th, 2002, 04:07 PM
    RoboTact's Avatar
    RoboTact RoboTact is offline
    Elite Member
     
    Join Date: Jun 2002
    Location: Moscow, Russia.
    Posts: 2,176
    RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+)
    Are you sure window has only WS_VISIBLE|WS_POPUP styles?

    Yes, and if I only change parent class from CFrameWnd to CWnd there is no border in the window...

    Is this window a CView derived or is it from other class?

    There is no view/doc arcit. Window derived from CFrame Wnd as writed in the subj.
    __________________
    "Programs must be written for people to read, and only incidentally for machines to execute."
    Reply With Quote
      #4    
    Old June 25th, 2002, 08:35 AM
    JohnCz's Avatar
    JohnCz JohnCz is offline
    Microsoft MVP
    Power Poster
     
    Join Date: May 1999
    Location: DELAWARE, USA
    Posts: 9,733
    JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+)
    Quote:
    Window derived from CFrame Wnd as writed in the subj.
    Subject:

    Quote:
    Howto destroy border of window thich parent is CFrameWnd?




    I think the best will be if you zip your project and attach it to your post.
    __________________
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

    Warning!
    There's nothing more dangerous than a resourceful idiot.
    Reply With Quote
      #5    
    Old June 26th, 2002, 02:53 PM
    RoboTact's Avatar
    RoboTact RoboTact is offline
    Elite Member
     
    Join Date: Jun 2002
    Location: Moscow, Russia.
    Posts: 2,176
    RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+)
    This is simple example which shows the subject. And I can't change it to destroy a border.


    #include <afxwin.h>

    class CApp : public CWinApp
    {
    int InitInstance();
    };

    CApp theApp;

    class CNoBorder : public CFrameWnd
    {
    public:
    CNoBorder();
    };

    int CApp::InitInstance()
    {
    CWnd *f=new CNoBorder();
    f->UpdateWindow();
    f->ShowWindow(SW_SHOW);
    m_pMainWnd=f;
    return 1;
    }

    CNoBorder::CNoBorder()
    {
    Create(0,"NoBorder window(with border)",WS_VISIBLE|WS_POPUP,CRect(100,100,200,200));
    }
    __________________
    "Programs must be written for people to read, and only incidentally for machines to execute."
    Reply With Quote
      #6    
    Old June 26th, 2002, 03:33 PM
    JohnCz's Avatar
    JohnCz JohnCz is offline
    Microsoft MVP
    Power Poster
     
    Join Date: May 1999
    Location: DELAWARE, USA
    Posts: 9,733
    JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+)
    Hi RoboTact,

    I have pasted pieces of your code into SDI no doc/view architecture support and it works perfectly creating borderless window.

    That is why I have asked you to zip your project. I know that somewhere else in your code window’s style is changed.

    By the way you should call Create in a constructor of your class. If creation fails, you have no secure way out from application.

    Look if you have PreCreateWindow oveerriden in your frame derived class.
    __________________
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

    Warning!
    There's nothing more dangerous than a resourceful idiot.
    Reply With Quote
      #7    
    Old June 26th, 2002, 03:50 PM
    RoboTact's Avatar
    RoboTact RoboTact is offline
    Elite Member
     
    Join Date: Jun 2002
    Location: Moscow, Russia.
    Posts: 2,176
    RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+)
    Hi JohnCz,

    I have pasted pieces of your code into SDI no doc/view architecture support and it works perfectly creating borderless window.

    You see, I tested that code(Visual C++6, Win32 application) with no extra settings excluding adding MFS in dll support. And it creates window with border... And if I use CWnd, not CFrameWnd, window is borderless.
    __________________
    "Programs must be written for people to read, and only incidentally for machines to execute."
    Reply With Quote
      #8    
    Old June 26th, 2002, 05:20 PM
    JohnCz's Avatar
    JohnCz JohnCz is offline
    Microsoft MVP
    Power Poster
     
    Join Date: May 1999
    Location: DELAWARE, USA
    Posts: 9,733
    JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+)
    Hi again.

    Quote:
    You see, I tested that code(Visual C++6, Win32 application) with no extra settings excluding adding MFS in dll support. And it creates window with border... And if I use CWnd, not CFrameWnd, window is borderless.
    Yes I have notice this in your earlier posts and that is why I thought that your CFrameWnd derived class does something to change styles while CWnd derived class does not.

    We are now reached the end of the line. That is why I think:
    Quote:
    As I posted before
    I think the best will be if you zip your project and attach it to your post.
    __________________
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

    Warning!
    There's nothing more dangerous than a resourceful idiot.
    Reply With Quote
      #9    
    Old June 27th, 2002, 04:42 AM
    RoboTact's Avatar
    RoboTact RoboTact is offline
    Elite Member
     
    Join Date: Jun 2002
    Location: Moscow, Russia.
    Posts: 2,176
    RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+)
    quote:
    --------------------------------------------------------------------------------
    I think the best will be if you zip your project and attach it to your post.
    --------------------------------------------------------------------------------

    I mean that in the project with ONLY THAT CODE what I have posted in thread makes a window with border, and as you can see, there is no code to change style of window. So, I have posted all the project. Of course it is not all project, but it thing appears to it as well as to the whole project. So, I can't understand why are you every post talking about posting all the project.
    __________________
    "Programs must be written for people to read, and only incidentally for machines to execute."
    Reply With Quote
      #10    
    Old June 27th, 2002, 02:57 PM
    JohnCz's Avatar
    JohnCz JohnCz is offline
    Microsoft MVP
    Power Poster
     
    Join Date: May 1999
    Location: DELAWARE, USA
    Posts: 9,733
    JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+)
    I have already answer your question:

    Quote:
    my earlier post
    I have pasted pieces of your code into SDI no doc/view architecture support and it works perfectly creating borderless window.
    What I do not understand why are you so reluctant to post your project?
    Obviously there is something you are doing that I did not do that makes difference between our results.
    I am getting border-less window you are not, using the peace of code you have posted.

    I have no slightest idea what your CWnd and CFrameWnd classes are doing not to mention other classes.

    That is why we are playing posting Ping-Pong now.

    Sorry but I am not able to help you due to lack of sufficient data.

    Regards,
    __________________
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

    Warning!
    There's nothing more dangerous than a resourceful idiot.
    Reply With Quote
      #11    
    Old June 27th, 2002, 04:13 PM
    RoboTact's Avatar
    RoboTact RoboTact is offline
    Elite Member
     
    Join Date: Jun 2002
    Location: Moscow, Russia.
    Posts: 2,176
    RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+) RoboTact is a glorious beacon of light (400+)
    Here is project in archive. It contains ONLY THAT CODE that i have posted. And the window draws with border. Moy be it depends on system. My system is Win98SE.
    Attached Files
    File Type: zip noborder.zip (4.1 KB, 64 views)
    __________________
    "Programs must be written for people to read, and only incidentally for machines to execute."
    Reply With Quote
      #12    
    Old June 27th, 2002, 05:36 PM
    JohnCz's Avatar
    JohnCz JohnCz is offline
    Microsoft MVP
    Power Poster
     
    Join Date: May 1999
    Location: DELAWARE, USA
    Posts: 9,733
    JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+) JohnCz has a reputation beyond repute (3000+)
    Now we are talking.

    I did not realize that your app was so simple and yet gave you hard time. I understan your frustration but I did not realize that you have single file in your app. You could have stated it and I may have overlooked it.

    You also call Create member from constructor and as I previously stated this is not a good programming practice.

    And lastly we have to be very precise describing problem. You have created window using CFrameWnd class and your window WAS BORDER-LESS. Just created the way you wanted it.

    Your window had a frame not a border. This is extended style of the window and is changed in a frame’s virtual member PreCreateWindow to WS_EX_CLIENTEDGE.

    You can override this virtual using class wizard.

    In my code comment out line with ModifyStyle call and uncomment declaration and definition for PreCreateWindow.

    Below find all the changes that you need, (including removal of Create from constructor).
    Code:
    #include <afxwin.h>
    
    class CApp:public CWinApp
    {
    	int InitInstance();
    };
    
    CApp theApp;
    
    class CNoBorder: public CFrameWnd
    {
    public:
    	CNoBorder();
    protected:
    	//virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
    };
    
    int CApp::InitInstance()
    {
    	CFrameWnd *f=new CNoBorder();
    
    	f->Create(0,"NoBorder window(with border)",WS_VISIBLE|WS_POPUP,CRect(100,100,200,200));
    	f->ModifyStyleEx(WS_EX_CLIENTEDGE, 0, SWP_FRAMECHANGED); 
    	
    	f->UpdateWindow();
    	f->ShowWindow(SW_SHOW);
    	m_pMainWnd=f;
    	return 1;
    }	
    
    CNoBorder::CNoBorder()
    {
    }
    
    //BOOL CNoBorder::PreCreateWindow(CREATESTRUCT& cs)
    //{
    //	if(!CFrameWnd::PreCreateWindow(cs))
    //		return FALSE;
    //
    //	cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
    //
    //	return TRUE;
    //}
    __________________
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

    Warning!
    There's nothing more dangerous than a resourceful idiot.
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Visual C++ Programming


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 01:04 PM.



    Acceptable Use Policy


    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.