Issues updating to vstgui 4.7 (IDropTarget redefinition)

I’m trying to update from vstgui 4.6 to 4.7, and I’ve run into an issue. Looks like there’s a conflict with IDropTarget and Windows Kits SDK.
Screenshot 2020-11-19 174545.png

This happens because you have somewhere:

using namespace VSTGUI;

in some of your headers. This is not supported anymore.
You have to get rid of it.

If I don’t use the VSTGUI namespace, then all my custom classes won’t compile unless I add the namespace everywhere. Is there not a better solution? I have probably a hundred custom classes. I use CRect probably about 1000 times. Do I really need to say VSTGUI::CRect every time I want to work with a rectangle?

Looks like I might be able to use a typedef for all the primitives I use. For example…

typedef VSTGUI::CDrawContext CDrawContext;

Seems to be more trouble than it’s worth. I was hoping to get up to version 4.9, but I guess 4.6 is as far as I go.

…I don’t like giving up…I’m now compiling with vstgui 4.9 and I’m down to just one error:

Also, can I recommend a couple changes to prevent over people from having issues…

In csegmentbutton.h, change…

static constexpr uint32_t kPushBack = std::numeric_limits<uint32_t>::max ();


static constexpr uint32_t kPushBack = (std::numeric_limits<uint32_t>::max) ();

…and also, in vstguifwd.h change …

static constexpr uint32_t kStreamIOError = std::numeric_limits<uint32_t>::max ();


static constexpr uint32_t kStreamIOError = (std::numeric_limits<uint32_t>::max) ();

After doing some additional hacking in malloc.h, I’ve managed to compile and run my application in VSTGUI 4.9 on Windows. Let’s see how things fair on macOS…

As a note, to get my custom classes to compile, I had to create a header file full of typedefs and macros for all the classes and enums I use from the VSTGUI namespace.

#ifndef __AF_VSTGUI_DEFS__
#define __AF_VSTGUI_DEFS__

#ifndef __APPLE__
#include "lib\platform\win32\win32support.h" // for UTF8StringHelper

typedef VSTGUI::CView CView;
typedef VSTGUI::CDrawContext CDrawContext;
typedef VSTGUI::CRect CRect;
typedef VSTGUI::CPoint CPoint;
typedef VSTGUI::CBitmap CBitmap;
typedef VSTGUI::CColor CColor;
typedef VSTGUI::CMouseEventResult CMouseEventResult;
typedef VSTGUI::CMessageResult CMessageResult;
typedef VSTGUI::CButtonState CButtonState;
typedef VSTGUI::CBaseObject CBaseObject;
typedef VSTGUI::IControlListener IControlListener;
typedef VSTGUI::CGraphicsPath CGraphicsPath;
typedef VSTGUI::CCoord CCoord;
typedef VSTGUI::CFrame CFrame;
typedef VSTGUI::CFontRef CFontRef;
typedef VSTGUI::CFontDesc CFontDesc;
typedef VSTGUI::CGraphicsTransform CGraphicsTransform;
typedef VSTGUI::CLineStyle CLineStyle;
typedef VSTGUI::UTF8String UTF8String;
typedef VSTGUI::UTF8StringPtr UTF8StringPtr;
typedef VSTGUI::UTF8StringHelper UTF8StringHelper;
typedef VSTGUI::COpenGLView COpenGLView;
typedef VSTGUI::COffscreenContext COffscreenContext;
typedef VSTGUI::CTextLabel CTextLabel;
typedef VSTGUI::CGradient CGradient;
typedef VSTGUI::CControl CControl;
typedef VSTGUI::CViewContainer CViewContainer;
typedef VSTGUI::CTextEdit CTextEdit;
typedef VSTGUI::COnOffButton COnOffButton;
typedef VSTGUI::COptionMenu COptionMenu;
typedef VSTGUI::CScrollView CScrollView;
typedef VSTGUI::CMouseWheelAxis CMouseWheelAxis;
typedef VSTGUI::CMenuItem CMenuItem;
typedef VSTGUI::CLayeredViewContainer CLayeredViewContainer;
typedef VSTGUI::CScrollContainer CScrollContainer;
typedef VSTGUI::PixelFormat PixelFormat;

constexpr const CColor kTransparentCColor = CColor(255, 255, 255, 0);
constexpr const CColor kBlackCColor = CColor(0, 0, 0, 255);
constexpr const CColor kWhiteCColor = CColor(255, 255, 255, 255);
constexpr const CColor kGreyCColor = CColor(127, 127, 127, 255);
constexpr const CColor kRedCColor = CColor(255, 0, 0, 255);
constexpr const CColor kGreenCColor = CColor(0, 255, 0, 255);
constexpr const CColor kBlueCColor = CColor(0, 0, 255, 255);
constexpr const CColor kYellowCColor = CColor(255, 255, 0, 255);
constexpr const CColor kMagentaCColor = CColor(255, 0, 255, 255);
constexpr const CColor kCyanCColor = CColor(0, 255, 255, 255);

#define kAntiAliasing VSTGUI::kAntiAliasing
#define kNonIntegralMode VSTGUI::kNonIntegralMode
#define kMessageNotified VSTGUI::kMessageNotified

#define kDrawStroked VSTGUI::kDrawStroked
#define kDrawFilled VSTGUI::kDrawFilled
#define kDrawFilledAndStroked VSTGUI::kDrawFilledAndStroked

#define kLeftText VSTGUI::kLeftText
#define kCenterText VSTGUI::kCenterText
#define kRightText VSTGUI::kRightText

#define kNormalFont VSTGUI::kNormalFont
#define kNormalFontBig VSTGUI::kNormalFontBig
#define kNormalFontVeryBig VSTGUI::kNormalFontVeryBig
#define kNormalFontSmall VSTGUI::kNormalFontSmall
#define kNormalFontSmaller VSTGUI::kNormalFontSmaller
#define kNormalFontVerySmall VSTGUI::kNormalFontVerySmall

#define kMouseEventNotImplemented VSTGUI::kMouseEventNotImplemented
#define kMouseEventHandled VSTGUI::kMouseEventHandled
#define kMouseEventNotHandled VSTGUI::kMouseEventNotHandled
#define kMouseDownEventHandledButDontNeedMovedOrUpEvents VSTGUI::kMouseDownEventHandledButDontNeedMovedOrUpEvents
#define kMouseMoveEventHandledButDontNeedMoreEvents VSTGUI::kMouseMoveEventHandledButDontNeedMoreEvents

#define kCursorDefault VSTGUI::kCursorDefault
#define kCursorWait VSTGUI::kCursorWait
#define kCursorHSize VSTGUI::kCursorHSize
#define kCursorVSize VSTGUI::kCursorVSize
#define kCursorSizeAll VSTGUI::kCursorSizeAll
#define kCursorNESWSize VSTGUI::kCursorNESWSize
#define kCursorNWSESize VSTGUI::kCursorNWSESize
#define kCursorCopy VSTGUI::kCursorCopy
#define kCursorNotAllowed VSTGUI::kCursorNotAllowed
#define kCursorHand VSTGUI::kCursorHand
#define kCursorIBeam VSTGUI::kCursorIBeam

#define kNormalFace VSTGUI::kNormalFace
#define kBoldFace VSTGUI::kBoldFace
#define kItalicFace VSTGUI::kItalicFace
#define kUnderlineFace VSTGUI::kUnderlineFace
#define kStrikethroughFace VSTGUI::kStrikethroughFace

#define kLButton VSTGUI::kLButton
#define kMButton VSTGUI::kMButton
#define kRButton VSTGUI::kRButton
#define kShift VSTGUI::kShift
#define kControl VSTGUI::kControl
#define kAlt VSTGUI::kAlt
#define kApple VSTGUI::kApple
#define kButton4 VSTGUI::kButton4
#define kButton5 VSTGUI::kButton5
#define kDoubleClick VSTGUI::kDoubleClick
#define kMouseWheelInverted VSTGUI::kMouseWheelInverted