ReactOS  0.4.15-dev-1374-g8d3e80e
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 }
const GUID * guid
#define FIXME(fmt,...)
Definition: debug.h:111
#define debugstr_guid
Definition: kernel32.h:35
Definition: id3.c:95
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ 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 }
#define FIXME(fmt,...)
Definition: debug.h:111
Definition: id3.c:95
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ 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  {
119  WideCharToMultiByte(CP_ACP,0,lpszSourceFile,-1,szPath,path_length,NULL,NULL);
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 }
GLint GLint GLsizei width
Definition: gl.h:1546
HMETAFILE hMF
Definition: wingdi.h:2607
#define LOGPIXELSX
Definition: wingdi.h:717
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
BOOL WINAPI SetWindowExtEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPSIZE)
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#define WideCharToMultiByte
Definition: compat.h:111
HDC WINAPI GetDC(_In_opt_ HWND)
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
Definition: mk_font.cpp:20
#define CP_ACP
Definition: compat.h:109
char CHAR
Definition: xmlstorage.h:175
HDC WINAPI CreateMetaFileW(_In_opt_ LPCWSTR)
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1499
#define snprintf
Definition: wintirpc.h:48
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define MFCOMMENT
Definition: wingdi.h:1007
#define lstrlenW
Definition: compat.h:609
int32_t INT
Definition: typedefs.h:58
int WINAPI SetMapMode(_In_ HDC, _In_ int)
#define debugstr_w
Definition: kernel32.h:32
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define SM_CXICON
Definition: winuser.h:962
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
LONG cx
Definition: windef.h:334
HMETAFILE WINAPI CloseMetaFile(_In_ HDC hdc)
BOOL WINAPI SystemParametersInfoW(_In_ UINT, _In_ UINT, _Inout_opt_ PVOID, _In_ UINT)
#define TRACE(s)
Definition: solgame.cpp:4
static long path_length
Definition: maze.c:116
int WINAPI GetSystemMetrics(_In_ int)
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
#define SM_CYICON
Definition: winuser.h:963
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
HDC hdc
Definition: main.c:9
#define MM_ANISOTROPIC
Definition: wingdi.h:866
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
BOOL WINAPI TextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_reads_(c) LPCWSTR lpString, _In_ int c)
BOOL WINAPI DrawIcon(_In_ HDC, _In_ int, _In_ int, _In_ HICON)
Definition: cursoricon.c:1987
#define HIMETRIC_INCHES
Definition: ole32_main.c:35
HICON hIcon
Definition: msconfig.c:44
LPCWSTR szPath
Definition: env.c:35
#define NULL
Definition: types.h:112
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define SPI_GETICONTITLELOGFONT
Definition: winuser.h:1362
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
BOOL WINAPI SetWindowOrgEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
Definition: coord.c:532
BOOL WINAPI DeleteMetaFile(_In_ HMETAFILE)
#define LOGPIXELSY
Definition: wingdi.h:718
LONG cy
Definition: windef.h:335
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
#define MulDiv(x, y, z)
Definition: gdifloat.h:86
#define GMEM_MOVEABLE
Definition: winbase.h:291
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
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)

Referenced by test_data_cache().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( ole  )