| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| Visual C++ Programming Ask questions about Windows programming with Visual C++ and help others by answering their questions. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
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." - Abelson & Sussman, Structure and Interpretation of Computer Programs
|
|
#2
|
||||
|
||||
|
Quote:
__________________
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. |
|
#3
|
||||
|
||||
|
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." - Abelson & Sussman, Structure and Interpretation of Computer Programs
|
|
#4
|
||||
|
||||
|
Quote:
Quote:
![]() 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. |
|
#5
|
||||
|
||||
|
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." - Abelson & Sussman, Structure and Interpretation of Computer Programs
|
|
#6
|
||||
|
||||
|
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. |
|
#7
|
||||
|
||||
|
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." - Abelson & Sussman, Structure and Interpretation of Computer Programs
|
|
#8
|
||||
|
||||
|
Hi again.
Quote:
We are now reached the end of the line. That is why I think: Quote:
__________________
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. |
|
#9
|
||||
|
||||
|
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." - Abelson & Sussman, Structure and Interpretation of Computer Programs
|
|
#10
|
||||
|
||||
|
I have already answer your question:
Quote:
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. |
|
#11
|
||||
|
||||
|
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.
__________________
"Programs must be written for people to read, and only incidentally for machines to execute." - Abelson & Sussman, Structure and Interpretation of Computer Programs
|
|
#12
|
||||
|
||||
|
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. |
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|