4 * Copyright 2003 Ulrich Czekalla for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
31 #include "wine/debug.h"
32 #include "wine/unicode.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(oledlg
);
42 BOOL bObjListInit
; /* Object list has been initialized */
43 LPOLEUIINSERTOBJECTA lpOleUIInsertObject
;
49 HWND hwndCreateCtrlCB
;
51 HWND hwndCreateFromFileCB
;
52 HWND hwndDisplayIconCB
;
57 } InsertObjectDlgInfo
;
59 static INT_PTR CALLBACK
UIInsertObjectDlgProc(HWND hwnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
60 static LRESULT
UIINSOBJDLG_OnWMCommand(HWND hwnd
, WPARAM wParam
, LPARAM lParam
);
61 static void UIINSERTOBJECTDLG_InitDialog(InsertObjectDlgInfo
* pdlgInfo
);
62 static void UIINSERTOBJECTDLG_SelectCreateCtrl(InsertObjectDlgInfo
* pdlgInfo
);
63 static void UIINSERTOBJECTDLG_SelectCreateFromFile(InsertObjectDlgInfo
* pdlgInfo
);
64 static void UIINSERTOBJECTDLG_SelectCreateNew(InsertObjectDlgInfo
* pdlgInfo
);
65 static BOOL
UIINSERTOBJECTDLG_PopulateObjectTypes(InsertObjectDlgInfo
* pdlgInfo
);
66 static void UIINSERTOBJECTDLG_FreeObjectTypes(InsertObjectDlgInfo
* pdlgInfo
);
67 static void UIINSERTOBJECTDLG_SelChange(InsertObjectDlgInfo
* pdlgInfo
);
68 static BOOL
UIINSERTOBJECTDLG_OnOpen(InsertObjectDlgInfo
* pdlgInfo
);
69 static void UIINSERTOBJECTDLG_BrowseFile(InsertObjectDlgInfo
* pdlgInfo
);
70 static void UIINSERTOBJECTDLG_AddControl(InsertObjectDlgInfo
* pdlgInfo
);
72 typedef HRESULT (*DLLREGISTER
) (void);
74 extern HINSTANCE OLEDLG_hInstance
;
75 static const WCHAR OleUIInsertObjectInfoStr
[] = {'O','l','e','U','I','I','n','s','e','r','t','O','b','j','e','c','t',
76 'I','n','f','o','S','t','r',0};
78 /***********************************************************************
79 * OleUIInsertObjectA (OLEDLG.3)
81 UINT WINAPI
OleUIInsertObjectA(LPOLEUIINSERTOBJECTA lpOleUIInsertObject
)
86 InsertObjectDlgInfo dlgInfo
;
89 if (lpOleUIInsertObject
->lpszTemplate
|| lpOleUIInsertObject
->hResource
)
90 FIXME("Customized template not supported\n");
92 /* Create the dialog from a template */
93 if(!(hRes
= FindResourceA(OLEDLG_hInstance
,MAKEINTRESOURCEA(UIINSERTOBJECT
),
96 return OLEUI_ERR_FINDTEMPLATEFAILURE
;
99 if (!(hDlgTmpl
= LoadResource(OLEDLG_hInstance
, hRes
)) ||
100 !(template = LockResource( hDlgTmpl
)))
102 return OLEUI_ERR_LOADTEMPLATEFAILURE
;
105 /* Initialize InsertObjectDlgInfo structure */
106 dlgInfo
.lpOleUIInsertObject
= lpOleUIInsertObject
;
107 dlgInfo
.bObjListInit
= FALSE
;
109 lRes
= DialogBoxIndirectParamA(OLEDLG_hInstance
, (const DLGTEMPLATE
*) template,
110 lpOleUIInsertObject
->hWndOwner
, UIInsertObjectDlgProc
,
113 /* Unable to create the dialog */
115 return OLEUI_ERR_DIALOGFAILURE
;
121 /***********************************************************************
122 * UIInsertObjectDlgProc
124 * OLE UI Insert Object dialog procedure
126 INT_PTR CALLBACK
UIInsertObjectDlgProc(HWND hwnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
128 InsertObjectDlgInfo
* pdlgInfo
= GetPropW(hwnd
, OleUIInsertObjectInfoStr
);
134 InsertObjectDlgInfo
* pdlgInfo
= (InsertObjectDlgInfo
*)lParam
;
136 pdlgInfo
->hwndSelf
= hwnd
;
138 SetPropW(hwnd
, OleUIInsertObjectInfoStr
, pdlgInfo
);
140 UIINSERTOBJECTDLG_InitDialog(pdlgInfo
);
146 return UIINSOBJDLG_OnWMCommand(hwnd
, wParam
, lParam
);
150 UIINSERTOBJECTDLG_FreeObjectTypes(pdlgInfo
);
151 RemovePropW(hwnd
, OleUIInsertObjectInfoStr
);
160 /***********************************************************************
161 * UIINSOBJDLG_OnWMCommand
163 * WM_COMMAND message handler
165 static LRESULT
UIINSOBJDLG_OnWMCommand(HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
167 InsertObjectDlgInfo
* pdlgInfo
= GetPropW(hwnd
, OleUIInsertObjectInfoStr
);
168 WORD wNotifyCode
= HIWORD(wParam
);
169 WORD wID
= LOWORD(wParam
);
174 EndDialog(hwnd
, UIINSERTOBJECTDLG_OnOpen(pdlgInfo
));
178 EndDialog(hwnd
, FALSE
);
181 case IDC_CREATECONTROL
:
182 UIINSERTOBJECTDLG_SelectCreateCtrl(pdlgInfo
);
186 UIINSERTOBJECTDLG_SelectCreateNew(pdlgInfo
);
189 case IDC_CREATEFROMFILE
:
190 UIINSERTOBJECTDLG_SelectCreateFromFile(pdlgInfo
);
194 UIINSERTOBJECTDLG_BrowseFile(pdlgInfo
);
198 UIINSERTOBJECTDLG_AddControl(pdlgInfo
);
201 case IDC_OBJTYPELIST
:
202 if (wNotifyCode
== LBN_SELCHANGE
)
203 UIINSERTOBJECTDLG_SelChange(pdlgInfo
);
210 /***********************************************************************
211 * UIINSERTOBJECTDLG_InitDialog
213 * Initialize dialog display
215 static void UIINSERTOBJECTDLG_InitDialog(InsertObjectDlgInfo
* pdlgInfo
)
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
);
224 pdlgInfo
->hwndCreateFromFileCB
= GetDlgItem(pdlgInfo
->hwndSelf
, IDC_CREATEFROMFILE
);
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
);
230 /* Setup dialog controls based on flags */
231 if (pdlgInfo
->lpOleUIInsertObject
->lpszCaption
)
232 SetWindowTextA(pdlgInfo
->hwndSelf
, pdlgInfo
->lpOleUIInsertObject
->lpszCaption
);
234 ShowWindow(pdlgInfo
->hwndCreateCtrlCB
, (pdlgInfo
->lpOleUIInsertObject
->dwFlags
&
235 IOF_SHOWINSERTCONTROL
) ? SW_SHOW
: SW_HIDE
);
236 ShowWindow(pdlgInfo
->hwndDisplayIconCB
, (pdlgInfo
->lpOleUIInsertObject
->dwFlags
&
237 IOF_CHECKDISPLAYASICON
) ? SW_SHOW
: SW_HIDE
);
238 EnableWindow(pdlgInfo
->hwndDisplayIconCB
, !(pdlgInfo
->lpOleUIInsertObject
->dwFlags
&
239 IOF_DISABLEDISPLAYASICON
));
241 if (pdlgInfo
->lpOleUIInsertObject
->dwFlags
& IOF_SELECTCREATECONTROL
)
242 UIINSERTOBJECTDLG_SelectCreateCtrl(pdlgInfo
);
243 else if (pdlgInfo
->lpOleUIInsertObject
->dwFlags
& IOF_SELECTCREATEFROMFILE
)
244 UIINSERTOBJECTDLG_SelectCreateFromFile(pdlgInfo
);
245 else /* (pdlgInfo->lpOleUIInsertObject->dwFlags & IOF_SELECTCREATENEW) */
246 UIINSERTOBJECTDLG_SelectCreateNew(pdlgInfo
);
250 /***********************************************************************
251 * UIINSERTOBJECTDLG_SelectCreateCtrl
253 * Select Create Control Radio Button
255 static void UIINSERTOBJECTDLG_SelectCreateCtrl(InsertObjectDlgInfo
* pdlgInfo
)
257 ShowWindow(pdlgInfo
->hwndDisplayIconCB
, SW_HIDE
);
258 ShowWindow(pdlgInfo
->hwndFileLBL
, SW_HIDE
);
259 ShowWindow(pdlgInfo
->hwndFileTB
, SW_HIDE
);
260 ShowWindow(pdlgInfo
->hwndBrowseBTN
, SW_HIDE
);
262 ShowWindow(pdlgInfo
->hwndObjTypeLBL
, SW_SHOW
);
263 ShowWindow(pdlgInfo
->hwndObjTypeLB
, SW_SHOW
);
264 ShowWindow(pdlgInfo
->hwndAddCtrlBTN
, SW_SHOW
);
266 SendMessageA(pdlgInfo
->hwndCreateCtrlCB
, BM_SETCHECK
, BST_CHECKED
, 0);
268 /* Populate object type listbox */
269 if (!pdlgInfo
->bObjListInit
)
270 UIINSERTOBJECTDLG_PopulateObjectTypes(pdlgInfo
);
274 /***********************************************************************
275 * UIINSERTOBJECTDLG_SelectCreateNew
277 * Select Create New Radio Button
279 static void UIINSERTOBJECTDLG_SelectCreateNew(InsertObjectDlgInfo
* pdlgInfo
)
281 ShowWindow(pdlgInfo
->hwndFileLBL
, SW_HIDE
);
282 ShowWindow(pdlgInfo
->hwndFileTB
, SW_HIDE
);
283 ShowWindow(pdlgInfo
->hwndAddCtrlBTN
, SW_HIDE
);
284 ShowWindow(pdlgInfo
->hwndBrowseBTN
, SW_HIDE
);
286 if (pdlgInfo
->lpOleUIInsertObject
->dwFlags
& IOF_CHECKDISPLAYASICON
)
287 ShowWindow(pdlgInfo
->hwndDisplayIconCB
, SW_SHOW
);
289 ShowWindow(pdlgInfo
->hwndObjTypeLBL
, SW_SHOW
);
290 ShowWindow(pdlgInfo
->hwndObjTypeLB
, SW_SHOW
);
292 SendMessageA(pdlgInfo
->hwndCreateNewCB
, BM_SETCHECK
, BST_CHECKED
, 0);
294 if (!pdlgInfo
->bObjListInit
)
295 UIINSERTOBJECTDLG_PopulateObjectTypes(pdlgInfo
);
297 UIINSERTOBJECTDLG_SelChange(pdlgInfo
);
301 /***********************************************************************
302 * UIINSERTOBJECTDLG_SelectCreateFromFile
304 * Select Create From File Radio Button
306 static void UIINSERTOBJECTDLG_SelectCreateFromFile(InsertObjectDlgInfo
* pdlgInfo
)
308 WCHAR resstr
[MAX_PATH
];
310 ShowWindow(pdlgInfo
->hwndAddCtrlBTN
, SW_HIDE
);
311 ShowWindow(pdlgInfo
->hwndObjTypeLBL
, SW_HIDE
);
312 ShowWindow(pdlgInfo
->hwndObjTypeLB
, SW_HIDE
);
314 if (pdlgInfo
->lpOleUIInsertObject
->dwFlags
& IOF_CHECKDISPLAYASICON
)
315 ShowWindow(pdlgInfo
->hwndDisplayIconCB
, SW_SHOW
);
317 ShowWindow(pdlgInfo
->hwndFileLBL
, SW_SHOW
);
318 ShowWindow(pdlgInfo
->hwndFileTB
, SW_SHOW
);
319 ShowWindow(pdlgInfo
->hwndBrowseBTN
, SW_SHOW
);
321 SendMessageW(pdlgInfo
->hwndCreateFromFileCB
, BM_SETCHECK
, BST_CHECKED
, 0);
323 if (LoadStringW(OLEDLG_hInstance
, IDS_RESULTFILEOBJDESC
, resstr
, MAX_PATH
))
324 SendMessageW(pdlgInfo
->hwndResultDesc
, WM_SETTEXT
, 0, (LPARAM
)resstr
);
328 /***********************************************************************
329 * UIINSERTOBJECTDLG_PopulateObjectTypes
331 * Populate Object Type listbox
333 static BOOL
UIINSERTOBJECTDLG_PopulateObjectTypes(InsertObjectDlgInfo
* pdlgInfo
)
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};
344 WCHAR keydesc
[MAX_PATH
];
345 WCHAR keyname
[MAX_PATH
];
349 UIINSERTOBJECTDLG_FreeObjectTypes(pdlgInfo
);
351 RegOpenKeyExW(HKEY_CLASSES_ROOT
, szClsid
, 0, KEY_READ
, &hkclsids
);
353 while (ERROR_SUCCESS
== (ret
= RegEnumKeyW(hkclsids
, index
, szclsid
, sizeof(szclsid
)/sizeof(szclsid
[0]))))
357 RegOpenKeyExW(hkclsids
, szclsid
, 0, KEY_READ
, &hkey
);
359 len
= sizeof(keyname
);
360 if (ERROR_SUCCESS
!= RegQueryValueW(hkey
, szInsertable
, keyname
, &len
))
363 len
= sizeof(keyname
);
364 if (ERROR_SUCCESS
== RegQueryValueW(hkey
, szNotInsertable
, keyname
, &len
))
367 CLSIDFromString(szclsid
, &clsid
);
369 for (i
= 0; i
< pdlgInfo
->lpOleUIInsertObject
->cClsidExclude
; i
++)
370 if (IsEqualGUID(&pdlgInfo
->lpOleUIInsertObject
->lpClsidExclude
[i
], &clsid
))
373 if (i
< pdlgInfo
->lpOleUIInsertObject
->cClsidExclude
)
376 len
= sizeof(keydesc
);
377 if (ERROR_SUCCESS
== RegQueryValueW(hkey
, NULL
, keydesc
, &len
))
379 CLSID
* lpclsid
= HeapAlloc(GetProcessHeap(), 0, sizeof(CLSID
));
382 len
= SendMessageW(pdlgInfo
->hwndObjTypeLB
, LB_ADDSTRING
, 0, (LPARAM
)keydesc
);
383 SendMessageW(pdlgInfo
->hwndObjTypeLB
, LB_SETITEMDATA
, len
, (LPARAM
)lpclsid
);
387 pdlgInfo
->bObjListInit
= (ret
== ERROR_NO_MORE_ITEMS
);
389 return pdlgInfo
->bObjListInit
;
393 /***********************************************************************
394 * UIINSERTOBJECTDLG_FreeObjectTypes
396 * Free Object Types listbox
398 static void UIINSERTOBJECTDLG_FreeObjectTypes(InsertObjectDlgInfo
* pdlgInfo
)
402 count
= SendMessageA(pdlgInfo
->hwndObjTypeLB
, LB_GETCOUNT
, 0, 0);
404 for (i
= 0; i
< count
; i
++)
406 CLSID
* lpclsid
= (CLSID
*) SendMessageA(pdlgInfo
->hwndObjTypeLB
,
407 LB_GETITEMDATA
, i
, 0);
408 HeapFree(GetProcessHeap(), 0, lpclsid
);
413 /***********************************************************************
414 * UIINSERTOBJECTDLG_SelChange
416 * Handle object type selection change
418 static void UIINSERTOBJECTDLG_SelChange(InsertObjectDlgInfo
* pdlgInfo
)
421 WCHAR objname
[MAX_PATH
];
422 WCHAR objdesc
[MAX_PATH
];
423 WCHAR resstr
[MAX_PATH
];
427 if (LoadStringW(OLEDLG_hInstance
, IDS_RESULTOBJDESC
, resstr
, MAX_PATH
) &&
428 ((index
= SendMessageW(pdlgInfo
->hwndObjTypeLB
, LB_GETCURSEL
, 0, 0)) >= 0) &&
429 SendMessageW(pdlgInfo
->hwndObjTypeLB
, LB_GETTEXT
, index
, (LPARAM
)objname
))
430 wsprintfW(objdesc
, resstr
, objname
);
434 SendMessageW(pdlgInfo
->hwndResultDesc
, WM_SETTEXT
, 0, (LPARAM
)objdesc
);
438 /***********************************************************************
439 * UIINSERTOBJECTDLG_SelChange
443 static BOOL
UIINSERTOBJECTDLG_OnOpen(InsertObjectDlgInfo
* pdlgInfo
)
447 if (BST_CHECKED
== SendMessageA(pdlgInfo
->hwndCreateCtrlCB
, BM_GETCHECK
, 0, 0) ||
448 BST_CHECKED
== SendMessageA(pdlgInfo
->hwndCreateNewCB
, BM_GETCHECK
, 0, 0))
450 INT index
= SendMessageA(pdlgInfo
->hwndObjTypeLB
, LB_GETCURSEL
, 0, 0);
454 CLSID
* clsid
= (CLSID
*) SendMessageA(pdlgInfo
->hwndObjTypeLB
,
455 LB_GETITEMDATA
, index
, 0);
456 pdlgInfo
->lpOleUIInsertObject
->clsid
= *clsid
;
458 if (pdlgInfo
->lpOleUIInsertObject
->dwFlags
& IOF_CREATENEWOBJECT
)
460 pdlgInfo
->lpOleUIInsertObject
->sc
= OleCreate(
461 &pdlgInfo
->lpOleUIInsertObject
->clsid
,
462 &pdlgInfo
->lpOleUIInsertObject
->iid
,
463 pdlgInfo
->lpOleUIInsertObject
->oleRender
,
464 pdlgInfo
->lpOleUIInsertObject
->lpFormatEtc
,
465 pdlgInfo
->lpOleUIInsertObject
->lpIOleClientSite
,
466 pdlgInfo
->lpOleUIInsertObject
->lpIStorage
,
467 pdlgInfo
->lpOleUIInsertObject
->ppvObj
);
473 else if (BST_CHECKED
== SendMessageA(pdlgInfo
->hwndCreateFromFileCB
, BM_GETCHECK
, 0, 0))
475 if (pdlgInfo
->lpOleUIInsertObject
->lpszFile
)
478 WCHAR wcsFile
[MAX_PATH
];
480 if (SendMessageW(pdlgInfo
->hwndFileTB
, WM_GETTEXT
, MAX_PATH
, (LPARAM
)wcsFile
))
481 WideCharToMultiByte(CP_ACP
, 0, wcsFile
, -1,
482 pdlgInfo
->lpOleUIInsertObject
->lpszFile
, pdlgInfo
->lpOleUIInsertObject
->cchFile
, NULL
, NULL
);
484 if (SUCCEEDED(hres
= GetClassFile(wcsFile
, &pdlgInfo
->lpOleUIInsertObject
->clsid
)))
486 if (pdlgInfo
->lpOleUIInsertObject
->dwFlags
& IOF_CREATEFILEOBJECT
)
488 hres
= OleCreateFromFile(
489 &pdlgInfo
->lpOleUIInsertObject
->clsid
,
491 &pdlgInfo
->lpOleUIInsertObject
->iid
,
492 pdlgInfo
->lpOleUIInsertObject
->oleRender
,
493 pdlgInfo
->lpOleUIInsertObject
->lpFormatEtc
,
494 pdlgInfo
->lpOleUIInsertObject
->lpIOleClientSite
,
495 pdlgInfo
->lpOleUIInsertObject
->lpIStorage
,
496 pdlgInfo
->lpOleUIInsertObject
->ppvObj
);
501 pdlgInfo
->lpOleUIInsertObject
->sc
= hres
;
509 /***********************************************************************
510 * UIINSERTOBJECTDLG_BrowseFile
512 * Browse for the file
514 static void UIINSERTOBJECTDLG_BrowseFile(InsertObjectDlgInfo
* pdlgInfo
)
517 char fname
[MAX_PATH
];
520 fn
.lStructSize
= sizeof(OPENFILENAMEA
);
521 fn
.hwndOwner
= pdlgInfo
->hwndSelf
;
523 fn
.lpstrFilter
= "All Files\0*.*\0\0";
524 fn
.lpstrCustomFilter
= NULL
;
525 fn
.nMaxCustFilter
= 0;
528 SendMessageA(pdlgInfo
->hwndFileTB
, WM_GETTEXT
, MAX_PATH
, (LPARAM
)fname
);
529 fn
.lpstrFile
= fname
;
530 fn
.nMaxFile
= MAX_PATH
;
532 fn
.lpstrFileTitle
= NULL
;
533 fn
.nMaxFileTitle
= 0;
534 fn
.lpstrInitialDir
= NULL
;
536 LoadStringA(OLEDLG_hInstance
, IDS_BROWSE
, title
, 32);
537 fn
.lpstrTitle
= title
;
539 fn
.Flags
= OFN_EXPLORER
| OFN_FILEMUSTEXIST
|
540 OFN_HIDEREADONLY
| OFN_LONGNAMES
;
542 fn
.nFileExtension
= 0;
543 fn
.lpstrDefExt
= NULL
;
546 fn
.lpTemplateName
= NULL
;
548 if (GetOpenFileNameA(&fn
))
549 SendMessageA(pdlgInfo
->hwndFileTB
, WM_SETTEXT
, 0, (LPARAM
)fn
.lpstrFile
);
553 /***********************************************************************
554 * UIINSERTOBJECTDLG_AddControl
556 * Add control to Object Type
558 static void UIINSERTOBJECTDLG_AddControl(InsertObjectDlgInfo
* pdlgInfo
)
561 char fname
[MAX_PATH
];
564 fn
.lStructSize
= sizeof(OPENFILENAMEA
);
565 fn
.hwndOwner
= pdlgInfo
->hwndSelf
;
567 fn
.lpstrFilter
= "OLE Controls\0*.ocx\0Libraries\0*.dll\0All Files\0*.*\0\0";
568 fn
.lpstrCustomFilter
= NULL
;
569 fn
.nMaxCustFilter
= 0;
573 fn
.lpstrFile
= fname
;
574 fn
.nMaxFile
= MAX_PATH
;
576 fn
.lpstrFileTitle
= NULL
;
577 fn
.nMaxFileTitle
= 0;
578 fn
.lpstrInitialDir
= NULL
;
580 LoadStringA(OLEDLG_hInstance
, IDS_BROWSE
, title
, 32);
581 fn
.lpstrTitle
= title
;
583 fn
.Flags
= OFN_EXPLORER
| OFN_FILEMUSTEXIST
|
584 OFN_HIDEREADONLY
| OFN_LONGNAMES
;
586 fn
.nFileExtension
= 0;
587 fn
.lpstrDefExt
= NULL
;
590 fn
.lpTemplateName
= NULL
;
592 if (GetOpenFileNameA(&fn
))
597 hMod
= LoadLibraryA(fn
.lpstrFile
);
603 regproc
= (DLLREGISTER
) GetProcAddress(hMod
, "DllRegisterServer");
606 if (S_OK
== regproc())
608 UIINSERTOBJECTDLG_PopulateObjectTypes(pdlgInfo
);
621 LoadStringW(OLEDLG_hInstance
, IDS_NOTOLEMODCAPTION
, title
, 32);
622 LoadStringW(OLEDLG_hInstance
, IDS_NOTOLEMOD
, msg
, 256);
624 MessageBoxW(pdlgInfo
->hwndSelf
, msg
, title
, MB_ICONEXCLAMATION
);