📄 cwnd.cpp
字号:
#include "CWnd.hpp"
#include <assert.h>
CWnd& CWnd::operator=(CWnd& w) // note: Ownership is NOT passed when assigning!
{
bool ret = Destroy();
assert(ret);
handle = w.handle;
return *this;
}
bool CWnd::SetHWND(HWND h)
{
if (Destroy()) {
handle = h;
return true;
}
return false;
}
bool CWnd::SetHWND(CWnd& father,int nID)
{
if (Destroy()) {
handle = father.GetItem(nID).GetHWND() ;
return true;
}
return false;
}
bool CWnd::Create(DWORD dwExStyle, LPCTSTR ClassName, LPCTSTR WindowName, DWORD dwStyle,int x,int y,int Width,int Height,CWnd& Parent, CMenu& Menu, HINSTANCE Instance, LPVOID lpParam)
{
if (Destroy()) {
handle = ::CreateWindowEx(dwExStyle,ClassName,WindowName, dwStyle,x,y,Width,Height,Parent.GetHWND(), Menu.GetHMENU(),Instance,lpParam);
if (IsOpen()) {
IsOwner = true;
return true;
}
}
return false;
}
bool CWnd::Destroy()
{
if (IsOwner) {
if (::DestroyWindow(handle)) {
IsOwner = false;
handle = NULL;
return true;
}
return false;
}
return true;
}
CString CWnd::GetText()
{
CString ret;
int len = GetWindowTextLength(GetHWND())+1;
ret.SetLen(len);
ret.SetLen(::GetWindowText(GetHWND(),ret.Ptr(),len));
return ret;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -