Files
Slnkdwf/SlnkDWFCom/QRCode.h
Jos Groot Lipman 8f2e7852a8 UWVA#90681 Achtergrond van QR-codes instelbaar maken (nu hardcoded wit)
svn path=/Slnkdwf/trunk/; revision=70390
2025-09-23 10:04:23 +00:00

93 lines
2.6 KiB
C++

// QRCode.h : Declaration of the CQRCode
#pragma once
#include "resource.h" // main symbols
#include "SLNKDWF.h"
#include "CxImage\CxImage\ximage.h"
#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
#endif
// CQRCode
class ATL_NO_VTABLE CQRCode :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CQRCode, &CLSID_QRCode>,
public ISupportErrorInfo,
public IDispatchImpl<IQRCode, &IID_IQRCode, &LIBID_SLNKDWFLib, /*wMajor =*/ 1, /*wMinor =*/ 0>
{
public:
CQRCode()
{
m_Text = "";
m_nVersion = -1;
m_bAutoExtend = true,
m_nLevel = 1; // M=15%
m_nMaskingNo = -1; // Auto
m_nSize = 8; // pixels/module
m_Color = 0x000000; // zwart
m_BgGrayColor = 0xFF; // wit
}
DECLARE_REGISTRY_RESOURCEID(IDR_QRCODE)
BEGIN_COM_MAP(CQRCode)
COM_INTERFACE_ENTRY(IQRCode)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(ISupportErrorInfo)
END_COM_MAP()
// ISupportsErrorInfo
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
private:
CString m_Text;
int m_nMaskingNo;
int m_nVersion;
BOOL m_bAutoExtend;
int m_nLevel;
int m_Color;
int m_BgGrayColor;
int m_nSize;
bool CreateCxImage(CxImage* img);
HRESULT StreamPNG(CxImage &img, VARIANT *ImageData, BOOL bPNG);
public:
STDMETHOD(get_Text)(BSTR* pVal);
STDMETHOD(put_Text)(BSTR newVal);
STDMETHOD(GetAsPNG)(VARIANT* ImageData);
STDMETHOD(get_Version)(LONG* pVal);
STDMETHOD(put_Version)(LONG newVal);
STDMETHOD(get_Autoextend)(VARIANT_BOOL* pVal);
STDMETHOD(put_Autoextend)(VARIANT_BOOL newVal);
STDMETHOD(get_Level)(LONG* pVal);
STDMETHOD(put_Level)(LONG newVal);
STDMETHOD(get_Masking)(LONG* pVal);
STDMETHOD(put_Masking)(LONG newVal);
STDMETHOD(get_Size)(LONG* pVal);
STDMETHOD(put_Size)(LONG newVal);
STDMETHOD(get_Color)(LONG* pVal);
STDMETHOD(put_Color)(LONG newVal);
STDMETHOD(get_BgGrayColor)(BYTE* pVal);
STDMETHOD(put_BgGrayColor)(BYTE newVal);
};
OBJECT_ENTRY_AUTO(__uuidof(QRCode), CQRCode)