2,789 questions
You declared : LPCTSTR className
So, use : L"Main Window Class"
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello,
I have 3 files: <code>beans</code>
Window.h
has declarations for a class named WindowClass
:
class WindowClass
{
public:
WindowClass(UINT Style,
HINSTANCE hInstance,
HICON Icon, HCURSOR Cursor,
HBRUSH Background, LPCTSTR MenuName,
LPCTSTR className, HICON IconSm);
~WindowClass();
bool Register();
private:
WNDCLASSEX m_wc;
};
Window.cpp
has definitions for the class WindowClass
:
WindowClass::WindowClass(UINT Style,
HINSTANCE hInstance,
HICON Icon, HCURSOR Cursor,
HBRUSH Background, LPCTSTR MenuName,
LPCTSTR className, HICON IconSm)
{
m_wc.cbSize = sizeof(WNDCLASSEX);
m_wc.style = Style;
m_wc.lpfnWndProc = DefWindowProc;
m_wc.cbClsExtra = 0;
m_wc.cbWndExtra = 0;
m_wc.hInstance = hInstance;
m_wc.hIcon = Icon;
m_wc.hCursor = Cursor;
m_wc.hbrBackground = Background;
m_wc.lpszMenuName = MenuName;
m_wc.lpszClassName = className;
m_wc.hIconSm = IconSm;
}
WindowClass::~WindowClass()
{
}
bool WindowClass::Register()
{
return RegisterClassEx(&m_wc);
}
WinMain.cpp
is the window initializer:
int WINAPI wWinMain(HINSTANCE MainInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow)
{
WindowClass MainWndClass(NULL, MainInstance,
LoadIcon(MainInstance, IDI_APPLICATION),
LoadCursor(MainInstance, IDC_ARROW),
NULL, NULL,
"Main Window Class",
LoadIcon(MainInstance, IDI_APPLICATION));
Window MainWindow;
}
however, i'm getting this error:
Severity | Code | Description | Project | File | Line |
---|---|---|---|---|---|
Error (active) | E0289 | no instance of constructor "WindowClass::WindowClass" matches the argument list | [redacted] | C:[redacted]\WinMain.cpp | 5 |
You declared : LPCTSTR className
So, use : L"Main Window Class"