Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
3f5b518d
Commit
3f5b518d
authored
Jun 13, 2003
by
Steven Edwards
Committed by
Alexandre Julliard
Jun 13, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split Win16/32 color dialog support.
Supporting compiling out 16 bit find dialog support.
parent
1b3755e3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
287 additions
and
187 deletions
+287
-187
Makefile.in
dlls/commdlg/Makefile.in
+2
-1
colordlg.c
dlls/commdlg/colordlg.c
+10
-186
colordlg.h
dlls/commdlg/colordlg.h
+80
-0
colordlg16.c
dlls/commdlg/colordlg16.c
+195
-0
No files found.
dlls/commdlg/Makefile.in
View file @
3f5b518d
...
...
@@ -18,7 +18,6 @@ C_SRCS = \
filedlg.c
\
filedlg95.c
\
filedlgbrowser.c
\
finddlg.c
\
finddlg32.c
\
filetitle.c
\
fontdlg.c
\
...
...
@@ -26,7 +25,9 @@ C_SRCS = \
printdlg.c
C_SRCS16
=
\
colordlg16.c
\
fontdlg16.c
\
finddlg.c
RC_SRCS
=
rsrc.rc
...
...
dlls/commdlg/colordlg.c
View file @
3f5b518d
...
...
@@ -40,6 +40,7 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
commdlg
);
#include "cdlg.h"
#include "colordlg.h"
static
INT_PTR
CALLBACK
ColorDlgProc
(
HWND
hWnd
,
UINT
wMsg
,
WPARAM
wParam
,
LPARAM
lParam
);
...
...
@@ -63,28 +64,6 @@ static const COLORREF predefcolors[6][8]=
0x00808040L
,
0x00C0C0C0L
,
0x00400040L
,
0x00FFFFFFL
},
};
struct
CCPRIVATE
{
LPCHOOSECOLORW
lpcc
;
/* points to public known data structure */
LPCHOOSECOLOR16
lpcc16
;
/* save the 16 bits pointer */
int
nextuserdef
;
/* next free place in user defined color array */
HDC
hdcMem
;
/* color graph used for BitBlt() */
HBITMAP
hbmMem
;
/* color graph bitmap */
RECT
fullsize
;
/* original dialog window size */
UINT
msetrgb
;
/* # of SETRGBSTRING message (today not used) */
RECT
old3angle
;
/* last position of l-marker */
RECT
oldcross
;
/* last position of color/satuation marker */
BOOL
updating
;
/* to prevent recursive WM_COMMAND/EN_UPDATE processing */
int
h
;
int
s
;
int
l
;
/* for temporary storing of hue,sat,lum */
int
capturedGraph
;
/* control mouse captured */
RECT
focusRect
;
/* rectangle last focused item */
HWND
hwndFocus
;
/* handle last focused item */
};
#define LCCPRIV struct CCPRIVATE *
/***********************************************************************
* CC_HSLtoRGB [internal]
*/
...
...
@@ -355,7 +334,7 @@ static int CC_MouseCheckColorGraph( HWND hDlg, int dlgitem, int *hori, int *vert
* CC_MouseCheckResultWindow [internal]
* test if double click one of the result colors
*/
static
int
CC_MouseCheckResultWindow
(
HWND
hDlg
,
LPARAM
lParam
)
int
CC_MouseCheckResultWindow
(
HWND
hDlg
,
LPARAM
lParam
)
{
HWND
hwnd
;
POINT
point
;
...
...
@@ -808,7 +787,7 @@ static void CC_PaintUserColorArray( HWND hDlg, int rows, int cols, COLORREF* lpc
/***********************************************************************
* CC_HookCallChk [internal]
*/
static
BOOL
CC_HookCallChk
(
LPCHOOSECOLORW
lpcc
)
BOOL
CC_HookCallChk
(
LPCHOOSECOLORW
lpcc
)
{
if
(
lpcc
)
if
(
lpcc
->
Flags
&
CC_ENABLEHOOK
)
...
...
@@ -817,11 +796,10 @@ static BOOL CC_HookCallChk( LPCHOOSECOLORW lpcc )
return
FALSE
;
}
/***********************************************************************
* CC_WMInitDialog [internal]
*/
static
LONG
CC_WMInitDialog
(
HWND
hDlg
,
WPARAM
wParam
,
LPARAM
lParam
,
BOOL
b16
)
LONG
CC_WMInitDialog
(
HWND
hDlg
,
WPARAM
wParam
,
LPARAM
lParam
,
BOOL
b16
)
{
int
i
,
res
;
int
r
,
g
,
b
;
...
...
@@ -952,7 +930,7 @@ static LONG CC_WMInitDialog( HWND hDlg, WPARAM wParam, LPARAM lParam, BOOL b16 )
/***********************************************************************
* CC_WMCommand [internal]
*/
static
LRESULT
CC_WMCommand
(
HWND
hDlg
,
WPARAM
wParam
,
LPARAM
lParam
,
WORD
notifyCode
,
HWND
hwndCtl
)
LRESULT
CC_WMCommand
(
HWND
hDlg
,
WPARAM
wParam
,
LPARAM
lParam
,
WORD
notifyCode
,
HWND
hwndCtl
)
{
int
r
,
g
,
b
,
i
,
xx
;
UINT
cokmsg
;
...
...
@@ -1104,7 +1082,7 @@ static LRESULT CC_WMCommand( HWND hDlg, WPARAM wParam, LPARAM lParam, WORD notif
/***********************************************************************
* CC_WMPaint [internal]
*/
static
LRESULT
CC_WMPaint
(
HWND
hDlg
,
WPARAM
wParam
,
LPARAM
lParam
)
LRESULT
CC_WMPaint
(
HWND
hDlg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
HDC
hdc
;
PAINTSTRUCT
ps
;
...
...
@@ -1124,11 +1102,10 @@ static LRESULT CC_WMPaint( HWND hDlg, WPARAM wParam, LPARAM lParam )
return
TRUE
;
}
/***********************************************************************
* CC_WMLButtonUp [internal]
*/
static
LRESULT
CC_WMLButtonUp
(
HWND
hDlg
,
WPARAM
wParam
,
LPARAM
lParam
)
LRESULT
CC_WMLButtonUp
(
HWND
hDlg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
LCCPRIV
lpp
=
(
LCCPRIV
)
GetWindowLongA
(
hDlg
,
DWL_USER
);
if
(
lpp
->
capturedGraph
)
...
...
@@ -1141,11 +1118,10 @@ static LRESULT CC_WMLButtonUp( HWND hDlg, WPARAM wParam, LPARAM lParam )
return
0
;
}
/***********************************************************************
* CC_WMMouseMove [internal]
*/
static
LRESULT
CC_WMMouseMove
(
HWND
hDlg
,
LPARAM
lParam
)
LRESULT
CC_WMMouseMove
(
HWND
hDlg
,
LPARAM
lParam
)
{
LCCPRIV
lpp
=
(
LCCPRIV
)
GetWindowLongA
(
hDlg
,
DWL_USER
);
int
r
,
g
,
b
;
...
...
@@ -1179,10 +1155,11 @@ static LRESULT CC_WMMouseMove( HWND hDlg, LPARAM lParam )
}
return
0
;
}
/***********************************************************************
* CC_WMLButtonDown [internal]
*/
static
LRESULT
CC_WMLButtonDown
(
HWND
hDlg
,
WPARAM
wParam
,
LPARAM
lParam
)
LRESULT
CC_WMLButtonDown
(
HWND
hDlg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
LCCPRIV
lpp
=
(
LCCPRIV
)
GetWindowLongA
(
hDlg
,
DWL_USER
);
int
r
,
g
,
b
,
i
;
...
...
@@ -1234,7 +1211,6 @@ static LRESULT CC_WMLButtonDown( HWND hDlg, WPARAM wParam, LPARAM lParam )
return
FALSE
;
}
/***********************************************************************
* ColorDlgProc32 [internal]
*
...
...
@@ -1300,158 +1276,6 @@ static INT_PTR CALLBACK ColorDlgProc( HWND hDlg, UINT message,
}
/***********************************************************************
* ColorDlgProc (COMMDLG.8)
*/
BOOL16
CALLBACK
ColorDlgProc16
(
HWND16
hDlg16
,
UINT16
message
,
WPARAM16
wParam
,
LONG
lParam
)
{
BOOL16
res
;
HWND
hDlg
=
HWND_32
(
hDlg16
);
LCCPRIV
lpp
=
(
LCCPRIV
)
GetWindowLongA
(
hDlg
,
DWL_USER
);
if
(
message
!=
WM_INITDIALOG
)
{
if
(
!
lpp
)
return
FALSE
;
res
=
0
;
if
(
CC_HookCallChk
(
lpp
->
lpcc
))
res
=
CallWindowProc16
(
(
WNDPROC16
)
lpp
->
lpcc16
->
lpfnHook
,
hDlg16
,
message
,
wParam
,
lParam
);
if
(
res
)
return
res
;
}
/* FIXME: SetRGB message
if (message && message == msetrgb)
return HandleSetRGB(hDlg, lParam);
*/
switch
(
message
)
{
case
WM_INITDIALOG
:
return
CC_WMInitDialog
(
hDlg
,
wParam
,
lParam
,
TRUE
);
case
WM_NCDESTROY
:
DeleteDC
(
lpp
->
hdcMem
);
DeleteObject
(
lpp
->
hbmMem
);
HeapFree
(
GetProcessHeap
(),
0
,
lpp
->
lpcc
);
HeapFree
(
GetProcessHeap
(),
0
,
lpp
);
SetWindowLongA
(
hDlg
,
DWL_USER
,
0L
);
/* we don't need it anymore */
break
;
case
WM_COMMAND
:
if
(
CC_WMCommand
(
hDlg
,
wParam
,
lParam
,
HIWORD
(
lParam
),
HWND_32
(
LOWORD
(
lParam
))))
return
TRUE
;
break
;
case
WM_PAINT
:
if
(
CC_WMPaint
(
hDlg
,
wParam
,
lParam
))
return
TRUE
;
break
;
case
WM_LBUTTONDBLCLK
:
if
(
CC_MouseCheckResultWindow
(
hDlg
,
lParam
))
return
TRUE
;
break
;
case
WM_MOUSEMOVE
:
if
(
CC_WMMouseMove
(
hDlg
,
lParam
))
return
TRUE
;
break
;
case
WM_LBUTTONUP
:
/* FIXME: ClipCursor off (if in color graph)*/
if
(
CC_WMLButtonUp
(
hDlg
,
wParam
,
lParam
))
return
TRUE
;
break
;
case
WM_LBUTTONDOWN
:
/* FIXME: ClipCursor on (if in color graph)*/
if
(
CC_WMLButtonDown
(
hDlg
,
wParam
,
lParam
))
return
TRUE
;
break
;
}
return
FALSE
;
}
/***********************************************************************
* ChooseColor (COMMDLG.5)
*/
BOOL16
WINAPI
ChooseColor16
(
LPCHOOSECOLOR16
lpChCol
)
{
HINSTANCE16
hInst
;
HANDLE16
hDlgTmpl16
=
0
,
hResource16
=
0
;
HGLOBAL16
hGlobal16
=
0
;
BOOL16
bRet
=
FALSE
;
LPCVOID
template
;
FARPROC16
ptr
;
TRACE
(
"ChooseColor
\n
"
);
if
(
!
lpChCol
)
return
FALSE
;
if
(
lpChCol
->
Flags
&
CC_ENABLETEMPLATEHANDLE
)
hDlgTmpl16
=
lpChCol
->
hInstance
;
else
if
(
lpChCol
->
Flags
&
CC_ENABLETEMPLATE
)
{
HANDLE16
hResInfo
;
if
(
!
(
hResInfo
=
FindResource16
(
lpChCol
->
hInstance
,
MapSL
(
lpChCol
->
lpTemplateName
),
RT_DIALOGA
)))
{
COMDLG32_SetCommDlgExtendedError
(
CDERR_FINDRESFAILURE
);
return
FALSE
;
}
if
(
!
(
hDlgTmpl16
=
LoadResource16
(
lpChCol
->
hInstance
,
hResInfo
)))
{
COMDLG32_SetCommDlgExtendedError
(
CDERR_LOADRESFAILURE
);
return
FALSE
;
}
hResource16
=
hDlgTmpl16
;
}
else
{
HRSRC
hResInfo
;
HGLOBAL
hDlgTmpl32
;
LPCVOID
template32
;
DWORD
size
;
if
(
!
(
hResInfo
=
FindResourceA
(
COMDLG32_hInstance
,
"CHOOSE_COLOR"
,
RT_DIALOGA
)))
{
COMDLG32_SetCommDlgExtendedError
(
CDERR_FINDRESFAILURE
);
return
FALSE
;
}
if
(
!
(
hDlgTmpl32
=
LoadResource
(
COMDLG32_hInstance
,
hResInfo
))
||
!
(
template32
=
LockResource
(
hDlgTmpl32
)))
{
COMDLG32_SetCommDlgExtendedError
(
CDERR_LOADRESFAILURE
);
return
FALSE
;
}
size
=
SizeofResource
(
GetModuleHandleA
(
"COMDLG32"
),
hResInfo
);
hGlobal16
=
GlobalAlloc16
(
0
,
size
);
if
(
!
hGlobal16
)
{
COMDLG32_SetCommDlgExtendedError
(
CDERR_MEMALLOCFAILURE
);
ERR
(
"alloc failure for %ld bytes
\n
"
,
size
);
return
FALSE
;
}
template
=
GlobalLock16
(
hGlobal16
);
if
(
!
template
)
{
COMDLG32_SetCommDlgExtendedError
(
CDERR_MEMLOCKFAILURE
);
ERR
(
"global lock failure for %x handle
\n
"
,
hDlgTmpl16
);
GlobalFree16
(
hGlobal16
);
return
FALSE
;
}
ConvertDialog32To16
((
LPVOID
)
template32
,
size
,
(
LPVOID
)
template
);
hDlgTmpl16
=
hGlobal16
;
}
ptr
=
GetProcAddress16
(
GetModuleHandle16
(
"COMMDLG"
),
(
LPCSTR
)
8
);
hInst
=
GetWindowLongA
(
HWND_32
(
lpChCol
->
hwndOwner
),
GWL_HINSTANCE
);
bRet
=
DialogBoxIndirectParam16
(
hInst
,
hDlgTmpl16
,
lpChCol
->
hwndOwner
,
(
DLGPROC16
)
ptr
,
(
DWORD
)
lpChCol
);
if
(
hResource16
)
FreeResource16
(
hDlgTmpl16
);
if
(
hGlobal16
)
{
GlobalUnlock16
(
hGlobal16
);
GlobalFree16
(
hGlobal16
);
}
return
bRet
;
}
/***********************************************************************
* ChooseColorW (COMDLG32.@)
*/
BOOL
WINAPI
ChooseColorW
(
LPCHOOSECOLORW
lpChCol
)
...
...
dlls/commdlg/colordlg.h
0 → 100644
View file @
3f5b518d
/*
* COMMDLG - Color Dialog
*
* Copyright 1994 Martin Ayotte
* Copyright 1996 Albrecht Kleine
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* BUGS : still seems to not refresh correctly
sometimes, especially when 2 instances of the
dialog are loaded at the same time */
#ifndef _WINE_COLORDLG_H
#define _WINE_COLORDLG_H
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "wine/winbase16.h"
#include "wine/winuser16.h"
#include "commdlg.h"
#include "dlgs.h"
#include "wine/debug.h"
#include "cderr.h"
#include "cdlg.h"
typedef
struct
CCPRIVATE
{
LPCHOOSECOLORW
lpcc
;
/* points to public known data structure */
LPCHOOSECOLOR16
lpcc16
;
/* save the 16 bits pointer */
int
nextuserdef
;
/* next free place in user defined color array */
HDC
hdcMem
;
/* color graph used for BitBlt() */
HBITMAP
hbmMem
;
/* color graph bitmap */
RECT
fullsize
;
/* original dialog window size */
UINT
msetrgb
;
/* # of SETRGBSTRING message (today not used) */
RECT
old3angle
;
/* last position of l-marker */
RECT
oldcross
;
/* last position of color/satuation marker */
BOOL
updating
;
/* to prevent recursive WM_COMMAND/EN_UPDATE processing */
int
h
;
int
s
;
int
l
;
/* for temporary storing of hue,sat,lum */
int
capturedGraph
;
/* control mouse captured */
RECT
focusRect
;
/* rectangle last focused item */
HWND
hwndFocus
;
/* handle last focused item */
}
*
LCCPRIV
;
/*
* Internal Functions
* Do NOT Export to other programs and dlls
*/
BOOL
CC_HookCallChk
(
LPCHOOSECOLORW
lpcc
);
int
CC_MouseCheckResultWindow
(
HWND
hDlg
,
LPARAM
lParam
);
LONG
CC_WMInitDialog
(
HWND
hDlg
,
WPARAM
wParam
,
LPARAM
lParam
,
BOOL
b16
);
LRESULT
CC_WMLButtonDown
(
HWND
hDlg
,
WPARAM
wParam
,
LPARAM
lParam
);
LRESULT
CC_WMLButtonUp
(
HWND
hDlg
,
WPARAM
wParam
,
LPARAM
lParam
);
LRESULT
CC_WMCommand
(
HWND
hDlg
,
WPARAM
wParam
,
LPARAM
lParam
,
WORD
notifyCode
,
HWND
hwndCtl
);
LRESULT
CC_WMMouseMove
(
HWND
hDlg
,
LPARAM
lParam
);
LRESULT
CC_WMPaint
(
HWND
hDlg
,
WPARAM
wParam
,
LPARAM
lParam
);
#endif
/* _WINE_COLORDLG_H */
dlls/commdlg/colordlg16.c
0 → 100644
View file @
3f5b518d
/*
* COMMDLG - Color Dialog
*
* Copyright 1994 Martin Ayotte
* Copyright 1996 Albrecht Kleine
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* BUGS : still seems to not refresh correctly
sometimes, especially when 2 instances of the
dialog are loaded at the same time */
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "wine/winbase16.h"
#include "wine/winuser16.h"
#include "commdlg.h"
#include "dlgs.h"
#include "wine/debug.h"
#include "cderr.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
commdlg
);
#include "cdlg.h"
#include "colordlg.h"
/***********************************************************************
* ColorDlgProc (COMMDLG.8)
*/
BOOL16
CALLBACK
ColorDlgProc16
(
HWND16
hDlg16
,
UINT16
message
,
WPARAM16
wParam
,
LONG
lParam
)
{
BOOL16
res
;
HWND
hDlg
=
HWND_32
(
hDlg16
);
LCCPRIV
lpp
=
(
LCCPRIV
)
GetWindowLongA
(
hDlg
,
DWL_USER
);
if
(
message
!=
WM_INITDIALOG
)
{
if
(
!
lpp
)
return
FALSE
;
res
=
0
;
if
(
CC_HookCallChk
(
lpp
->
lpcc
))
res
=
CallWindowProc16
(
(
WNDPROC16
)
lpp
->
lpcc16
->
lpfnHook
,
hDlg16
,
message
,
wParam
,
lParam
);
if
(
res
)
return
res
;
}
/* FIXME: SetRGB message
if (message && message == msetrgb)
return HandleSetRGB(hDlg, lParam);
*/
switch
(
message
)
{
case
WM_INITDIALOG
:
return
CC_WMInitDialog
(
hDlg
,
wParam
,
lParam
,
TRUE
);
case
WM_NCDESTROY
:
DeleteDC
(
lpp
->
hdcMem
);
DeleteObject
(
lpp
->
hbmMem
);
HeapFree
(
GetProcessHeap
(),
0
,
lpp
->
lpcc
);
HeapFree
(
GetProcessHeap
(),
0
,
lpp
);
SetWindowLongA
(
hDlg
,
DWL_USER
,
0L
);
/* we don't need it anymore */
break
;
case
WM_COMMAND
:
if
(
CC_WMCommand
(
hDlg
,
wParam
,
lParam
,
HIWORD
(
lParam
),
HWND_32
(
LOWORD
(
lParam
))))
return
TRUE
;
break
;
case
WM_PAINT
:
if
(
CC_WMPaint
(
hDlg
,
wParam
,
lParam
))
return
TRUE
;
break
;
case
WM_LBUTTONDBLCLK
:
if
(
CC_MouseCheckResultWindow
(
hDlg
,
lParam
))
return
TRUE
;
break
;
case
WM_MOUSEMOVE
:
if
(
CC_WMMouseMove
(
hDlg
,
lParam
))
return
TRUE
;
break
;
case
WM_LBUTTONUP
:
/* FIXME: ClipCursor off (if in color graph)*/
if
(
CC_WMLButtonUp
(
hDlg
,
wParam
,
lParam
))
return
TRUE
;
break
;
case
WM_LBUTTONDOWN
:
/* FIXME: ClipCursor on (if in color graph)*/
if
(
CC_WMLButtonDown
(
hDlg
,
wParam
,
lParam
))
return
TRUE
;
break
;
}
return
FALSE
;
}
/***********************************************************************
* ChooseColor (COMMDLG.5)
*/
BOOL16
WINAPI
ChooseColor16
(
LPCHOOSECOLOR16
lpChCol
)
{
HINSTANCE16
hInst
;
HANDLE16
hDlgTmpl16
=
0
,
hResource16
=
0
;
HGLOBAL16
hGlobal16
=
0
;
BOOL16
bRet
=
FALSE
;
LPCVOID
template
;
FARPROC16
ptr
;
TRACE
(
"ChooseColor
\n
"
);
if
(
!
lpChCol
)
return
FALSE
;
if
(
lpChCol
->
Flags
&
CC_ENABLETEMPLATEHANDLE
)
hDlgTmpl16
=
lpChCol
->
hInstance
;
else
if
(
lpChCol
->
Flags
&
CC_ENABLETEMPLATE
)
{
HANDLE16
hResInfo
;
if
(
!
(
hResInfo
=
FindResource16
(
lpChCol
->
hInstance
,
MapSL
(
lpChCol
->
lpTemplateName
),
RT_DIALOGA
)))
{
COMDLG32_SetCommDlgExtendedError
(
CDERR_FINDRESFAILURE
);
return
FALSE
;
}
if
(
!
(
hDlgTmpl16
=
LoadResource16
(
lpChCol
->
hInstance
,
hResInfo
)))
{
COMDLG32_SetCommDlgExtendedError
(
CDERR_LOADRESFAILURE
);
return
FALSE
;
}
hResource16
=
hDlgTmpl16
;
}
else
{
HRSRC
hResInfo
;
HGLOBAL
hDlgTmpl32
;
LPCVOID
template32
;
DWORD
size
;
if
(
!
(
hResInfo
=
FindResourceA
(
COMDLG32_hInstance
,
"CHOOSE_COLOR"
,
RT_DIALOGA
)))
{
COMDLG32_SetCommDlgExtendedError
(
CDERR_FINDRESFAILURE
);
return
FALSE
;
}
if
(
!
(
hDlgTmpl32
=
LoadResource
(
COMDLG32_hInstance
,
hResInfo
))
||
!
(
template32
=
LockResource
(
hDlgTmpl32
)))
{
COMDLG32_SetCommDlgExtendedError
(
CDERR_LOADRESFAILURE
);
return
FALSE
;
}
size
=
SizeofResource
(
GetModuleHandleA
(
"COMDLG32"
),
hResInfo
);
hGlobal16
=
GlobalAlloc16
(
0
,
size
);
if
(
!
hGlobal16
)
{
COMDLG32_SetCommDlgExtendedError
(
CDERR_MEMALLOCFAILURE
);
ERR
(
"alloc failure for %ld bytes
\n
"
,
size
);
return
FALSE
;
}
template
=
GlobalLock16
(
hGlobal16
);
if
(
!
template
)
{
COMDLG32_SetCommDlgExtendedError
(
CDERR_MEMLOCKFAILURE
);
ERR
(
"global lock failure for %x handle
\n
"
,
hDlgTmpl16
);
GlobalFree16
(
hGlobal16
);
return
FALSE
;
}
ConvertDialog32To16
((
LPVOID
)
template32
,
size
,
(
LPVOID
)
template
);
hDlgTmpl16
=
hGlobal16
;
}
ptr
=
GetProcAddress16
(
GetModuleHandle16
(
"COMMDLG"
),
(
LPCSTR
)
8
);
hInst
=
GetWindowLongA
(
HWND_32
(
lpChCol
->
hwndOwner
),
GWL_HINSTANCE
);
bRet
=
DialogBoxIndirectParam16
(
hInst
,
hDlgTmpl16
,
lpChCol
->
hwndOwner
,
(
DLGPROC16
)
ptr
,
(
DWORD
)
lpChCol
);
if
(
hResource16
)
FreeResource16
(
hDlgTmpl16
);
if
(
hGlobal16
)
{
GlobalUnlock16
(
hGlobal16
);
GlobalFree16
(
hGlobal16
);
}
return
bRet
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment