Short version:

The following code doesn't compile:

CComBSTR temp;
CMenu().GetMenuString(0,   temp, 0);

but this does:

CComBSTR temp;
CMenu().GetMenuString(0, *&temp, 0);

Why?


Full code:

#include <atlbase.h>
extern CComModule _Module;
#include <atlapp.h>
#include <atlwin.h>
#include <atlctrls.h>

int main() {
    CComBSTR temp;
    CMenu().GetMenuString(0, *&temp, 0);
}

GetMenuString signature (from atluser.h, from WTL):

BOOL GetMenuString(UINT nIDItem, BSTR& bstrText, UINT nFlags) const;
Edit
Report