--- trunk/reactos/base/applications/imagesoft/paint.c 2006-02-14 17:39:13 UTC (rev 113)
+++ trunk/reactos/base/applications/imagesoft/paint.c 2006-02-15 17:58:49 UTC (rev 114)
@@ -1,12 +1,3 @@
-/*
- * PROJECT: ReactOS Services
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: base/system/servman/servman.c
- * PURPOSE: Main window message handler
- * COPYRIGHT: Copyright 2005 - 2006 Ged Murphy <gedmurphy@gmail.com>
- *
- */
-
#include "paint.h"
#define ID_MDI_FIRSTCHILD 50000
@@ -20,39 +11,46 @@
HWND hMDIClient;
HWND hStatus;
HWND hTool;
+HWND hwndRebar;
HMENU hShortcutMenu;
+/*
+ * Initialize the structure and send a message to the MDI
+ * frame requesting a new new child window.
+ */
HWND CreateNewMDIChild(HWND hMDIClient)
{
- MDICREATESTRUCT mcs;
- HWND hChild;
- TCHAR Buf[15];
- static DWORD MDINum = 1;
+ MDICREATESTRUCT mcs;
+ HWND hChild;
+ TCHAR Buf[15];
+ static DWORD MDINum = 1;
- _sntprintf(Buf, sizeof(Buf) / sizeof(TCHAR), _T("Untitled%d"), MDINum);
+ _sntprintf(Buf, sizeof(Buf) / sizeof(TCHAR), _T("Untitled%d"), MDINum);
- mcs.szTitle = Buf;
- mcs.szClass = ChildClassName;
- mcs.hOwner = hInstance;
- mcs.x = mcs.cx = CW_USEDEFAULT;
- mcs.y = mcs.cy = CW_USEDEFAULT;
- mcs.style = MDIS_ALLCHILDSTYLES;
+ mcs.szTitle = Buf;
+ mcs.szClass = ChildClassName;
+ mcs.hOwner = hInstance;
+ mcs.x = mcs.cx = CW_USEDEFAULT;
+ mcs.y = mcs.cy = CW_USEDEFAULT;
+ mcs.style = MDIS_ALLCHILDSTYLES;
- hChild = (HWND)SendMessage(hMDIClient, WM_MDICREATE, 0, (LONG)&mcs);
- if(!hChild)
- {
- MessageBox(hMDIClient, _T("MDI Child creation failed."), _T("Error!"),
- MB_ICONEXCLAMATION | MB_OK);
+ hChild = (HWND)SendMessage(hMDIClient, WM_MDICREATE, 0, (LONG)&mcs);
+ if(!hChild)
+ {
+ MessageBox(hMDIClient, _T("MDI Child creation failed."), _T("Error!"),
+ MB_ICONEXCLAMATION | MB_OK);
return hChild;
- }
+ }
- MDINum++;
- return hChild;
+ MDINum++;
+ return hChild;
}
-
+/*
+ * Main program message handler
+ */
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
@@ -70,28 +68,28 @@
{ /* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString */
{STD_FILENEW, ID_NEW, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0}, 0, 0}, /* new */
{STD_FILEOPEN, ID_OPEN, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* open */
- {STD_FILESAVE, ID_SAVE, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* save */
+ {STD_FILESAVE, ID_SAVE, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0}, /* save */
/* Note: First item for a seperator is its width in pixels */
{10, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */
- {STD_PRINTPRE, ID_PRINTPRE, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* print */
- {STD_PRINT, ID_PRINT, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* print preview */
+ {STD_PRINTPRE, ID_PRINTPRE, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* print */
+ {STD_PRINT, ID_PRINT, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* print preview */
{10, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */
- {STD_CUT, ID_CUT, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* cut */
- {STD_COPY, ID_COPY, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* copy */
- {STD_PASTE, ID_PASTE, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* paste */
+ {STD_CUT, ID_CUT, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* cut */
+ {STD_COPY, ID_COPY, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* copy */
+ {STD_PASTE, ID_PASTE, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* paste */
{10, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */
- {STD_UNDO, ID_UNDO, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* undo */
- {STD_REDOW, ID_REDO, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* redo */
+ {STD_UNDO, ID_UNDO, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* undo */
+ {STD_REDOW, ID_REDO, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* redo */
};
-/* ======================== Create Toolbar ============================== */
+/* ======================== Create Std Toolbar ============================== */
/* Create Toolbar */
hTool = CreateWindowEx(0,
@@ -132,6 +130,11 @@
+/* ======================== Create Floating Toolbar ============================== */
+
+
+
+
/* ======================== Create Status Bar ============================== */
hStatus = CreateWindowEx(0,
@@ -144,10 +147,10 @@
hInstance,
NULL);
if(hStatus == NULL)
- MessageBox(hwnd, _T("Could not create status bar."),
+ MessageBox(hwnd, _T("Could not create status bar."),
_T("Error!"), MB_OK | MB_ICONERROR);
- SendMessage(hStatus, SB_SETPARTS, sizeof(statwidths)/sizeof(int), (LPARAM)statwidths);
+ SendMessage(hStatus, SB_SETPARTS, sizeof(statwidths)/sizeof(int), (LPARAM)statwidths);
/* ======================== Create Popup Menu ============================== */
@@ -158,73 +161,78 @@
/* ======================= Create MDI Client ============================= */
- /* Find window menu where children will be listed */
- ccs.hWindowMenu = GetSubMenu(GetMenu(hwnd), 3);
- ccs.idFirstChild = ID_MDI_FIRSTCHILD;
+ /* Find window menu where children will be listed */
+ ccs.hWindowMenu = GetSubMenu(GetMenu(hwnd), 4);
+ ccs.idFirstChild = ID_MDI_FIRSTCHILD;
- hMDIClient = CreateWindowEx(WS_EX_CLIENTEDGE,
- _T("mdiclient"),
- NULL,
- WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL | WS_VISIBLE,
- CW_USEDEFAULT,
- CW_USEDEFAULT,
- CW_USEDEFAULT,
- CW_USEDEFAULT,
- hwnd,
- (HMENU)IDC_MAIN_MDI,
- GetModuleHandle(NULL),
- (LPVOID)&ccs);
+ hMDIClient = CreateWindowEx(WS_EX_CLIENTEDGE,
+ _T("mdiclient"),
+ NULL,
+ WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL | WS_VISIBLE,
+ CW_USEDEFAULT,
+ CW_USEDEFAULT,
+ CW_USEDEFAULT,
+ CW_USEDEFAULT,
+ hwnd,
+ (HMENU)IDC_MAIN_MDI,
+ GetModuleHandle(NULL),
+ (LPVOID)&ccs);
- if(hMDIClient == NULL)
- MessageBox(hwnd, _T("Could not create MDI client."),
- _T("Error!"), MB_OK | MB_ICONERROR);
+ if(hMDIClient == NULL)
+ MessageBox(hwnd, _T("Could not create MDI client."),
+ _T("Error!"), MB_OK | MB_ICONERROR);
+/* ======================= Miscelaneous ============================= */
+
/* indicate program is ready in the status bar */
LoadString(hInstance, IDS_READY, Buf, sizeof(Buf) / sizeof(TCHAR));
SendMessage(hStatus, SB_SETTEXT, 0, (LPARAM)Buf);
+ /* inilalize file open/save structure */
+ FileInitialize(hwnd);
+
}
break;
case WM_SIZE:
{
- RECT rcTool;
- int iToolHeight;
+ RECT rcTool;
+ int iToolHeight;
- RECT rcStatus;
- int iStatusHeight;
+ RECT rcStatus;
+ int iStatusHeight;
- HWND hMDI;
- int iMDIHeight;
- RECT rcClient;
+ HWND hMDI;
+ int iMDIHeight;
+ RECT rcClient;
- /* Size toolbar and get height */
+ /* Size toolbar and get height */
hTool = GetDlgItem(hwnd, IDC_TOOLBAR);
- SendMessage(hTool, TB_AUTOSIZE, 0, 0);
+ SendMessage(hTool, TB_AUTOSIZE, 0, 0);
- GetWindowRect(hTool, &rcTool);
- iToolHeight = rcTool.bottom - rcTool.top;
+ GetWindowRect(hTool, &rcTool);
+ iToolHeight = rcTool.bottom - rcTool.top;
- /* Size status bar and get height */
- hStatus = GetDlgItem(hwnd, IDC_STATUSBAR);
- SendMessage(hStatus, WM_SIZE, 0, 0);
+ /* Size status bar and get height */
+ hStatus = GetDlgItem(hwnd, IDC_STATUSBAR);
+ SendMessage(hStatus, WM_SIZE, 0, 0);
- GetWindowRect(hStatus, &rcStatus);
- iStatusHeight = rcStatus.bottom - rcStatus.top;
+ GetWindowRect(hStatus, &rcStatus);
+ iStatusHeight = rcStatus.bottom - rcStatus.top;
- /* Calculate remaining height and size list view */
- GetClientRect(hwnd, &rcClient);
+ /* Calculate remaining height and size for the MDI frame */
+ GetClientRect(hwnd, &rcClient);
- iMDIHeight = rcClient.bottom - iToolHeight - iStatusHeight;
+ iMDIHeight = rcClient.bottom - iToolHeight - iStatusHeight;
- hMDI = GetDlgItem(hwnd, IDC_MAIN_MDI);
- SetWindowPos(hMDIClient, NULL, 0, iToolHeight, rcClient.right, iMDIHeight, SWP_NOZORDER);
- }
- break;
+ hMDI = GetDlgItem(hwnd, IDC_MAIN_MDI);
+ SetWindowPos(hMDIClient, NULL, 0, iToolHeight, rcClient.right, iMDIHeight, SWP_NOZORDER);
+ }
+ break;
- case WM_NOTIFY:
+ case WM_NOTIFY:
{
NMHDR* nm = (NMHDR*) lParam;
@@ -243,43 +251,43 @@
switch (idButton)
{
case ID_NEW:
- lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_PROP);
+ lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_NEW);
break;
case ID_OPEN:
- lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_REFRESH);
+ lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_OPEN);
break;
case ID_SAVE:
- lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_EXPORT);
+ lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_SAVE);
break;
case ID_PRINTPRE:
- lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_NEW);
+ lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_PRINTPRE);
break;
case ID_PRINT:
- lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_START);
+ lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_PRINT);
break;
case ID_CUT:
- lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_STOP);
+ lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_CUT);
break;
case ID_COPY:
- lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_PAUSE);
+ lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_COPY);
break;
case ID_PASTE:
- lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_RESTART);
+ lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_PASTE);
break;
case ID_UNDO:
- lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_HELP);
+ lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_UNDO);
break;
case ID_REDO:
- lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_EXIT);
+ lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_REDO);
break;
}
@@ -306,25 +314,67 @@
case WM_COMMAND:
- switch(LOWORD(wParam))
- {
- case ID_NEW:
- CreateNewMDIChild(hMDIClient);
- break;
+ switch(LOWORD(wParam))
+ {
+ case ID_NEW:
+ CreateNewMDIChild(hMDIClient);
+ break;
- case ID_REFRESH:
+ case ID_OPEN:
+ DoOpenFile(hwnd);
break;
-
- case ID_HELP:
- MessageBox(NULL, _T("Help is not yet implemented\n"),
- _T("Note!"), MB_OK | MB_ICONINFORMATION);
+ case ID_SAVEAS:
+ DoSaveFile(hwnd);
break;
+ case ID_CLOSE:
+ {
+ /* close the active child window */
+ HWND hChild = (HWND)SendMessage(hMDIClient, WM_MDIGETACTIVE,0,0);
+ if(hChild)
+ {
+ SendMessage(hChild, WM_CLOSE, 0, 0);
+ }
+ }
+ break;
+
+ case ID_CLOSEALL:
+ {
+ HWND hChild;
+ /* loop until all windows have been closed */
+ while ((hChild = (HWND)SendMessage(hMDIClient, WM_MDIGETACTIVE,0,0)) != NULL)
+ {
+ SendMessage(hChild, WM_CLOSE, 0, 0);
+ }
+ }
+ break;
+
case ID_EXIT:
PostMessage(hwnd, WM_CLOSE, 0, 0);
break;
+ case ID_EDITCOLOURS:
+ {
+ /* open up the colour selection dialog */
+
+ static CHOOSECOLOR cc;
+ static COLORREF crCustColors[16];
+
+ cc.lStructSize = sizeof(CHOOSECOLOR);
+ cc.hwndOwner = hwnd;
+ cc.hInstance = NULL;
+ cc.rgbResult = RGB(0x80, 0x80, 0x80);
+ cc.lpCustColors = crCustColors;
+ cc.Flags = CC_RGBINIT | CC_FULLOPEN;
+ cc.lCustData = 0;
+ cc.lpfnHook = NULL;
+ cc.lpTemplateName = NULL;
+
+ ChooseColor(&cc);
+ }
+ break;
+
case ID_WINDOW_TILE:
SendMessage(hMDIClient, WM_MDITILE, 0, 0);
break;
@@ -340,67 +390,50 @@
(DLGPROC)AboutDialogProc);
break;
- default:
- {
- if(LOWORD(wParam) >= ID_MDI_FIRSTCHILD)
- {
- DefFrameProc(hwnd, hMDIClient, WM_COMMAND, wParam, lParam);
- }
- else
- {
- HWND hChild = (HWND)SendMessage(hMDIClient, WM_MDIGETACTIVE,0,0);
- if(hChild)
- {
- SendMessage(hChild, WM_COMMAND, wParam, lParam);
- }
- }
- }
+ default:
+ /* Catch all commands that I didn't process directly and do
+ * a check to see if the value is greater than or equal to
+ * ID_MDI_FIRSTCHILD. If it is, then the user has clicked
+ * on one of the Window menu items and we send the message
+ * on to DefFrameProc() for processing.
+ */
+ if(LOWORD(wParam) >= ID_MDI_FIRSTCHILD)
+ DefFrameProc(hwnd, hMDIClient, WM_COMMAND, wParam, lParam);
+ else
+ {
+ HWND hChild = (HWND)SendMessage(hMDIClient, WM_MDIGETACTIVE,0,0);
+ if(hChild)
+ SendMessage(hChild, WM_COMMAND, wParam, lParam);
+ }
}
break;
- case WM_CLOSE:
+ case WM_CLOSE:
DestroyMenu(hShortcutMenu);
- DestroyWindow(hwnd);
- break;
+ DestroyWindow(hwnd);
+ break;
- case WM_DESTROY:
- PostQuitMessage(0);
- break;
+ case WM_DESTROY:
+ PostQuitMessage(0);
+ break;
- default:
- return DefFrameProc(hwnd, hMDIClient, msg, wParam, lParam);
+ default:
+ return DefFrameProc(hwnd, hMDIClient, msg, wParam, lParam);
}
return 0;
}
-void GetLargestDisplayMode(int *pcxBitmap, int *pcyBitmap)
-{
- DEVMODE devmode;
- int iModeNum = 0;
-
- *pcxBitmap = *pcyBitmap = 0;
-
- ZeroMemory(&devmode, sizeof(DEVMODE));
- devmode.dmSize = sizeof(DEVMODE);
-
- while (EnumDisplaySettings (NULL, iModeNum++, &devmode))
- {
- *pcxBitmap = max (*pcxBitmap, (int) devmode.dmPelsWidth);
- *pcyBitmap = max (*pcyBitmap, (int) devmode.dmPelsHeight);
- }
-}
-
-
-
+/*
+ * MDI child window message handler
+ */
LRESULT CALLBACK MDIChildWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- static BOOL fLeftButtonDown, fRightButtonDown ;
- static HBITMAP hBitmap;
- static HDC hdcMem;
- static int cxBitmap, cyBitmap, cxClient, cyClient, xMouse, yMouse;
- HDC hdc;
- PAINTSTRUCT ps;
+ static BOOL fLeftButtonDown, fRightButtonDown;
+ static HDC hdcMem;
+ static INT cxClient, cyClient, xMouse, yMouse;
+ HDC hdc;
+ PAINTSTRUCT ps;
switch(msg)
{
@@ -428,16 +461,20 @@
SendMessage(hStatus, SB_SETTEXT, 0, (LPARAM)Buf);
}
- EnableMenuItem(hMenu, 1, MF_BYPOSITION | EnableFlag);
- EnableMenuItem(hMenu, 2, MF_BYPOSITION | EnableFlag);
- EnableMenuItem(hMenu, 3, MF_BYPOSITION | EnableFlag);
+ EnableMenuItem(hMenu, 1, MF_BYPOSITION | EnableFlag); /* edit */
+ EnableMenuItem(hMenu, 2, MF_BYPOSITION | EnableFlag); /* image */
+ EnableMenuItem(hMenu, 3, MF_BYPOSITION | EnableFlag); /* colours */
+ EnableMenuItem(hMenu, 4, MF_BYPOSITION | EnableFlag); /* window */
hFileMenu = GetSubMenu(hMenu, 0);
-// EnableMenuItem(hFileMenu, ID_FILE_SAVEAS, MF_BYCOMMAND | EnableFlag);
+ EnableMenuItem(hFileMenu, ID_SAVEAS, MF_BYCOMMAND | EnableFlag);
-// EnableMenuItem(hFileMenu, ID_FILE_CLOSE, MF_BYCOMMAND | EnableFlag);
-// EnableMenuItem(hFileMenu, ID_FILE_CLOSEALL, MF_BYCOMMAND | EnableFlag);
+ EnableMenuItem(hFileMenu, ID_CLOSE, MF_BYCOMMAND | EnableFlag);
+ EnableMenuItem(hFileMenu, ID_CLOSEALL, MF_BYCOMMAND | EnableFlag);
+ SendMessage(hTool, TB_SETSTATE, ID_COPY,
+ (LPARAM)MAKELONG(TBSTATE_ENABLED, 0));
+
DrawMenuBar(hMainWnd);
}
break;
@@ -523,21 +560,7 @@
case WM_COMMAND:
switch(LOWORD(wParam))
{
-/* case ID_OPEN:
- DoFileOpen(hwnd);
- break;
- case ID_SAVEAS:
- DoFileSave(hwnd);
- break;
- case ID_CUT:
- SendDlgItemMessage(hwnd, IDC_CHILD_EDIT, WM_CUT, 0, 0);
- break;
- case ID_COPY:
- SendDlgItemMessage(hwnd, IDC_CHILD_EDIT, WM_COPY, 0, 0);
- break;
- case ID_PASTE:
- SendDlgItemMessage(hwnd, IDC_CHILD_EDIT, WM_PASTE, 0, 0);
-*/ break;
+
}
break;
@@ -545,38 +568,49 @@
return DefMDIChildProc(hwnd, msg, wParam, lParam);
default:
+ {
+ TCHAR Buf[6];
+
+ /* indicate program is ready in the status bar */
+ LoadString(hInstance, IDS_READY, Buf, sizeof(Buf) / sizeof(TCHAR));
+ SendMessage(hStatus, SB_SETTEXT, 0, (LPARAM)Buf);
+
return DefMDIChildProc(hwnd, msg, wParam, lParam);
+ }
}
return 0;
}
-
+/*
+ * Register the MDI child window class
+ */
BOOL SetUpMDIChildWindowClass(HINSTANCE hInstance)
{
WNDCLASSEX wc;
- wc.cbSize = sizeof(WNDCLASSEX);
- wc.style = CS_HREDRAW | CS_VREDRAW;
- wc.lpfnWndProc = MDIChildWndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = hInstance;
- wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
- wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
- wc.lpszMenuName = NULL;
- wc.lpszClassName = ChildClassName;
- wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
+ wc.cbSize = sizeof(WNDCLASSEX);
+ wc.style = CS_HREDRAW | CS_VREDRAW;
+ wc.lpfnWndProc = MDIChildWndProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = hInstance;
+ wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
+ wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = ChildClassName;
+ wc.hIconSm = (HICON)LoadImage(hInstance,
+ MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON, 16, 16, 0);
- if(!RegisterClassEx(&wc))
- {
- MessageBox(0, _T("Could Not Register Child Window"), _T("Error!"),
- MB_ICONEXCLAMATION | MB_OK);
- return FALSE;
- }
- else
- return TRUE;
+ if(!RegisterClassEx(&wc))
+ {
+ MessageBox(0, _T("Could Not Register Child Window"), _T("Error!"),
+ MB_ICONEXCLAMATION | MB_OK);
+ return FALSE;
+ }
+ else
+ return TRUE;
}
#ifdef _MSC_VER
@@ -587,10 +621,13 @@
{
WNDCLASSEX wc;
MSG Msg;
+ INITCOMMONCONTROLSEX icex;
hInstance = hThisInstance;
- InitCommonControls();
+ icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
+ icex.dwICC = ICC_BAR_CLASSES;
+ InitCommonControlsEx(&icex);
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = 0;
@@ -616,19 +653,18 @@
if(!SetUpMDIChildWindowClass(hInstance))
return 0;
- hMainWnd = CreateWindowEx(
- 0,
- AppClassName,
- _T("ImageSoft"),
- WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
- CW_USEDEFAULT, CW_USEDEFAULT, 800, 600,
- NULL, NULL, hInstance, NULL);
+ hMainWnd = CreateWindowEx(0,
+ AppClassName,
+ _T("ImageSoft"),
+ WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
+ CW_USEDEFAULT, CW_USEDEFAULT, 800, 600,
+ NULL, NULL, hInstance, NULL);
if(hMainWnd == NULL)
{
- MessageBox(NULL, _T("Window Creation Failed!"), _T("Error!"),
- MB_ICONEXCLAMATION | MB_OK);
- return 0;
+ MessageBox(NULL, _T("Window Creation Failed!"), _T("Error!"),
+ MB_ICONEXCLAMATION | MB_OK);
+ return 0;
}
ShowWindow(hMainWnd, nCmdShow);