Menu

#729 commdlg.h:587 defines INTERFACE forever, clash with applications

v1.0 (example)
open
nobody
None
8
2018-04-26
2018-04-26
No

Hi,

I am using mingw64 to compile my application on windows and notice a define clash as I have functions called INTERFACE() in my code. It comes from commdlg.h and I suggest if there is no other need to keep INTERFACE defined forever to add #undef INTERFACE after line 597. Below is a snippet of the code.

Regards,
S.

#ifdef STDMETHOD
#undef INTERFACE
#define INTERFACE IPrintDialogCallback

  DECLARE_INTERFACE_(IPrintDialogCallback,IUnknown) {
#ifndef __cplusplus
    STDMETHOD(QueryInterface) (THIS_ REFIID riid,LPVOID *ppvObj) PURE;
    STDMETHOD_(ULONG,AddRef) (THIS) PURE;
    STDMETHOD_(ULONG,Release) (THIS) PURE;
#endif
    STDMETHOD(InitDone) (THIS) PURE;
    STDMETHOD(SelectionChange) (THIS) PURE;
    STDMETHOD(HandleMessage) (THIS_ HWND hDlg,UINT uMsg,WPARAM wParam,LPARAM lParam,LRESULT *pResult) PURE;
  };

#undef INTERFACE
#define INTERFACE IPrintDialogServices
  DECLARE_INTERFACE_(IPrintDialogServices,IUnknown) {
#ifndef __cplusplus
    STDMETHOD(QueryInterface) (THIS_ REFIID riid,LPVOID *ppvObj) PURE;
    STDMETHOD_(ULONG,AddRef) (THIS) PURE;
    STDMETHOD_(ULONG,Release) (THIS) PURE;
#endif
    STDMETHOD(GetCurrentDevMode) (THIS_ LPDEVMODE pDevMode,UINT *pcbSize) PURE;
    STDMETHOD(GetCurrentPrinterName) (THIS_ LPTSTR pPrinterName,UINT *pcchSize) PURE;
    STDMETHOD(GetCurrentPortName) (THIS_ LPTSTR pPortName,UINT *pcchSize) PURE;
  };
// fix define issue with next line
#undef INTERFACE

Discussion


Log in to post a comment.

Auth0 Logo