Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pavlov <ipavlov@users.sourceforge.net>2014-11-23 03:00:00 +0300
committerKornel LesiƄski <kornel@geekhood.net>2016-05-28 02:16:51 +0300
commitf08f4dcc3c02464c17753b3feafcfe5243b9e236 (patch)
treeb0e1b15bc5368d92dff422e8ec0818564a2b00b8 /CPP/Windows/Control
parent83f8ddcc5b2161e1e3c49666265257fca8aeb12c (diff)
9.349.34
Diffstat (limited to 'CPP/Windows/Control')
-rw-r--r--[-rwxr-xr-x]CPP/Windows/Control/ComboBox.cpp6
-rw-r--r--[-rwxr-xr-x]CPP/Windows/Control/ComboBox.h2
-rw-r--r--[-rwxr-xr-x]CPP/Windows/Control/CommandBar.h4
-rw-r--r--[-rwxr-xr-x]CPP/Windows/Control/Dialog.cpp52
-rw-r--r--[-rwxr-xr-x]CPP/Windows/Control/Dialog.h58
-rw-r--r--[-rwxr-xr-x]CPP/Windows/Control/Edit.h2
-rw-r--r--[-rwxr-xr-x]CPP/Windows/Control/ImageList.cpp0
-rw-r--r--[-rwxr-xr-x]CPP/Windows/Control/ImageList.h2
-rw-r--r--[-rwxr-xr-x]CPP/Windows/Control/ListView.cpp2
-rw-r--r--[-rwxr-xr-x]CPP/Windows/Control/ListView.h2
-rw-r--r--[-rwxr-xr-x]CPP/Windows/Control/ProgressBar.h0
-rw-r--r--[-rwxr-xr-x]CPP/Windows/Control/PropertyPage.cpp5
-rw-r--r--[-rwxr-xr-x]CPP/Windows/Control/PropertyPage.h0
-rw-r--r--[-rwxr-xr-x]CPP/Windows/Control/ReBar.h7
-rw-r--r--[-rwxr-xr-x]CPP/Windows/Control/Static.h0
-rw-r--r--[-rwxr-xr-x]CPP/Windows/Control/StatusBar.h21
-rw-r--r--[-rwxr-xr-x]CPP/Windows/Control/StdAfx.h3
-rw-r--r--[-rwxr-xr-x]CPP/Windows/Control/ToolBar.h2
-rw-r--r--[-rwxr-xr-x]CPP/Windows/Control/Trackbar.h6
-rw-r--r--[-rwxr-xr-x]CPP/Windows/Control/Window2.cpp101
-rw-r--r--[-rwxr-xr-x]CPP/Windows/Control/Window2.h25
21 files changed, 148 insertions, 152 deletions
diff --git a/CPP/Windows/Control/ComboBox.cpp b/CPP/Windows/Control/ComboBox.cpp
index 40d2f865..9b458fe4 100755..100644
--- a/CPP/Windows/Control/ComboBox.cpp
+++ b/CPP/Windows/Control/ComboBox.cpp
@@ -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
diff --git a/CPP/Windows/Control/ComboBox.h b/CPP/Windows/Control/ComboBox.h
index aa0eb930..8c6fd381 100755..100644
--- a/CPP/Windows/Control/ComboBox.h
+++ b/CPP/Windows/Control/ComboBox.h
@@ -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); }
};
diff --git a/CPP/Windows/Control/CommandBar.h b/CPP/Windows/Control/CommandBar.h
index 387c5e2d..780211ec 100755..100644
--- a/CPP/Windows/Control/CommandBar.h
+++ b/CPP/Windows/Control/CommandBar.h
@@ -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); }
diff --git a/CPP/Windows/Control/Dialog.cpp b/CPP/Windows/Control/Dialog.cpp
index 2695ca54..01bc7d43 100755..100644
--- a/CPP/Windows/Control/Dialog.cpp
+++ b/CPP/Windows/Control/Dialog.cpp
@@ -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;
diff --git a/CPP/Windows/Control/Dialog.h b/CPP/Windows/Control/Dialog.h
index 2b5147e7..b450266b 100755..100644
--- a/CPP/Windows/Control/Dialog.h
+++ b/CPP/Windows/Control/Dialog.h
@@ -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();
diff --git a/CPP/Windows/Control/Edit.h b/CPP/Windows/Control/Edit.h
index c4bf5704..17ac9f13 100755..100644
--- a/CPP/Windows/Control/Edit.h
+++ b/CPP/Windows/Control/Edit.h
@@ -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 {
diff --git a/CPP/Windows/Control/ImageList.cpp b/CPP/Windows/Control/ImageList.cpp
index 16a46fa4..16a46fa4 100755..100644
--- a/CPP/Windows/Control/ImageList.cpp
+++ b/CPP/Windows/Control/ImageList.cpp
diff --git a/CPP/Windows/Control/ImageList.h b/CPP/Windows/Control/ImageList.h
index 127cd1ed..72094399 100755..100644
--- a/CPP/Windows/Control/ImageList.h
+++ b/CPP/Windows/Control/ImageList.h
@@ -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 {
diff --git a/CPP/Windows/Control/ListView.cpp b/CPP/Windows/Control/ListView.cpp
index 255a17c5..6d916591 100755..100644
--- a/CPP/Windows/Control/ListView.cpp
+++ b/CPP/Windows/Control/ListView.cpp
@@ -2,7 +2,7 @@
#include "StdAfx.h"
-#include "Windows/Control/ListView.h"
+#include "ListView.h"
#ifndef _UNICODE
extern bool g_IsNT;
diff --git a/CPP/Windows/Control/ListView.h b/CPP/Windows/Control/ListView.h
index bebcd9e2..ceb297f8 100755..100644
--- a/CPP/Windows/Control/ListView.h
+++ b/CPP/Windows/Control/ListView.h
@@ -3,7 +3,7 @@
#ifndef __WINDOWS_CONTROL_LISTVIEW_H
#define __WINDOWS_CONTROL_LISTVIEW_H
-#include "Windows/Window.h"
+#include "../Window.h"
#include <commctrl.h>
diff --git a/CPP/Windows/Control/ProgressBar.h b/CPP/Windows/Control/ProgressBar.h
index 4591880a..4591880a 100755..100644
--- a/CPP/Windows/Control/ProgressBar.h
+++ b/CPP/Windows/Control/ProgressBar.h
diff --git a/CPP/Windows/Control/PropertyPage.cpp b/CPP/Windows/Control/PropertyPage.cpp
index d7eaab17..bbac74ad 100755..100644
--- a/CPP/Windows/Control/PropertyPage.cpp
+++ b/CPP/Windows/Control/PropertyPage.cpp
@@ -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));
diff --git a/CPP/Windows/Control/PropertyPage.h b/CPP/Windows/Control/PropertyPage.h
index 4e7e088e..4e7e088e 100755..100644
--- a/CPP/Windows/Control/PropertyPage.h
+++ b/CPP/Windows/Control/PropertyPage.h
diff --git a/CPP/Windows/Control/ReBar.h b/CPP/Windows/Control/ReBar.h
index 8e11c139..bd475b10 100755..100644
--- a/CPP/Windows/Control/ReBar.h
+++ b/CPP/Windows/Control/ReBar.h
@@ -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)); }
diff --git a/CPP/Windows/Control/Static.h b/CPP/Windows/Control/Static.h
index cb3126dd..cb3126dd 100755..100644
--- a/CPP/Windows/Control/Static.h
+++ b/CPP/Windows/Control/Static.h
diff --git a/CPP/Windows/Control/StatusBar.h b/CPP/Windows/Control/StatusBar.h
index 8766188b..f3e0d3ef 100755..100644
--- a/CPP/Windows/Control/StatusBar.h
+++ b/CPP/Windows/Control/StatusBar.h
@@ -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); }
};
}}
diff --git a/CPP/Windows/Control/StdAfx.h b/CPP/Windows/Control/StdAfx.h
index ef555ec1..1cbd7fea 100755..100644
--- a/CPP/Windows/Control/StdAfx.h
+++ b/CPP/Windows/Control/StdAfx.h
@@ -3,7 +3,6 @@
#ifndef __STDAFX_H
#define __STDAFX_H
-#include "../../Common/MyWindows.h"
-#include "../../Common/NewHandler.h"
+#include "../../Common/Common.h"
#endif
diff --git a/CPP/Windows/Control/ToolBar.h b/CPP/Windows/Control/ToolBar.h
index 262184ae..d579ab7d 100755..100644
--- a/CPP/Windows/Control/ToolBar.h
+++ b/CPP/Windows/Control/ToolBar.h
@@ -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 {
diff --git a/CPP/Windows/Control/Trackbar.h b/CPP/Windows/Control/Trackbar.h
index 42dc4e40..c6d31112 100755..100644
--- a/CPP/Windows/Control/Trackbar.h
+++ b/CPP/Windows/Control/Trackbar.h
@@ -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)
diff --git a/CPP/Windows/Control/Window2.cpp b/CPP/Windows/Control/Window2.cpp
index e1299048..e6ddb6d0 100755..100644
--- a/CPP/Windows/Control/Window2.cpp
+++ b/CPP/Windows/Control/Window2.cpp
@@ -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)
diff --git a/CPP/Windows/Control/Window2.h b/CPP/Windows/Control/Window2.h
index 2af031b8..d744b3e6 100755..100644
--- a/CPP/Windows/Control/Window2.h
+++ b/CPP/Windows/Control/Window2.h
@@ -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); }
};
}}