Create Application
NOTE: The following instructions are specific for Visual Studio 2019, but these steps may only differently for other versions of Visual Studio.
- Start Visual Studio
- Click the "Create a new project" button
- Select the "Windows Desktop Application" C++ template and click Next
- Enter the name of your new application in the "Project Name" field
- Enter or choose the location/folder you want this new project to be saved under
- Leave the "Place solution and project in the same directory" option checked, and then click the Create button to create the project
The generated project will contain a .cpp file, which contains the main function for this project, replace the content of this file with the following:
#include <include/Frame.h>
#include <include/EventListeners.h>
#include "framework.h"
#include "MyApplication.h"
class MainFrame : public Frame
{
CardPanel _cardPanel;
public:
MainFrame(const wstring& wndClassName, const wstring& title): Frame(wndClassName, title)
{
Theme::GetInstance()->setDarkTheme(); // setSilverTheme()
setLicense(L"Set Your License String Here!!!");
}
void onConstructWindow()
{
setWindowCentered();
// Add the child components
RECT clientRect;
GetClientRect(getNativeWindowHandle(), &clientRect);
GridPanel* contentPane = getContentPane();
contentPane->setLayout({ 5, -1, 5 }, { 5, -1, 5 });
contentPane->addComponent(CreateCardPanel(contentPane->getNativeWindowHandle(), clientRect), 1, 1);
}
Component *CreateCardPanel(HWND hwndParent, RECT rect)
{
_cardPanel.createComponent(hwndParent, rect);
return &_cardPanel;
}
};
//============================================= Main Entry Function =========================================
#define MAX_LOADSTRING 100
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPWSTR lpCmdLine,
_In_ int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
WCHAR szTitle[MAX_LOADSTRING]; // The title bar text
WCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name
LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadStringW(hInstance, IDC_MYAPPLICATION, szWindowClass, MAX_LOADSTRING);
RECT rect;
rect.left = 0;
rect.top = 0;
rect.right = 1400;
rect.bottom = 900;
MainFrame frame(szWindowClass, szTitle);
return frame.createComponent(nullptr, rect);
}