mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-10 02:07:07 -06:00
9.34
This commit is contained in:
committed by
Kornel Lesiński
parent
83f8ddcc5b
commit
f08f4dcc3c
6
CPP/Windows/Control/ComboBox.cpp
Executable file → Normal file
6
CPP/Windows/Control/ComboBox.cpp
Executable file → Normal file
@@ -3,10 +3,10 @@
|
||||
#include "StdAfx.h"
|
||||
|
||||
#ifndef _UNICODE
|
||||
#include "Common/StringConvert.h"
|
||||
#include "../../Common/StringConvert.h"
|
||||
#endif
|
||||
|
||||
#include "Windows/Control/ComboBox.h"
|
||||
#include "ComboBox.h"
|
||||
|
||||
#ifndef _UNICODE
|
||||
extern bool g_IsNT;
|
||||
@@ -51,7 +51,7 @@ LRESULT CComboBox::GetLBText(int index, UString &s)
|
||||
if (len == CB_ERR)
|
||||
return len;
|
||||
s = GetUnicodeString(sa);
|
||||
return s.Length();
|
||||
return s.Len();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
2
CPP/Windows/Control/ComboBox.h
Executable file → Normal file
2
CPP/Windows/Control/ComboBox.h
Executable file → Normal file
@@ -32,6 +32,8 @@ public:
|
||||
LRESULT SetItemData(int index, LPARAM lParam) { return SendMessage(CB_SETITEMDATA, index, lParam); }
|
||||
LRESULT GetItemData(int index) { return SendMessage(CB_GETITEMDATA, index, 0); }
|
||||
|
||||
LRESULT GetItemData_of_CurSel() { return GetItemData(GetCurSel()); }
|
||||
|
||||
void ShowDropDown(bool show = true) { SendMessage(CB_SHOWDROPDOWN, show ? TRUE : FALSE, 0); }
|
||||
};
|
||||
|
||||
|
||||
4
CPP/Windows/Control/CommandBar.h
Executable file → Normal file
4
CPP/Windows/Control/CommandBar.h
Executable file → Normal file
@@ -5,7 +5,7 @@
|
||||
|
||||
#ifdef UNDER_CE
|
||||
|
||||
#include "Windows/Window.h"
|
||||
#include "../Window.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
|
||||
// Macros
|
||||
// void Destroy() { CommandBar_Destroy(_window); }
|
||||
bool AddButtons(int iButton, UINT numButtons, LPTBBUTTON buttons) { return BOOLToBool(SendMessage(TB_ADDBUTTONS, (WPARAM)numButtons, (LPARAM)buttons)); }
|
||||
// bool AddButtons(UINT numButtons, LPTBBUTTON buttons) { return BOOLToBool(SendMessage(TB_ADDBUTTONS, (WPARAM)numButtons, (LPARAM)buttons)); }
|
||||
bool InsertButton(int iButton, LPTBBUTTON button) { return BOOLToBool(SendMessage(TB_INSERTBUTTON, (WPARAM)iButton, (LPARAM)button)); }
|
||||
BOOL AddToolTips(UINT numToolTips, LPTSTR toolTips) { return BOOLToBool(SendMessage(TB_SETTOOLTIPS, (WPARAM)numToolTips, (LPARAM)toolTips)); }
|
||||
void AutoSize() { SendMessage(TB_AUTOSIZE, 0, 0); }
|
||||
|
||||
52
CPP/Windows/Control/Dialog.cpp
Executable file → Normal file
52
CPP/Windows/Control/Dialog.cpp
Executable file → Normal file
@@ -2,11 +2,12 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Windows/Control/Dialog.h"
|
||||
#ifndef _UNICODE
|
||||
#include "../../Common/StringConvert.h"
|
||||
#endif
|
||||
|
||||
#include "Dialog.h"
|
||||
|
||||
extern HINSTANCE g_hInstance;
|
||||
#ifndef _UNICODE
|
||||
extern bool g_IsNT;
|
||||
@@ -99,6 +100,55 @@ bool IsDialogSizeOK(int xSize, int ySize)
|
||||
ySize / 8 * y <= wy;
|
||||
}
|
||||
|
||||
bool CDialog::GetMargins(int margin, int &x, int &y)
|
||||
{
|
||||
x = margin;
|
||||
y = margin;
|
||||
RECT rect;
|
||||
rect.left = 0;
|
||||
rect.top = 0;
|
||||
rect.right = margin;
|
||||
rect.bottom = margin;
|
||||
if (!MapRect(&rect))
|
||||
return false;
|
||||
x = rect.right - rect.left;
|
||||
y = rect.bottom - rect.top;
|
||||
return true;
|
||||
}
|
||||
|
||||
int CDialog::Units_To_Pixels_X(int units)
|
||||
{
|
||||
RECT rect;
|
||||
rect.left = 0;
|
||||
rect.top = 0;
|
||||
rect.right = units;
|
||||
rect.bottom = units;
|
||||
if (!MapRect(&rect))
|
||||
return units * 3 / 2;
|
||||
return rect.right - rect.left;
|
||||
}
|
||||
|
||||
bool CDialog::GetItemSizes(int id, int &x, int &y)
|
||||
{
|
||||
RECT rect;
|
||||
if (!::GetWindowRect(GetItem(id), &rect))
|
||||
return false;
|
||||
x = RECT_SIZE_X(rect);
|
||||
y = RECT_SIZE_Y(rect);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CDialog::GetClientRectOfItem(int id, RECT &rect)
|
||||
{
|
||||
::GetWindowRect(GetItem(id), &rect);
|
||||
ScreenToClient(&rect);
|
||||
}
|
||||
|
||||
bool CDialog::MoveItem(int id, int x, int y, int width, int height, bool repaint)
|
||||
{
|
||||
return BOOLToBool(::MoveWindow(GetItem(id), x, y, width, height, BoolToBOOL(repaint)));
|
||||
}
|
||||
|
||||
void CDialog::NormalizeSize(bool fullNormalize)
|
||||
{
|
||||
RECT workRect;
|
||||
|
||||
58
CPP/Windows/Control/Dialog.h
Executable file → Normal file
58
CPP/Windows/Control/Dialog.h
Executable file → Normal file
@@ -3,7 +3,7 @@
|
||||
#ifndef __WINDOWS_CONTROL_DIALOG_H
|
||||
#define __WINDOWS_CONTROL_DIALOG_H
|
||||
|
||||
#include "Windows/Window.h"
|
||||
#include "../Window.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
@@ -11,7 +11,7 @@ namespace NControl {
|
||||
class CDialog: public CWindow
|
||||
{
|
||||
public:
|
||||
CDialog(HWND wndow = NULL): CWindow(wndow){};
|
||||
CDialog(HWND wnd = NULL): CWindow(wnd){};
|
||||
virtual ~CDialog() {};
|
||||
|
||||
HWND GetItem(int itemID) const
|
||||
@@ -23,6 +23,9 @@ public:
|
||||
bool ShowItem(int itemID, int cmdShow) const
|
||||
{ return BOOLToBool(::ShowWindow(GetItem(itemID), cmdShow)); }
|
||||
|
||||
bool ShowItem_Bool(int itemID, bool show) const
|
||||
{ return ShowItem(itemID, show ? SW_SHOW: SW_HIDE); }
|
||||
|
||||
bool HideItem(int itemID) const { return ShowItem(itemID, SW_HIDE); }
|
||||
|
||||
bool SetItemText(int itemID, LPCTSTR s)
|
||||
@@ -110,52 +113,11 @@ public:
|
||||
LONG_PTR GetMsgResult() const
|
||||
{ return GetLongPtr(DWLP_MSGRESULT); }
|
||||
|
||||
|
||||
bool GetMargins(int margin, int &x, int &y)
|
||||
{
|
||||
RECT rect;
|
||||
rect.left = 0;
|
||||
rect.top = 0;
|
||||
rect.right = margin;
|
||||
rect.bottom = margin;
|
||||
if (!MapRect(&rect))
|
||||
return false;
|
||||
x = rect.right - rect.left;
|
||||
y = rect.bottom - rect.top;
|
||||
return true;
|
||||
}
|
||||
|
||||
int Units_To_Pixels_X(int units)
|
||||
{
|
||||
RECT rect;
|
||||
rect.left = 0;
|
||||
rect.top = 0;
|
||||
rect.right = units;
|
||||
rect.bottom = units;
|
||||
if (!MapRect(&rect))
|
||||
return units * 3 / 2;
|
||||
return rect.right - rect.left;
|
||||
}
|
||||
|
||||
bool GetItemSizes(int id, int &x, int &y)
|
||||
{
|
||||
RECT rect;
|
||||
if (!::GetWindowRect(GetItem(id), &rect))
|
||||
return false;
|
||||
x = rect.right - rect.left;
|
||||
y = rect.bottom - rect.top;
|
||||
return true;
|
||||
}
|
||||
|
||||
void GetClientRectOfItem(int id, RECT &rect)
|
||||
{
|
||||
::GetWindowRect(GetItem(id), &rect);
|
||||
ScreenToClient(&rect);
|
||||
}
|
||||
|
||||
|
||||
bool MoveItem(int id, int x, int y, int width, int height, bool repaint = true)
|
||||
{ return BOOLToBool(::MoveWindow(GetItem(id), x, y, width, height, BoolToBOOL(repaint))); }
|
||||
bool GetMargins(int margin, int &x, int &y);
|
||||
int Units_To_Pixels_X(int units);
|
||||
bool GetItemSizes(int id, int &x, int &y);
|
||||
void GetClientRectOfItem(int id, RECT &rect);
|
||||
bool MoveItem(int id, int x, int y, int width, int height, bool repaint = true);
|
||||
|
||||
void NormalizeSize(bool fullNormalize = false);
|
||||
void NormalizePosition();
|
||||
|
||||
2
CPP/Windows/Control/Edit.h
Executable file → Normal file
2
CPP/Windows/Control/Edit.h
Executable file → Normal file
@@ -3,7 +3,7 @@
|
||||
#ifndef __WINDOWS_CONTROL_EDIT_H
|
||||
#define __WINDOWS_CONTROL_EDIT_H
|
||||
|
||||
#include "Windows/Window.h"
|
||||
#include "../Window.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
|
||||
0
CPP/Windows/Control/ImageList.cpp
Executable file → Normal file
0
CPP/Windows/Control/ImageList.cpp
Executable file → Normal file
2
CPP/Windows/Control/ImageList.h
Executable file → Normal file
2
CPP/Windows/Control/ImageList.h
Executable file → Normal file
@@ -3,7 +3,7 @@
|
||||
#ifndef __WINDOWS_CONTROL_IMAGELIST_H
|
||||
#define __WINDOWS_CONTROL_IMAGELIST_H
|
||||
|
||||
#include "Windows/Defs.h"
|
||||
#include "../Defs.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
|
||||
2
CPP/Windows/Control/ListView.cpp
Executable file → Normal file
2
CPP/Windows/Control/ListView.cpp
Executable file → Normal file
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Windows/Control/ListView.h"
|
||||
#include "ListView.h"
|
||||
|
||||
#ifndef _UNICODE
|
||||
extern bool g_IsNT;
|
||||
|
||||
2
CPP/Windows/Control/ListView.h
Executable file → Normal file
2
CPP/Windows/Control/ListView.h
Executable file → Normal file
@@ -3,7 +3,7 @@
|
||||
#ifndef __WINDOWS_CONTROL_LISTVIEW_H
|
||||
#define __WINDOWS_CONTROL_LISTVIEW_H
|
||||
|
||||
#include "Windows/Window.h"
|
||||
#include "../Window.h"
|
||||
|
||||
#include <commctrl.h>
|
||||
|
||||
|
||||
0
CPP/Windows/Control/ProgressBar.h
Executable file → Normal file
0
CPP/Windows/Control/ProgressBar.h
Executable file → Normal file
5
CPP/Windows/Control/PropertyPage.cpp
Executable file → Normal file
5
CPP/Windows/Control/PropertyPage.cpp
Executable file → Normal file
@@ -2,11 +2,12 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Windows/Control/PropertyPage.h"
|
||||
#ifndef _UNICODE
|
||||
#include "../../Common/StringConvert.h"
|
||||
#endif
|
||||
|
||||
#include "PropertyPage.h"
|
||||
|
||||
extern HINSTANCE g_hInstance;
|
||||
#ifndef _UNICODE
|
||||
extern bool g_IsNT;
|
||||
@@ -53,7 +54,7 @@ INT_PTR MyPropertySheet(const CObjectVector<CPageInfo> &pagesInfo, HWND hwndPare
|
||||
#endif
|
||||
CRecordVector<PROPSHEETPAGEW> pagesW;
|
||||
|
||||
int i;
|
||||
unsigned i;
|
||||
#ifndef _UNICODE
|
||||
for (i = 0; i < pagesInfo.Size(); i++)
|
||||
titles.Add(GetSystemString(pagesInfo[i].Title));
|
||||
|
||||
0
CPP/Windows/Control/PropertyPage.h
Executable file → Normal file
0
CPP/Windows/Control/PropertyPage.h
Executable file → Normal file
7
CPP/Windows/Control/ReBar.h
Executable file → Normal file
7
CPP/Windows/Control/ReBar.h
Executable file → Normal file
@@ -3,8 +3,7 @@
|
||||
#ifndef __WINDOWS_CONTROL_REBAR_H
|
||||
#define __WINDOWS_CONTROL_REBAR_H
|
||||
|
||||
#include "Windows/Window.h"
|
||||
#include "Windows/Defs.h"
|
||||
#include "../Window.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
@@ -16,9 +15,9 @@ public:
|
||||
{ return LRESULTToBool(SendMessage(RB_SETBARINFO, 0, (LPARAM)barInfo)); }
|
||||
bool InsertBand(int index, LPREBARBANDINFO bandInfo)
|
||||
{ return LRESULTToBool(SendMessage(RB_INSERTBAND, index, (LPARAM)bandInfo)); }
|
||||
bool SetBandInfo(int index, LPREBARBANDINFO bandInfo)
|
||||
bool SetBandInfo(unsigned index, LPREBARBANDINFO bandInfo)
|
||||
{ return LRESULTToBool(SendMessage(RB_SETBANDINFO, index, (LPARAM)bandInfo)); }
|
||||
void MaximizeBand(int index, bool ideal)
|
||||
void MaximizeBand(unsigned index, bool ideal)
|
||||
{ SendMessage(RB_MAXIMIZEBAND, index, BoolToBOOL(ideal)); }
|
||||
bool SizeToRect(LPRECT rect)
|
||||
{ return LRESULTToBool(SendMessage(RB_SIZETORECT, 0, (LPARAM)rect)); }
|
||||
|
||||
0
CPP/Windows/Control/Static.h
Executable file → Normal file
0
CPP/Windows/Control/Static.h
Executable file → Normal file
21
CPP/Windows/Control/StatusBar.h
Executable file → Normal file
21
CPP/Windows/Control/StatusBar.h
Executable file → Normal file
@@ -3,8 +3,7 @@
|
||||
#ifndef __WINDOWS_CONTROL_STATUSBAR_H
|
||||
#define __WINDOWS_CONTROL_STATUSBAR_H
|
||||
|
||||
#include "Windows/Window.h"
|
||||
#include "Windows/Defs.h"
|
||||
#include "../Window.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
@@ -14,28 +13,28 @@ class CStatusBar: public NWindows::CWindow
|
||||
public:
|
||||
bool Create(LONG style, LPCTSTR text, HWND hwndParent, UINT id)
|
||||
{ return (_window = ::CreateStatusWindow(style, text, hwndParent, id)) != 0; }
|
||||
bool SetParts(int numParts, const int *edgePostions)
|
||||
{ return LRESULTToBool(SendMessage(SB_SETPARTS, numParts, (LPARAM)edgePostions)); }
|
||||
bool SetText(LPCTSTR text)
|
||||
{ return CWindow::SetText(text); }
|
||||
|
||||
bool SetText(int index, LPCTSTR text, UINT type)
|
||||
bool SetText(unsigned index, LPCTSTR text, UINT type)
|
||||
{ return LRESULTToBool(SendMessage(SB_SETTEXT, index | type, (LPARAM)text)); }
|
||||
bool SetText(int index, LPCTSTR text)
|
||||
bool SetText(unsigned index, LPCTSTR text)
|
||||
{ return SetText(index, text, 0); }
|
||||
void Simple(bool simple)
|
||||
{ SendMessage(SB_SIMPLE, BoolToBOOL(simple), 0); }
|
||||
|
||||
#ifndef _UNICODE
|
||||
bool Create(LONG style, LPCWSTR text, HWND hwndParent, UINT id)
|
||||
{ return (_window = ::CreateStatusWindowW(style, text, hwndParent, id)) != 0; }
|
||||
bool SetText(LPCWSTR text)
|
||||
{ return CWindow::SetText(text); }
|
||||
bool SetText(int index, LPCWSTR text, UINT type)
|
||||
bool SetText(unsigned index, LPCWSTR text, UINT type)
|
||||
{ return LRESULTToBool(SendMessage(SB_SETTEXTW, index | type, (LPARAM)text)); }
|
||||
bool SetText(int index, LPCWSTR text)
|
||||
bool SetText(unsigned index, LPCWSTR text)
|
||||
{ return SetText(index, text, 0); }
|
||||
#endif
|
||||
|
||||
bool SetParts(unsigned numParts, const int *edgePostions)
|
||||
{ return LRESULTToBool(SendMessage(SB_SETPARTS, numParts, (LPARAM)edgePostions)); }
|
||||
void Simple(bool simple)
|
||||
{ SendMessage(SB_SIMPLE, BoolToBOOL(simple), 0); }
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
3
CPP/Windows/Control/StdAfx.h
Executable file → Normal file
3
CPP/Windows/Control/StdAfx.h
Executable file → Normal file
@@ -3,7 +3,6 @@
|
||||
#ifndef __STDAFX_H
|
||||
#define __STDAFX_H
|
||||
|
||||
#include "../../Common/MyWindows.h"
|
||||
#include "../../Common/NewHandler.h"
|
||||
#include "../../Common/Common.h"
|
||||
|
||||
#endif
|
||||
|
||||
2
CPP/Windows/Control/ToolBar.h
Executable file → Normal file
2
CPP/Windows/Control/ToolBar.h
Executable file → Normal file
@@ -3,7 +3,7 @@
|
||||
#ifndef __WINDOWS_CONTROL_TOOLBAR_H
|
||||
#define __WINDOWS_CONTROL_TOOLBAR_H
|
||||
|
||||
#include "Windows/Window.h"
|
||||
#include "../Window.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
|
||||
6
CPP/Windows/Control/Trackbar.h
Executable file → Normal file
6
CPP/Windows/Control/Trackbar.h
Executable file → Normal file
@@ -3,13 +3,13 @@
|
||||
#ifndef __WINDOWS_CONTROL_TRACKBAR_H
|
||||
#define __WINDOWS_CONTROL_TRACKBAR_H
|
||||
|
||||
#include "Windows/Window.h"
|
||||
#include "Windows/Defs.h"
|
||||
#include "../Window.h"
|
||||
#include "../Defs.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
|
||||
class CTrackbar: public CWindow
|
||||
class CTrackbar1: public CWindow
|
||||
{
|
||||
public:
|
||||
void SetRange(int minimum, int maximum, bool redraw = true)
|
||||
|
||||
101
CPP/Windows/Control/Window2.cpp
Executable file → Normal file
101
CPP/Windows/Control/Window2.cpp
Executable file → Normal file
@@ -3,11 +3,11 @@
|
||||
#include "StdAfx.h"
|
||||
|
||||
#ifndef _UNICODE
|
||||
#include "Common/StringConvert.h"
|
||||
#include "../../Common/StringConvert.h"
|
||||
#endif
|
||||
#include "Windows/Control/Window2.h"
|
||||
|
||||
// extern HINSTANCE g_hInstance;
|
||||
#include "Window2.h"
|
||||
|
||||
#ifndef _UNICODE
|
||||
extern bool g_IsNT;
|
||||
#endif
|
||||
@@ -26,14 +26,12 @@ namespace NControl {
|
||||
#define MY_START_WM_CREATE WM_NCCREATE
|
||||
#endif
|
||||
|
||||
static LRESULT CALLBACK WindowProcedure(HWND aHWND, UINT message,
|
||||
WPARAM wParam, LPARAM lParam)
|
||||
static LRESULT CALLBACK WindowProcedure(HWND aHWND, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
CWindow tempWindow(aHWND);
|
||||
if (message == MY_START_WM_CREATE)
|
||||
tempWindow.SetUserDataLongPtr(
|
||||
LONG_PTR(((LPCREATESTRUCT)lParam)->lpCreateParams));
|
||||
CWindow2 *window = (CWindow2*)(tempWindow.GetUserDataLongPtr());
|
||||
tempWindow.SetUserDataLongPtr((LONG_PTR)(((LPCREATESTRUCT)lParam)->lpCreateParams));
|
||||
CWindow2 *window = (CWindow2 *)(tempWindow.GetUserDataLongPtr());
|
||||
if (window != NULL && message == MY_START_WM_CREATE)
|
||||
window->Attach(aHWND);
|
||||
if (window == 0)
|
||||
@@ -48,48 +46,42 @@ static LRESULT CALLBACK WindowProcedure(HWND aHWND, UINT message,
|
||||
return window->OnMessage(message, wParam, lParam);
|
||||
}
|
||||
|
||||
bool CWindow2::CreateEx(DWORD exStyle, LPCTSTR className,
|
||||
LPCTSTR windowName, DWORD style,
|
||||
int x, int y, int width, int height,
|
||||
HWND parentWindow, HMENU idOrHMenu,
|
||||
HINSTANCE instance)
|
||||
bool CWindow2::CreateEx(DWORD exStyle, LPCTSTR className, LPCTSTR windowName,
|
||||
DWORD style, int x, int y, int width, int height,
|
||||
HWND parentWindow, HMENU idOrHMenu, HINSTANCE instance)
|
||||
{
|
||||
WNDCLASS windowClass;
|
||||
if (!::GetClassInfo(instance, className, &windowClass))
|
||||
WNDCLASS wc;
|
||||
if (!::GetClassInfo(instance, className, &wc))
|
||||
{
|
||||
// windowClass.style = CS_HREDRAW | CS_VREDRAW;
|
||||
windowClass.style = 0;
|
||||
|
||||
windowClass.lpfnWndProc = WindowProcedure;
|
||||
windowClass.cbClsExtra = NULL;
|
||||
windowClass.cbWndExtra = NULL;
|
||||
windowClass.hInstance = instance;
|
||||
windowClass.hIcon = NULL;
|
||||
windowClass.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
windowClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
||||
windowClass.lpszMenuName = NULL;
|
||||
windowClass.lpszClassName = className;
|
||||
if (::RegisterClass(&windowClass) == 0)
|
||||
// wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.style = 0;
|
||||
wc.lpfnWndProc = WindowProcedure;
|
||||
wc.cbClsExtra = NULL;
|
||||
wc.cbWndExtra = NULL;
|
||||
wc.hInstance = instance;
|
||||
wc.hIcon = NULL;
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
||||
wc.lpszMenuName = NULL;
|
||||
wc.lpszClassName = className;
|
||||
if (::RegisterClass(&wc) == 0)
|
||||
return false;
|
||||
}
|
||||
return CWindow::CreateEx(exStyle, className, windowName,
|
||||
style, x, y, width, height, parentWindow,
|
||||
idOrHMenu, instance, this);
|
||||
return CWindow::CreateEx(exStyle, className, windowName, style,
|
||||
x, y, width, height, parentWindow, idOrHMenu, instance, this);
|
||||
}
|
||||
|
||||
#ifndef _UNICODE
|
||||
|
||||
bool CWindow2::CreateEx(DWORD exStyle, LPCWSTR className,
|
||||
LPCWSTR windowName, DWORD style,
|
||||
int x, int y, int width, int height,
|
||||
HWND parentWindow, HMENU idOrHMenu,
|
||||
HINSTANCE instance)
|
||||
bool CWindow2::CreateEx(DWORD exStyle, LPCWSTR className, LPCWSTR windowName,
|
||||
DWORD style, int x, int y, int width, int height,
|
||||
HWND parentWindow, HMENU idOrHMenu, HINSTANCE instance)
|
||||
{
|
||||
bool needRegister;
|
||||
if (g_IsNT)
|
||||
{
|
||||
WNDCLASSW windowClass;
|
||||
needRegister = ::GetClassInfoW(instance, className, &windowClass) == 0;
|
||||
WNDCLASSW wc;
|
||||
needRegister = ::GetClassInfoW(instance, className, &wc) == 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -107,26 +99,25 @@ bool CWindow2::CreateEx(DWORD exStyle, LPCWSTR className,
|
||||
}
|
||||
if (needRegister)
|
||||
{
|
||||
WNDCLASSW windowClass;
|
||||
// windowClass.style = CS_HREDRAW | CS_VREDRAW;
|
||||
windowClass.style = 0;
|
||||
windowClass.lpfnWndProc = WindowProcedure;
|
||||
windowClass.cbClsExtra = NULL;
|
||||
windowClass.cbWndExtra = NULL;
|
||||
windowClass.hInstance = instance;
|
||||
windowClass.hIcon = NULL;
|
||||
windowClass.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
windowClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
||||
windowClass.lpszMenuName = NULL;
|
||||
windowClass.lpszClassName = className;
|
||||
if (MyRegisterClass(&windowClass) == 0)
|
||||
WNDCLASSW wc;
|
||||
// wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.style = 0;
|
||||
wc.lpfnWndProc = WindowProcedure;
|
||||
wc.cbClsExtra = NULL;
|
||||
wc.cbWndExtra = NULL;
|
||||
wc.hInstance = instance;
|
||||
wc.hIcon = NULL;
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
||||
wc.lpszMenuName = NULL;
|
||||
wc.lpszClassName = className;
|
||||
if (MyRegisterClass(&wc) == 0)
|
||||
return false;
|
||||
}
|
||||
return CWindow::CreateEx(exStyle, className, windowName,
|
||||
style, x, y, width, height, parentWindow,
|
||||
idOrHMenu, instance, this);
|
||||
|
||||
return CWindow::CreateEx(exStyle, className, windowName, style,
|
||||
x, y, width, height, parentWindow, idOrHMenu, instance, this);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
LRESULT CWindow2::DefProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
25
CPP/Windows/Control/Window2.h
Executable file → Normal file
25
CPP/Windows/Control/Window2.h
Executable file → Normal file
@@ -3,7 +3,7 @@
|
||||
#ifndef __WINDOWS_CONTROL_WINDOW2_H
|
||||
#define __WINDOWS_CONTROL_WINDOW2_H
|
||||
|
||||
#include "Windows/Window.h"
|
||||
#include "../Window.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
@@ -15,19 +15,14 @@ public:
|
||||
CWindow2(HWND newWindow = NULL): CWindow(newWindow){};
|
||||
virtual ~CWindow2() {};
|
||||
|
||||
|
||||
bool CreateEx(DWORD exStyle, LPCTSTR className,
|
||||
LPCTSTR windowName, DWORD style,
|
||||
int x, int y, int width, int height,
|
||||
HWND parentWindow, HMENU idOrHMenu,
|
||||
HINSTANCE instance);
|
||||
bool CreateEx(DWORD exStyle, LPCTSTR className, LPCTSTR windowName,
|
||||
DWORD style, int x, int y, int width, int height,
|
||||
HWND parentWindow, HMENU idOrHMenu, HINSTANCE instance);
|
||||
|
||||
#ifndef _UNICODE
|
||||
bool CreateEx(DWORD exStyle, LPCWSTR className,
|
||||
LPCWSTR windowName, DWORD style,
|
||||
int x, int y, int width, int height,
|
||||
HWND parentWindow, HMENU idOrHMenu,
|
||||
HINSTANCE instance);
|
||||
bool CreateEx(DWORD exStyle, LPCWSTR className, LPCWSTR windowName,
|
||||
DWORD style, int x, int y, int width, int height,
|
||||
HWND parentWindow, HMENU idOrHMenu, HINSTANCE instance);
|
||||
#endif
|
||||
|
||||
virtual LRESULT OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
@@ -47,10 +42,8 @@ public:
|
||||
virtual void OnCancel() {};
|
||||
*/
|
||||
|
||||
LONG_PTR SetMsgResult(LONG_PTR newLongPtr )
|
||||
{ return SetLongPtr(DWLP_MSGRESULT, newLongPtr); }
|
||||
LONG_PTR GetMsgResult() const
|
||||
{ return GetLongPtr(DWLP_MSGRESULT); }
|
||||
LONG_PTR SetMsgResult(LONG_PTR newLongPtr) { return SetLongPtr(DWLP_MSGRESULT, newLongPtr); }
|
||||
LONG_PTR GetMsgResult() const { return GetLongPtr(DWLP_MSGRESULT); }
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user