ReactOS  0.4.14-dev-41-g31d7680
insobjdlg.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "wine/winternl.h"
#include "winerror.h"
#include "wingdi.h"
#include "winuser.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "oledlg.h"
#include "resource.h"
Include dependency graph for insobjdlg.c:

Go to the source code of this file.

Classes

struct  InsertObjectDlgInfo
 

Typedefs

typedef HRESULT(* DLLREGISTER) (void)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (oledlg)
 
static INT_PTR CALLBACK UIInsertObjectDlgProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static LRESULT UIINSOBJDLG_OnWMCommand (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
static void UIINSERTOBJECTDLG_InitDialog (InsertObjectDlgInfo *pdlgInfo)
 
static void UIINSERTOBJECTDLG_SelectCreateCtrl (InsertObjectDlgInfo *pdlgInfo)
 
static void UIINSERTOBJECTDLG_SelectCreateFromFile (InsertObjectDlgInfo *pdlgInfo)
 
static void UIINSERTOBJECTDLG_SelectCreateNew (InsertObjectDlgInfo *pdlgInfo)
 
static BOOL UIINSERTOBJECTDLG_PopulateObjectTypes (InsertObjectDlgInfo *pdlgInfo)
 
static void UIINSERTOBJECTDLG_FreeObjectTypes (InsertObjectDlgInfo *pdlgInfo)
 
static void UIINSERTOBJECTDLG_SelChange (InsertObjectDlgInfo *pdlgInfo)
 
static BOOL UIINSERTOBJECTDLG_OnOpen (InsertObjectDlgInfo *pdlgInfo)
 
static void UIINSERTOBJECTDLG_BrowseFile (InsertObjectDlgInfo *pdlgInfo)
 
static void UIINSERTOBJECTDLG_AddControl (InsertObjectDlgInfo *pdlgInfo)
 
UINT WINAPI OleUIInsertObjectA (LPOLEUIINSERTOBJECTA lpOleUIInsertObject)
 

Variables

HINSTANCE OLEDLG_hInstance
 
static const WCHAR OleUIInsertObjectInfoStr []
 

Typedef Documentation

◆ DLLREGISTER

typedef HRESULT(* DLLREGISTER) (void)

Definition at line 72 of file insobjdlg.c.

Function Documentation

◆ OleUIInsertObjectA()

UINT WINAPI OleUIInsertObjectA ( LPOLEUIINSERTOBJECTA  lpOleUIInsertObject)

Definition at line 81 of file insobjdlg.c.

82 {
83  LRESULT lRes;
84  LPCVOID template;
85  HRSRC hRes;
86  InsertObjectDlgInfo dlgInfo;
87  HANDLE hDlgTmpl = 0;
88 
89  if (lpOleUIInsertObject->lpszTemplate || lpOleUIInsertObject->hResource)
90  FIXME("Customized template not supported\n");
91 
92  /* Create the dialog from a template */
94  (LPSTR)RT_DIALOG)))
95  {
97  }
98 
99  if (!(hDlgTmpl = LoadResource(OLEDLG_hInstance, hRes )) ||
100  !(template = LockResource( hDlgTmpl )))
101  {
103  }
104 
105  /* Initialize InsertObjectDlgInfo structure */
106  dlgInfo.lpOleUIInsertObject = lpOleUIInsertObject;
107  dlgInfo.bObjListInit = FALSE;
108 
109  lRes = DialogBoxIndirectParamA(OLEDLG_hInstance, (const DLGTEMPLATE*) template,
110  lpOleUIInsertObject->hWndOwner, UIInsertObjectDlgProc,
111  (LPARAM) &dlgInfo);
112 
113  /* Unable to create the dialog */
114  if( lRes == -1)
116 
117  return lRes;
118 }
#define OLEUI_ERR_FINDTEMPLATEFAILURE
Definition: oledlg.h:77
#define OLEUI_ERR_LOADTEMPLATEFAILURE
Definition: oledlg.h:78
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
#define UIINSERTOBJECT
Definition: resource.h:31
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
char * LPSTR
Definition: xmlstorage.h:182
#define FIXME(fmt,...)
Definition: debug.h:110
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
HINSTANCE OLEDLG_hInstance
Definition: oledlg_main.c:40
LONG_PTR LPARAM
Definition: windef.h:208
#define RT_DIALOG
Definition: pedump.c:367
INT_PTR WINAPI DialogBoxIndirectParamA(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
LPOLEUIINSERTOBJECTA lpOleUIInsertObject
Definition: insobjdlg.c:43
CONST void * LPCVOID
Definition: windef.h:191
#define OLEUI_ERR_DIALOGFAILURE
Definition: oledlg.h:79
static INT_PTR CALLBACK UIInsertObjectDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: insobjdlg.c:126
LONG_PTR LRESULT
Definition: windef.h:209

◆ UIINSERTOBJECTDLG_AddControl()

static void UIINSERTOBJECTDLG_AddControl ( InsertObjectDlgInfo pdlgInfo)
static

Definition at line 558 of file insobjdlg.c.

559 {
561  char fname[MAX_PATH];
562  char title[32];
563 
564  fn.lStructSize = sizeof(OPENFILENAMEA);
565  fn.hwndOwner = pdlgInfo->hwndSelf;
566  fn.hInstance = 0;
567  fn.lpstrFilter = "OLE Controls\0*.ocx\0Libraries\0*.dll\0All Files\0*.*\0\0";
568  fn.lpstrCustomFilter = NULL;
569  fn.nMaxCustFilter = 0;
570  fn.nFilterIndex = 0;
571 
572  fname[0] = 0;
573  fn.lpstrFile = fname;
574  fn.nMaxFile = MAX_PATH;
575 
576  fn.lpstrFileTitle = NULL;
577  fn.nMaxFileTitle = 0;
578  fn.lpstrInitialDir = NULL;
579 
581  fn.lpstrTitle = title;
582 
583  fn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST |
585  fn.nFileOffset = 0;
586  fn.nFileExtension = 0;
587  fn.lpstrDefExt = NULL;
588  fn.lCustData = 0;
589  fn.lpfnHook = NULL;
590  fn.lpTemplateName = NULL;
591 
592  if (GetOpenFileNameA(&fn))
593  {
594  HMODULE hMod;
595  BOOL bValid = FALSE;
596 
597  hMod = LoadLibraryA(fn.lpstrFile);
598 
599  if (hMod)
600  {
601  DLLREGISTER regproc;
602 
603  regproc = (DLLREGISTER) GetProcAddress(hMod, "DllRegisterServer");
604  if (regproc)
605  {
606  if (S_OK == regproc())
607  {
609  bValid = TRUE;
610  }
611  }
612 
613  FreeLibrary(hMod);
614  }
615 
616  if (!bValid)
617  {
618  WCHAR title[32];
619  WCHAR msg[256];
620 
623 
625  }
626  }
627 }
#define OFN_FILEMUSTEXIST
Definition: commdlg.h:106
#define OFN_EXPLORER
Definition: commdlg.h:104
#define TRUE
Definition: types.h:120
#define OFN_LONGNAMES
Definition: commdlg.h:108
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
int WINAPI LoadStringA(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPSTR lpBuffer, _In_ int cchBufferMax)
#define IDS_NOTOLEMOD
Definition: resource.h:28
#define IDS_NOTOLEMODCAPTION
Definition: resource.h:29
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
struct tagOFNA OPENFILENAMEA
#define MB_ICONEXCLAMATION
Definition: winuser.h:779
unsigned int BOOL
Definition: ntddk_ex.h:94
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
HINSTANCE OLEDLG_hInstance
Definition: oledlg_main.c:40
smooth NULL
Definition: ftsmooth.c:416
#define FreeLibrary(x)
Definition: compat.h:405
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
static BOOL UIINSERTOBJECTDLG_PopulateObjectTypes(InsertObjectDlgInfo *pdlgInfo)
Definition: insobjdlg.c:333
#define MAX_PATH
Definition: compat.h:26
#define IDS_BROWSE
Definition: resource.h:27
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
HRESULT(* DLLREGISTER)(void)
Definition: insobjdlg.c:72
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI GetOpenFileNameA(OPENFILENAMEA *ofn)
Definition: filedlg.c:4529
#define msg(x)
Definition: auth_time.c:54
#define GetProcAddress(x, y)
Definition: compat.h:410
static char title[]
Definition: ps.c:92

Referenced by UIINSOBJDLG_OnWMCommand().

◆ UIINSERTOBJECTDLG_BrowseFile()

static void UIINSERTOBJECTDLG_BrowseFile ( InsertObjectDlgInfo pdlgInfo)
static

Definition at line 514 of file insobjdlg.c.

515 {
517  char fname[MAX_PATH];
518  char title[32];
519 
520  fn.lStructSize = sizeof(OPENFILENAMEA);
521  fn.hwndOwner = pdlgInfo->hwndSelf;
522  fn.hInstance = 0;
523  fn.lpstrFilter = "All Files\0*.*\0\0";
524  fn.lpstrCustomFilter = NULL;
525  fn.nMaxCustFilter = 0;
526  fn.nFilterIndex = 0;
527 
528  SendMessageA(pdlgInfo->hwndFileTB, WM_GETTEXT, MAX_PATH, (LPARAM)fname);
529  fn.lpstrFile = fname;
530  fn.nMaxFile = MAX_PATH;
531 
532  fn.lpstrFileTitle = NULL;
533  fn.nMaxFileTitle = 0;
534  fn.lpstrInitialDir = NULL;
535 
537  fn.lpstrTitle = title;
538 
539  fn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST |
541  fn.nFileOffset = 0;
542  fn.nFileExtension = 0;
543  fn.lpstrDefExt = NULL;
544  fn.lCustData = 0;
545  fn.lpfnHook = NULL;
546  fn.lpTemplateName = NULL;
547 
548  if (GetOpenFileNameA(&fn))
549  SendMessageA(pdlgInfo->hwndFileTB, WM_SETTEXT, 0, (LPARAM)fn.lpstrFile);
550 }
#define OFN_FILEMUSTEXIST
Definition: commdlg.h:106
#define OFN_EXPLORER
Definition: commdlg.h:104
#define OFN_LONGNAMES
Definition: commdlg.h:108
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_GETTEXT
Definition: winuser.h:1600
int WINAPI LoadStringA(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPSTR lpBuffer, _In_ int cchBufferMax)
struct tagOFNA OPENFILENAMEA
HINSTANCE OLEDLG_hInstance
Definition: oledlg_main.c:40
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_SETTEXT
Definition: winuser.h:1599
#define MAX_PATH
Definition: compat.h:26
#define IDS_BROWSE
Definition: resource.h:27
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
BOOL WINAPI GetOpenFileNameA(OPENFILENAMEA *ofn)
Definition: filedlg.c:4529
static char title[]
Definition: ps.c:92

Referenced by UIINSOBJDLG_OnWMCommand().

◆ UIINSERTOBJECTDLG_FreeObjectTypes()

static void UIINSERTOBJECTDLG_FreeObjectTypes ( InsertObjectDlgInfo pdlgInfo)
static

Definition at line 398 of file insobjdlg.c.

399 {
400  UINT i, count;
401 
402  count = SendMessageA(pdlgInfo->hwndObjTypeLB, LB_GETCOUNT, 0, 0);
403 
404  for (i = 0; i < count; i++)
405  {
406  CLSID* lpclsid = (CLSID*) SendMessageA(pdlgInfo->hwndObjTypeLB,
407  LB_GETITEMDATA, i, 0);
408  HeapFree(GetProcessHeap(), 0, lpclsid);
409  }
410 }
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LB_GETITEMDATA
Definition: winuser.h:2023
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define LB_GETCOUNT
Definition: winuser.h:2020
#define GetProcessHeap()
Definition: compat.h:395
unsigned int UINT
Definition: ndis.h:50
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by UIINSERTOBJECTDLG_PopulateObjectTypes(), and UIInsertObjectDlgProc().

◆ UIINSERTOBJECTDLG_InitDialog()

static void UIINSERTOBJECTDLG_InitDialog ( InsertObjectDlgInfo pdlgInfo)
static

Definition at line 215 of file insobjdlg.c.

216 {
217  /* Initialize InsertObjectDlgInfo data structure */
218  pdlgInfo->hwndObjTypeLB = GetDlgItem(pdlgInfo->hwndSelf, IDC_OBJTYPELIST);
219  pdlgInfo->hwndObjTypeLBL = GetDlgItem(pdlgInfo->hwndSelf, IDC_OBJTYPELBL);
220  pdlgInfo->hwndFileLBL = GetDlgItem(pdlgInfo->hwndSelf, IDC_FILELBL);
221  pdlgInfo->hwndFileTB = GetDlgItem(pdlgInfo->hwndSelf, IDC_FILE);
222  pdlgInfo->hwndCreateCtrlCB = GetDlgItem(pdlgInfo->hwndSelf, IDC_CREATECONTROL);
223  pdlgInfo->hwndCreateNewCB = GetDlgItem(pdlgInfo->hwndSelf, IDC_CREATENEW);
225  pdlgInfo->hwndDisplayIconCB = GetDlgItem(pdlgInfo->hwndSelf, IDC_ASICON);
226  pdlgInfo->hwndAddCtrlBTN = GetDlgItem(pdlgInfo->hwndSelf, IDC_ADDCONTROL);
227  pdlgInfo->hwndBrowseBTN = GetDlgItem(pdlgInfo->hwndSelf, IDC_BROWSE);
228  pdlgInfo->hwndResultDesc = GetDlgItem(pdlgInfo->hwndSelf, IDC_RESULTDESC);
229 
230  /* Setup dialog controls based on flags */
231  if (pdlgInfo->lpOleUIInsertObject->lpszCaption)
233 
234  ShowWindow(pdlgInfo->hwndCreateCtrlCB, (pdlgInfo->lpOleUIInsertObject->dwFlags &
240 
245  else /* (pdlgInfo->lpOleUIInsertObject->dwFlags & IOF_SELECTCREATENEW) */
247 }
#define IDC_ADDCONTROL
Definition: resource.h:40
#define IDC_ASICON
Definition: resource.h:41
#define IDC_FILE
Definition: resource.h:44
#define SW_HIDE
Definition: winuser.h:762
#define IDC_BROWSE
Definition: resource.h:21
#define IOF_SELECTCREATEFROMFILE
Definition: oledlg.h:202
#define IOF_DISABLEDISPLAYASICON
Definition: oledlg.h:210
HWND hwndCreateFromFileCB
Definition: insobjdlg.c:51
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
static void UIINSERTOBJECTDLG_SelectCreateFromFile(InsertObjectDlgInfo *pdlgInfo)
Definition: insobjdlg.c:306
#define IOF_CHECKDISPLAYASICON
Definition: oledlg.h:204
#define SW_SHOW
Definition: winuser.h:769
#define IDC_OBJTYPELBL
Definition: resource.h:38
#define IDC_OBJTYPELIST
Definition: resource.h:33
static void UIINSERTOBJECTDLG_SelectCreateCtrl(InsertObjectDlgInfo *pdlgInfo)
Definition: insobjdlg.c:255
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
#define IDC_CREATEFROMFILE
Definition: resource.h:37
#define IDC_RESULTDESC
Definition: resource.h:39
LPOLEUIINSERTOBJECTA lpOleUIInsertObject
Definition: insobjdlg.c:43
#define IOF_SHOWINSERTCONTROL
Definition: oledlg.h:212
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define IOF_SELECTCREATECONTROL
Definition: oledlg.h:213
#define IDC_CREATENEW
Definition: resource.h:35
static void UIINSERTOBJECTDLG_SelectCreateNew(InsertObjectDlgInfo *pdlgInfo)
Definition: insobjdlg.c:279
#define IDC_FILELBL
Definition: resource.h:43
#define IDC_CREATECONTROL
Definition: resource.h:36

Referenced by UIInsertObjectDlgProc().

◆ UIINSERTOBJECTDLG_OnOpen()

static BOOL UIINSERTOBJECTDLG_OnOpen ( InsertObjectDlgInfo pdlgInfo)
static

Definition at line 443 of file insobjdlg.c.

444 {
445  BOOL bret = FALSE;
446 
447  if (BST_CHECKED == SendMessageA(pdlgInfo->hwndCreateCtrlCB, BM_GETCHECK, 0, 0) ||
449  {
450  INT index = SendMessageA(pdlgInfo->hwndObjTypeLB, LB_GETCURSEL, 0, 0);
451 
452  if (index >= 0)
453  {
454  CLSID* clsid = (CLSID*) SendMessageA(pdlgInfo->hwndObjTypeLB,
455  LB_GETITEMDATA, index, 0);
456  pdlgInfo->lpOleUIInsertObject->clsid = *clsid;
457 
459  {
460  pdlgInfo->lpOleUIInsertObject->sc= OleCreate(
461  &pdlgInfo->lpOleUIInsertObject->clsid,
462  &pdlgInfo->lpOleUIInsertObject->iid,
463  pdlgInfo->lpOleUIInsertObject->oleRender,
464  pdlgInfo->lpOleUIInsertObject->lpFormatEtc,
466  pdlgInfo->lpOleUIInsertObject->lpIStorage,
467  pdlgInfo->lpOleUIInsertObject->ppvObj);
468  }
469 
470  bret = TRUE;
471  }
472  }
473  else if (BST_CHECKED == SendMessageA(pdlgInfo->hwndCreateFromFileCB, BM_GETCHECK, 0, 0))
474  {
475  if (pdlgInfo->lpOleUIInsertObject->lpszFile)
476  {
477  HRESULT hres;
478  WCHAR wcsFile[MAX_PATH];
479 
480  if (SendMessageW(pdlgInfo->hwndFileTB, WM_GETTEXT, MAX_PATH, (LPARAM)wcsFile))
481  WideCharToMultiByte(CP_ACP, 0, wcsFile, -1,
483 
484  if (SUCCEEDED(hres = GetClassFile(wcsFile, &pdlgInfo->lpOleUIInsertObject->clsid)))
485  {
487  {
489  &pdlgInfo->lpOleUIInsertObject->clsid,
490  wcsFile,
491  &pdlgInfo->lpOleUIInsertObject->iid,
492  pdlgInfo->lpOleUIInsertObject->oleRender,
493  pdlgInfo->lpOleUIInsertObject->lpFormatEtc,
495  pdlgInfo->lpOleUIInsertObject->lpIStorage,
496  pdlgInfo->lpOleUIInsertObject->ppvObj);
497  }
498 
499  bret = TRUE;
500  }
501  pdlgInfo->lpOleUIInsertObject->sc = hres;
502  }
503  }
504 
505  return bret;
506 }
#define TRUE
Definition: types.h:120
#define IOF_CREATENEWOBJECT
Definition: oledlg.h:205
#define WideCharToMultiByte
Definition: compat.h:101
HRESULT WINAPI GetClassFile(LPCOLESTR filePathName, CLSID *pclsid)
Definition: moniker.c:1217
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CP_ACP
Definition: compat.h:99
#define LB_GETITEMDATA
Definition: winuser.h:2023
#define WM_GETTEXT
Definition: winuser.h:1600
HWND hwndCreateFromFileCB
Definition: insobjdlg.c:51
LPOLECLIENTSITE lpIOleClientSite
Definition: oledlg.h:163
int32_t INT
Definition: typedefs.h:56
#define IOF_CREATEFILEOBJECT
Definition: oledlg.h:206
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
LPFORMATETC lpFormatEtc
Definition: oledlg.h:162
LONG_PTR LPARAM
Definition: windef.h:208
#define BM_GETCHECK
Definition: winuser.h:1900
LPSTORAGE lpIStorage
Definition: oledlg.h:164
GLuint index
Definition: glext.h:6031
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI OleCreate(REFCLSID rclsid, REFIID riid, DWORD renderopt, LPFORMATETC pFormatEtc, LPOLECLIENTSITE pClientSite, LPSTORAGE pStg, LPVOID *ppvObj)
Definition: ole2.c:2612
#define MAX_PATH
Definition: compat.h:26
REFCLSID clsid
Definition: msctf.c:84
LPOLEUIINSERTOBJECTA lpOleUIInsertObject
Definition: insobjdlg.c:43
HRESULT WINAPI OleCreateFromFile(REFCLSID clsid, const OLECHAR *filename, REFIID iid, DWORD renderopt, FORMATETC *fmt, IOleClientSite *client_site, IStorage *storage, void **obj)
Definition: ole2impl.c:402
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LB_GETCURSEL
Definition: winuser.h:2021
#define BST_CHECKED
Definition: winuser.h:197
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by UIINSOBJDLG_OnWMCommand().

◆ UIINSERTOBJECTDLG_PopulateObjectTypes()

static BOOL UIINSERTOBJECTDLG_PopulateObjectTypes ( InsertObjectDlgInfo pdlgInfo)
static

Definition at line 333 of file insobjdlg.c.

334 {
335  static const WCHAR szClsid[] = {'C','L','S','I','D',0};
336  static const WCHAR szInsertable[] = {'I','n','s','e','r','t','a','b','l','e',0};
337  static const WCHAR szNotInsertable[] = {'N','o','t','I','n','s','e','r','t','a','b','l','e',0};
338  DWORD i;
339  LONG len;
340  HKEY hkclsids;
341  HKEY hkey;
342  CLSID clsid;
343  LSTATUS ret;
344  WCHAR keydesc[MAX_PATH];
345  WCHAR keyname[MAX_PATH];
346  WCHAR szclsid[128];
347  DWORD index = 0;
348 
350 
351  RegOpenKeyExW(HKEY_CLASSES_ROOT, szClsid, 0, KEY_READ, &hkclsids);
352 
353  while (ERROR_SUCCESS == (ret = RegEnumKeyW(hkclsids, index, szclsid, ARRAY_SIZE(szclsid))))
354  {
355  index++;
356 
357  RegOpenKeyExW(hkclsids, szclsid, 0, KEY_READ, &hkey);
358 
359  len = sizeof(keyname);
360  if (ERROR_SUCCESS != RegQueryValueW(hkey, szInsertable, keyname, &len))
361  continue;
362 
363  len = sizeof(keyname);
364  if (ERROR_SUCCESS == RegQueryValueW(hkey, szNotInsertable, keyname, &len))
365  continue;
366 
367  CLSIDFromString(szclsid, &clsid);
368 
369  for (i = 0; i < pdlgInfo->lpOleUIInsertObject->cClsidExclude; i++)
371  break;
372 
373  if (i < pdlgInfo->lpOleUIInsertObject->cClsidExclude)
374  continue;
375 
376  len = sizeof(keydesc);
377  if (ERROR_SUCCESS == RegQueryValueW(hkey, NULL, keydesc, &len))
378  {
379  CLSID* lpclsid = HeapAlloc(GetProcessHeap(), 0, sizeof(CLSID));
380  *lpclsid = clsid;
381 
382  len = SendMessageW(pdlgInfo->hwndObjTypeLB, LB_ADDSTRING, 0, (LPARAM)keydesc);
383  SendMessageW(pdlgInfo->hwndObjTypeLB, LB_SETITEMDATA, len, (LPARAM)lpclsid);
384  }
385  }
386 
387  pdlgInfo->bObjListInit = (ret == ERROR_NO_MORE_ITEMS);
388 
389  return pdlgInfo->bObjListInit;
390 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define LB_ADDSTRING
Definition: winuser.h:2013
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
#define KEY_READ
Definition: nt_native.h:1023
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
GLuint index
Definition: glext.h:6031
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LSTATUS WINAPI RegQueryValueW(HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count)
Definition: reg.c:4254
#define MAX_PATH
Definition: compat.h:26
LPCLSID lpClsidExclude
Definition: oledlg.h:159
unsigned long DWORD
Definition: ntddk_ex.h:95
#define LB_SETITEMDATA
Definition: winuser.h:2047
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
int ret
REFCLSID clsid
Definition: msctf.c:84
LPOLEUIINSERTOBJECTA lpOleUIInsertObject
Definition: insobjdlg.c:43
GLenum GLsizei len
Definition: glext.h:6722
LONG WINAPI RegEnumKeyW(HKEY hKey, DWORD dwIndex, LPWSTR lpName, DWORD cbName)
Definition: reg.c:2416
static void UIINSERTOBJECTDLG_FreeObjectTypes(InsertObjectDlgInfo *pdlgInfo)
Definition: insobjdlg.c:398
#define ARRAY_SIZE(a)
Definition: main.h:24
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2247
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10

Referenced by UIINSERTOBJECTDLG_AddControl(), UIINSERTOBJECTDLG_SelectCreateCtrl(), and UIINSERTOBJECTDLG_SelectCreateNew().

◆ UIINSERTOBJECTDLG_SelChange()

static void UIINSERTOBJECTDLG_SelChange ( InsertObjectDlgInfo pdlgInfo)
static

Definition at line 418 of file insobjdlg.c.

419 {
420  INT index;
421  WCHAR objname[MAX_PATH];
422  WCHAR objdesc[MAX_PATH];
423  WCHAR resstr[MAX_PATH];
424 
425  TRACE("\n");
426 
428  ((index = SendMessageW(pdlgInfo->hwndObjTypeLB, LB_GETCURSEL, 0, 0)) >= 0) &&
429  SendMessageW(pdlgInfo->hwndObjTypeLB, LB_GETTEXT, index, (LPARAM)objname))
430  wsprintfW(objdesc, resstr, objname);
431  else
432  objdesc[0] = 0;
433 
434  SendMessageW(pdlgInfo->hwndResultDesc, WM_SETTEXT, 0, (LPARAM)objdesc);
435 }
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int32_t INT
Definition: typedefs.h:56
HINSTANCE OLEDLG_hInstance
Definition: oledlg_main.c:40
LONG_PTR LPARAM
Definition: windef.h:208
GLuint index
Definition: glext.h:6031
#define WM_SETTEXT
Definition: winuser.h:1599
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
#define index(s, c)
Definition: various.h:29
#define LB_GETTEXT
Definition: winuser.h:2031
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LB_GETCURSEL
Definition: winuser.h:2021
#define IDS_RESULTOBJDESC
Definition: resource.h:25

Referenced by UIINSERTOBJECTDLG_SelectCreateNew(), and UIINSOBJDLG_OnWMCommand().

◆ UIINSERTOBJECTDLG_SelectCreateCtrl()

static void UIINSERTOBJECTDLG_SelectCreateCtrl ( InsertObjectDlgInfo pdlgInfo)
static

Definition at line 255 of file insobjdlg.c.

256 {
258  ShowWindow(pdlgInfo->hwndFileLBL, SW_HIDE);
259  ShowWindow(pdlgInfo->hwndFileTB, SW_HIDE);
260  ShowWindow(pdlgInfo->hwndBrowseBTN, SW_HIDE);
261 
262  ShowWindow(pdlgInfo->hwndObjTypeLBL, SW_SHOW);
263  ShowWindow(pdlgInfo->hwndObjTypeLB, SW_SHOW);
264  ShowWindow(pdlgInfo->hwndAddCtrlBTN, SW_SHOW);
265 
267 
268  /* Populate object type listbox */
269  if (!pdlgInfo->bObjListInit)
271 }
#define SW_HIDE
Definition: winuser.h:762
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define SW_SHOW
Definition: winuser.h:769
#define BM_SETCHECK
Definition: winuser.h:1903
static BOOL UIINSERTOBJECTDLG_PopulateObjectTypes(InsertObjectDlgInfo *pdlgInfo)
Definition: insobjdlg.c:333
#define BST_CHECKED
Definition: winuser.h:197

Referenced by UIINSERTOBJECTDLG_InitDialog(), and UIINSOBJDLG_OnWMCommand().

◆ UIINSERTOBJECTDLG_SelectCreateFromFile()

static void UIINSERTOBJECTDLG_SelectCreateFromFile ( InsertObjectDlgInfo pdlgInfo)
static

Definition at line 306 of file insobjdlg.c.

307 {
308  WCHAR resstr[MAX_PATH];
309 
310  ShowWindow(pdlgInfo->hwndAddCtrlBTN, SW_HIDE);
311  ShowWindow(pdlgInfo->hwndObjTypeLBL, SW_HIDE);
312  ShowWindow(pdlgInfo->hwndObjTypeLB, SW_HIDE);
313 
316 
317  ShowWindow(pdlgInfo->hwndFileLBL, SW_SHOW);
318  ShowWindow(pdlgInfo->hwndFileTB, SW_SHOW);
319  ShowWindow(pdlgInfo->hwndBrowseBTN, SW_SHOW);
320 
322 
324  SendMessageW(pdlgInfo->hwndResultDesc, WM_SETTEXT, 0, (LPARAM)resstr);
325 }
#define SW_HIDE
Definition: winuser.h:762
HWND hwndCreateFromFileCB
Definition: insobjdlg.c:51
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define IOF_CHECKDISPLAYASICON
Definition: oledlg.h:204
HINSTANCE OLEDLG_hInstance
Definition: oledlg_main.c:40
LONG_PTR LPARAM
Definition: windef.h:208
#define SW_SHOW
Definition: winuser.h:769
#define WM_SETTEXT
Definition: winuser.h:1599
#define BM_SETCHECK
Definition: winuser.h:1903
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
LPOLEUIINSERTOBJECTA lpOleUIInsertObject
Definition: insobjdlg.c:43
#define IDS_RESULTFILEOBJDESC
Definition: resource.h:26
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define BST_CHECKED
Definition: winuser.h:197

Referenced by UIINSERTOBJECTDLG_InitDialog(), and UIINSOBJDLG_OnWMCommand().

◆ UIINSERTOBJECTDLG_SelectCreateNew()

static void UIINSERTOBJECTDLG_SelectCreateNew ( InsertObjectDlgInfo pdlgInfo)
static

Definition at line 279 of file insobjdlg.c.

280 {
281  ShowWindow(pdlgInfo->hwndFileLBL, SW_HIDE);
282  ShowWindow(pdlgInfo->hwndFileTB, SW_HIDE);
283  ShowWindow(pdlgInfo->hwndAddCtrlBTN, SW_HIDE);
284  ShowWindow(pdlgInfo->hwndBrowseBTN, SW_HIDE);
285 
288 
289  ShowWindow(pdlgInfo->hwndObjTypeLBL, SW_SHOW);
290  ShowWindow(pdlgInfo->hwndObjTypeLB, SW_SHOW);
291 
293 
294  if (!pdlgInfo->bObjListInit)
296 
297  UIINSERTOBJECTDLG_SelChange(pdlgInfo);
298 }
static void UIINSERTOBJECTDLG_SelChange(InsertObjectDlgInfo *pdlgInfo)
Definition: insobjdlg.c:418
#define SW_HIDE
Definition: winuser.h:762
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IOF_CHECKDISPLAYASICON
Definition: oledlg.h:204
#define SW_SHOW
Definition: winuser.h:769
#define BM_SETCHECK
Definition: winuser.h:1903
static BOOL UIINSERTOBJECTDLG_PopulateObjectTypes(InsertObjectDlgInfo *pdlgInfo)
Definition: insobjdlg.c:333
LPOLEUIINSERTOBJECTA lpOleUIInsertObject
Definition: insobjdlg.c:43
#define BST_CHECKED
Definition: winuser.h:197

Referenced by UIINSERTOBJECTDLG_InitDialog(), and UIINSOBJDLG_OnWMCommand().

◆ UIInsertObjectDlgProc()

INT_PTR CALLBACK UIInsertObjectDlgProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 126 of file insobjdlg.c.

127 {
129 
130  switch(uMsg)
131  {
132  case WM_INITDIALOG:
133  {
135 
136  pdlgInfo->hwndSelf = hwnd;
137 
139 
141 
142  return 0;
143  }
144 
145  case WM_COMMAND:
147 
148  case WM_DESTROY:
149  if (pdlgInfo)
152  return FALSE;
153 
154  default :
155  return FALSE;
156  }
157 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static LRESULT UIINSOBJDLG_OnWMCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
Definition: insobjdlg.c:165
WPARAM wParam
Definition: combotst.c:138
HANDLE WINAPI RemovePropW(_In_ HWND, _In_ LPCWSTR)
#define WM_DESTROY
Definition: winuser.h:1591
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
static const WCHAR OleUIInsertObjectInfoStr[]
Definition: insobjdlg.c:75
#define WM_COMMAND
Definition: winuser.h:1722
static void UIINSERTOBJECTDLG_InitDialog(InsertObjectDlgInfo *pdlgInfo)
Definition: insobjdlg.c:215
static void UIINSERTOBJECTDLG_FreeObjectTypes(InsertObjectDlgInfo *pdlgInfo)
Definition: insobjdlg.c:398
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139

Referenced by OleUIInsertObjectA().

◆ UIINSOBJDLG_OnWMCommand()

static LRESULT UIINSOBJDLG_OnWMCommand ( HWND  hwnd,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 165 of file insobjdlg.c.

166 {
168  WORD wNotifyCode = HIWORD(wParam);
169  WORD wID = LOWORD(wParam);
170 
171  switch(wID)
172  {
173  case IDOK:
175  break;
176 
177  case IDCANCEL:
178  EndDialog(hwnd, FALSE);
179  break;
180 
181  case IDC_CREATECONTROL:
183  break;
184 
185  case IDC_CREATENEW:
187  break;
188 
189  case IDC_CREATEFROMFILE:
191  break;
192 
193  case IDC_BROWSE:
195  break;
196 
197  case IDC_ADDCONTROL:
199  break;
200 
201  case IDC_OBJTYPELIST:
202  if (wNotifyCode == LBN_SELCHANGE)
203  UIINSERTOBJECTDLG_SelChange(pdlgInfo);
204  break;
205  }
206  return 0;
207 }
static void UIINSERTOBJECTDLG_SelChange(InsertObjectDlgInfo *pdlgInfo)
Definition: insobjdlg.c:418
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IDC_ADDCONTROL
Definition: resource.h:40
#define IDOK
Definition: winuser.h:824
#define IDC_BROWSE
Definition: resource.h:21
static BOOL UIINSERTOBJECTDLG_OnOpen(InsertObjectDlgInfo *pdlgInfo)
Definition: insobjdlg.c:443
static void UIINSERTOBJECTDLG_AddControl(InsertObjectDlgInfo *pdlgInfo)
Definition: insobjdlg.c:558
#define LBN_SELCHANGE
Definition: winuser.h:2057
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
static void UIINSERTOBJECTDLG_SelectCreateFromFile(InsertObjectDlgInfo *pdlgInfo)
Definition: insobjdlg.c:306
#define IDC_OBJTYPELIST
Definition: resource.h:33
static void UIINSERTOBJECTDLG_SelectCreateCtrl(InsertObjectDlgInfo *pdlgInfo)
Definition: insobjdlg.c:255
#define IDC_CREATEFROMFILE
Definition: resource.h:37
unsigned short WORD
Definition: ntddk_ex.h:93
static const WCHAR OleUIInsertObjectInfoStr[]
Definition: insobjdlg.c:75
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
#define HIWORD(l)
Definition: typedefs.h:246
#define IDC_CREATENEW
Definition: resource.h:35
static void UIINSERTOBJECTDLG_SelectCreateNew(InsertObjectDlgInfo *pdlgInfo)
Definition: insobjdlg.c:279
#define IDCANCEL
Definition: winuser.h:825
#define LOWORD(l)
Definition: pedump.c:82
static void UIINSERTOBJECTDLG_BrowseFile(InsertObjectDlgInfo *pdlgInfo)
Definition: insobjdlg.c:514
#define IDC_CREATECONTROL
Definition: resource.h:36

Referenced by UIInsertObjectDlgProc().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( oledlg  )

Variable Documentation

◆ OLEDLG_hInstance

◆ OleUIInsertObjectInfoStr

const WCHAR OleUIInsertObjectInfoStr[]
static
Initial value:
= {'O','l','e','U','I','I','n','s','e','r','t','O','b','j','e','c','t',
'I','n','f','o','S','t','r',0}

Definition at line 75 of file insobjdlg.c.

Referenced by UIInsertObjectDlgProc(), and UIINSOBJDLG_OnWMCommand().