ReactOS 0.4.15-dev-8131-g4988de4
ole32_main.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "objbase.h"
#include "ole2.h"
#include "wine/debug.h"
Include dependency graph for ole32_main.c:

Go to the source code of this file.

Macros

#define HIMETRIC_INCHES   2540
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (ole)
 
HGLOBAL WINAPI OleMetafilePictFromIconAndLabel (HICON hIcon, LPOLESTR lpszLabel, LPOLESTR lpszSourceFile, UINT iIconIndex)
 
HRESULT WINAPI CoGetActivationState (GUID guid, DWORD unknown, DWORD *unknown2)
 
HRESULT WINAPI CoGetCallState (int unknown, PULONG unknown2)
 

Macro Definition Documentation

◆ HIMETRIC_INCHES

#define HIMETRIC_INCHES   2540

Definition at line 35 of file ole32_main.c.

Function Documentation

◆ CoGetActivationState()

HRESULT WINAPI CoGetActivationState ( GUID  guid,
DWORD  unknown,
DWORD unknown2 
)

Definition at line 164 of file ole32_main.c.

165{
166 FIXME("%s, %x, %p\n", debugstr_guid(&guid), unknown, unknown2);
167 return E_NOTIMPL;
168}
#define FIXME(fmt,...)
Definition: debug.h:114
#define E_NOTIMPL
Definition: ddrawi.h:99
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1605
#define debugstr_guid
Definition: kernel32.h:35
const GUID * guid

◆ CoGetCallState()

HRESULT WINAPI CoGetCallState ( int  unknown,
PULONG  unknown2 
)

Definition at line 173 of file ole32_main.c.

174{
175 FIXME("%d, %p\n", unknown, unknown2);
176 return E_NOTIMPL;
177}

◆ OleMetafilePictFromIconAndLabel()

HGLOBAL WINAPI OleMetafilePictFromIconAndLabel ( HICON  hIcon,
LPOLESTR  lpszLabel,
LPOLESTR  lpszSourceFile,
UINT  iIconIndex 
)

Definition at line 40 of file ole32_main.c.

42{
43 METAFILEPICT mfp;
44 HDC hdc;
45 HGLOBAL hmem = NULL;
46 LPVOID mfdata;
47 static const char szIconOnly[] = "IconOnly";
48 SIZE text_size = { 0, 0 };
49 INT width;
50 INT icon_width;
51 INT icon_height;
52 INT label_offset;
53 HDC hdcScreen;
54 LOGFONTW lf;
55 HFONT font;
56
57 TRACE("%p %p %s %d\n", hIcon, lpszLabel, debugstr_w(lpszSourceFile), iIconIndex);
58
59 if( !hIcon )
60 return NULL;
61
62 if (!SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, 0))
63 return NULL;
64
66 if (!font)
67 return NULL;
68
70 if( !hdc )
71 {
73 return NULL;
74 }
75
77
78 ExtEscape(hdc, MFCOMMENT, sizeof(szIconOnly), szIconOnly, 0, NULL);
79
80 icon_width = GetSystemMetrics(SM_CXICON);
81 icon_height = GetSystemMetrics(SM_CYICON);
82 /* FIXME: should we give the label a bit of padding here? */
83 label_offset = icon_height;
84 if (lpszLabel)
85 {
86 HFONT screen_old_font;
87 /* metafile DCs don't support GetTextExtentPoint32, so size the font
88 * using the desktop window DC */
89 hdcScreen = GetDC(NULL);
90 screen_old_font = SelectObject(hdcScreen, font);
91 GetTextExtentPoint32W(hdcScreen, lpszLabel, lstrlenW(lpszLabel), &text_size);
92 SelectObject(hdcScreen, screen_old_font);
93 ReleaseDC(NULL, hdcScreen);
94
95 width = 3 * icon_width;
96 }
97 else
98 width = icon_width;
99
101 SetWindowOrgEx(hdc, 0, 0, NULL);
102 SetWindowExtEx(hdc, width, label_offset + text_size.cy, NULL);
103
104 /* draw the icon centered */
105 DrawIcon(hdc, (width-icon_width) / 2, 0, hIcon);
106 if(lpszLabel)
107 /* draw the label centered too, if provided */
108 TextOutW(hdc, (width-text_size.cx) / 2, label_offset, lpszLabel, lstrlenW(lpszLabel));
109
110 if (lpszSourceFile)
111 {
112 char szIconIndex[10];
113 int path_length = WideCharToMultiByte(CP_ACP,0,lpszSourceFile,-1,NULL,0,NULL,NULL);
114 if (path_length > 1)
115 {
116 char * szPath = CoTaskMemAlloc(path_length * sizeof(CHAR));
117 if (szPath)
118 {
122 }
123 }
124 snprintf(szIconIndex, 10, "%u", iIconIndex);
125 ExtEscape(hdc, MFCOMMENT, strlen(szIconIndex)+1, szIconIndex, 0, NULL);
126 }
127
128 mfp.mm = MM_ANISOTROPIC;
129 hdcScreen = GetDC(NULL);
131 mfp.yExt = MulDiv(label_offset + text_size.cy, HIMETRIC_INCHES, GetDeviceCaps(hdcScreen, LOGPIXELSY));
132 ReleaseDC(NULL, hdcScreen);
133 mfp.hMF = CloseMetaFile(hdc);
135 if( !mfp.hMF )
136 return NULL;
137
138 hmem = GlobalAlloc( GMEM_MOVEABLE, sizeof(mfp) );
139 if( !hmem )
140 {
141 DeleteMetaFile(mfp.hMF);
142 return NULL;
143 }
144
145 mfdata = GlobalLock( hmem );
146 if( !mfdata )
147 {
148 GlobalFree( hmem );
149 DeleteMetaFile(mfp.hMF);
150 return NULL;
151 }
152
153 memcpy(mfdata,&mfp,sizeof(mfp));
154 GlobalUnlock( hmem );
155
156 TRACE("returning %p\n",hmem);
157
158 return hmem;
159}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static long path_length
Definition: maze.c:116
#define NULL
Definition: types.h:112
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
#define lstrlenW
Definition: compat.h:750
pKey DeleteObject()
GLint GLint GLsizei width
Definition: gl.h:1546
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
#define debugstr_w
Definition: kernel32.h:32
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
LPCWSTR szPath
Definition: env.c:37
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:92
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
HICON hIcon
Definition: msconfig.c:44
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
Definition: muldiv.c:25
Definition: mk_font.cpp:20
#define HIMETRIC_INCHES
Definition: ole32_main.c:35
#define TRACE(s)
Definition: solgame.cpp:4
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
HMETAFILE hMF
Definition: wingdi.h:2608
int32_t INT
Definition: typedefs.h:58
#define GMEM_MOVEABLE
Definition: winbase.h:294
BOOL WINAPI DeleteMetaFile(_In_ HMETAFILE)
int WINAPI SetMapMode(_In_ HDC, _In_ int)
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
BOOL WINAPI SetWindowOrgEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
Definition: coord.c:532
#define LOGPIXELSY
Definition: wingdi.h:719
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
#define MM_ANISOTROPIC
Definition: wingdi.h:867
HMETAFILE WINAPI CloseMetaFile(_In_ HDC hdc)
BOOL WINAPI SetWindowExtEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPSIZE)
HDC WINAPI CreateMetaFileW(_In_opt_ LPCWSTR)
#define LOGPIXELSX
Definition: wingdi.h:718
BOOL WINAPI TextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_reads_(c) LPCWSTR lpString, _In_ int c)
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
int WINAPI ExtEscape(_In_ HDC hdc, _In_ int iEscape, _In_ int cjInput, _In_reads_bytes_opt_(cjInput) LPCSTR lpInData, _In_ int cjOutput, _Out_writes_bytes_opt_(cjOutput) LPSTR lpOutData)
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
#define MFCOMMENT
Definition: wingdi.h:1008
#define snprintf
Definition: wintirpc.h:48
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
BOOL WINAPI DrawIcon(_In_ HDC, _In_ int, _In_ int, _In_ HICON)
Definition: cursoricon.c:2049
#define SPI_GETICONTITLELOGFONT
Definition: winuser.h:1380
#define SM_CYICON
Definition: winuser.h:973
HDC WINAPI GetDC(_In_opt_ HWND)
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
#define SM_CXICON
Definition: winuser.h:972
int WINAPI GetSystemMetrics(_In_ int)
char CHAR
Definition: xmlstorage.h:175

Referenced by test_data_cache().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( ole  )