Skip to content

Commit

Permalink
Half-fix styles
Browse files Browse the repository at this point in the history
  • Loading branch information
dz333n committed Aug 1, 2019
1 parent 2533081 commit 14ec213
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 11 deletions.
1 change: 1 addition & 0 deletions COREDLL/COREDLL.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@
<ItemGroup>
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="winuser_wcecl.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="additional.cpp" />
Expand Down
3 changes: 3 additions & 0 deletions COREDLL/COREDLL.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
<ClInclude Include="targetver.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="winuser_wcecl.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
Expand Down
62 changes: 51 additions & 11 deletions COREDLL/winuser_wcecl.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// winuser_wcecl.cpp : Windows CE/winuser.h

#include "stdafx.h"
#include "winuser_wcecl.h"

// Functions
HDC WINAPI GetDC_WCECL(HWND hwnd)
Expand Down Expand Up @@ -157,6 +159,25 @@ BOOL WINAPI EndDeferWindowPos_WCECL(HDWP hWinPosInfo)
return result;
}

DWORD CeWsExToWin(DWORD dwExStyle)
{
DWORD result = dwExStyle;

result &= ~WINCE_WS_EX_CAPTIONOKBTN;
result &= ~WINCE_WS_EX_NODRAG;
result &= ~WINCE_WS_EX_ABOVESTARTUP;
result &= ~WINCE_WS_EX_INK;
result &= ~WINCE_WS_EX_NOANIMATION;

return result;
}

DWORD CeWsToWin(DWORD dwStyle)
{
DWORD result = dwStyle;
return result;
}

HWND WINAPI CreateWindowExW_WCECL(
DWORD dwExStyle,
LPCWSTR lpClassName,
Expand All @@ -171,11 +192,14 @@ HWND WINAPI CreateWindowExW_WCECL(
HINSTANCE hInstance,
LPVOID lpParam)
{
DWORD ex = CeWsExToWin(dwExStyle);
DWORD style = CeWsToWin(dwStyle);

auto result = ::CreateWindowExW(
/*dwExStyle probably invalid*/ 0,
ex,
lpClassName,
lpWindowName,
/*dwStyle invalid*/ WS_OVERLAPPEDWINDOW,
style,
X,
Y,
nWidth,
Expand Down Expand Up @@ -231,17 +255,12 @@ DefWindowProcW_WCECL(
return result;
}

LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
return DefWindowProc(hWnd, msg, wParam, lParam);
}

ATOM WINAPI RegisterClassW_WCECL(CONST WNDCLASSW_WCECL *lpWndClass)
{
WNDCLASSW wndClass = { };

wndClass.style = 0;// lpWndClass->style; // may be different, review!
wndClass.lpfnWndProc = lpWndClass->lpfnWndProc; (WNDPROC)WndProc; // TEMPORARY -- FIXME -- CreateWindowEx fails with correct WndProc
wndClass.style = lpWndClass->style; // may be different, review!
wndClass.lpfnWndProc = lpWndClass->lpfnWndProc; // (WNDPROC)WndProc; // TEMPORARY -- FIXME -- CreateWindowEx fails with correct WndProc
wndClass.cbClsExtra = lpWndClass->cbClsExtra;
wndClass.cbWndExtra = lpWndClass->cbWndExtra;
wndClass.hInstance = lpWndClass->hInstance;
Expand All @@ -251,7 +270,7 @@ ATOM WINAPI RegisterClassW_WCECL(CONST WNDCLASSW_WCECL *lpWndClass)
wndClass.lpszMenuName = lpWndClass->lpszMenuName;
wndClass.lpszClassName = lpWndClass->lpszClassName;

auto result = ::RegisterClass(&wndClass);
auto result = ::RegisterClassW(&wndClass);

return result;
}
Expand Down Expand Up @@ -471,7 +490,28 @@ BOOL WINAPI ShowWindow_WCECL(
HWND hwnd,
INT nCmdShow)
{
auto result = ShowWindow(hwnd, /*nCmdShow invalid*/ SW_SHOWDEFAULT);
INT nCmdShowActual = 0;

switch (nCmdShow)
{
case WINCE_SW_SHOWMAXIMIZED:
nCmdShowActual = SW_SHOWMAXIMIZED;
break;
case WINCE_SW_MAXIMIZE:
nCmdShowActual = SW_MAXIMIZE;
break;
case WINCE_SW_RESTORE:
nCmdShowActual = SW_RESTORE;
break;
default:
nCmdShowActual = nCmdShow;
break;
}

if (nCmdShowActual >= 12)
nCmdShowActual = SW_SHOWMAXIMIZED;

auto result = ShowWindow(hwnd, nCmdShowActual);
return result;
}

Expand Down
55 changes: 55 additions & 0 deletions COREDLL/winuser_wcecl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#pragma once

#define WINCE_WS_OVERLAPPED WINCE_WS_BORDER | WINCE_WS_CAPTION
#define WINCE_WS_CLIPSIBLINGS 0x04000000L
#define WINCE_WS_CLIPCHILDREN 0x02000000L
#define WINCE_WS_CAPTION 0x00C00000L /* WINCE_WS_BORDER | WINCE_WS_DLGFRAME */
#define WINCE_WS_BORDER 0x00800000L
#define WINCE_WS_DLGFRAME 0x00400000L
#define WINCE_WS_VSCROLL 0x00200000L
#define WINCE_WS_HSCROLL 0x00100000L
#define WINCE_WS_SYSMENU 0x00080000L
#define WINCE_WS_THICKFRAME 0x00040000L
#define WINCE_WS_MAXIMIZEBOX 0x00020000L
#define WINCE_WS_MINIMIZEBOX 0x00010000L
#define WINCE_WS_SIZEBOX WINCE_WS_THICKFRAME
#define WINCE_WS_POPUP 0x80000000L

#define WINCE_WS_EX_DLGMODALFRAME 0x00000001L
#define WINCE_WS_EX_TOPMOST 0x00000008L
#define WINCE_WS_EX_TOOLWINDOW 0x00000080L
#define WINCE_WS_EX_WINDOWEDGE 0x00000100L
#define WINCE_WS_EX_CLIENTEDGE 0x00000200L
#define WINCE_WS_EX_CONTEXTHELP 0x00000400L
#define WINCE_WS_EX_RIGHT 0x00001000L
#define WINCE_WS_EX_RTLREADING 0x00002000L
#define WINCE_WS_EX_LEFTSCROLLBAR 0x00004000L
#define WINCE_WS_EX_STATICEDGE 0x00020000L
#define WINCE_WS_EX_NOINHERITLAYOUT 0x00100000L // Disable inheritence of mirroring by children
#define WINCE_WS_EX_LAYOUTRTL 0x00400000L // Right to left mirroring
#define WINCE_WS_EX_OVERLAPPEDWINDOW (WINCE_WS_EX_WINDOWEDGE | WINCE_WS_EX_CLIENTEDGE)
#define WINCE_WS_EX_CAPTIONOKBTN 0x80000000L
#define WINCE_WS_EX_NODRAG 0x40000000L
#define WINCE_WS_EX_ABOVESTARTUP 0x20000000L
#define WINCE_WS_EX_INK 0x10000000L
#define WINCE_WS_EX_NOANIMATION 0x04000000L


#define WINCE_SW_HIDE 0
#define WINCE_SW_SHOWNORMAL 1
#define WINCE_SW_SHOWNOACTIVATE 4
#define WINCE_SW_SHOW 5
#define WINCE_SW_MINIMIZE 6
#define WINCE_SW_SHOWNA 8
#define WINCE_SW_SHOWMAXIMIZED 11
#define WINCE_SW_MAXIMIZE 12
#define WINCE_SW_RESTORE 13

#define WINCE_CS_VREDRAW 0x0001
#define WINCE_CS_HREDRAW 0x0002
#define WINCE_CS_DBLCLKS 0x0008
#define WINCE_CS_PARENTDC 0x0080
#define WINCE_CS_NOCLOSE 0x0200
#define WINCE_CS_SAVEBITS 0x0800
#define WINCE_CS_GLOBALCLASS 0x4000
#define WINCE_CS_IME 0x00010000

0 comments on commit 14ec213

Please sign in to comment.