Basically I'm trying to make a universal and independent library with a Login() function which will create a modal windoow and return bool value whether login succeeded or not
This is minimal basic code of what I've attempted
The library consists of roughly this structure
Code: Select all
#include "wx/wx.h"
class LoginMain: public wxFrame {
public:
LoginMain();
};
LoginMain::LoginMain() : wxFrame(
nullptr, // The parent window, which is null in this case because it's the master window
-1, // The window's ID; -1 is shorthand for "no ID required"
"Login", // The title of the window
wxPoint(30, 30), // The coordinates the window should appear at; (0, 0) is the top-left corner of the screen
wxSize(800, 600) // The size (width, height) of the window
) {}
class LoginApp: public wxApp {
public:
bool OnInit();
private:
LoginMain* m_frame1 = nullptr;
};
IMPLEMENT_APP_NO_MAIN(LoginApp);
bool LoginApp::OnInit() {
m_frame1 = new LoginMain();
m_frame1->Show();
return true;
}
Code: Select all
bool Login()
{
wxAppBase* loginApp = new LoginApp();
wxApp::SetInstance(wxAppBase);
wxEntry(GetModuleHandle(NULL), NULL, NULL, SW_SHOW);
if (loginApp.isSuccess())
return true;
else
return false;
}
It works so far with this setup
But I have a strong feeling that I'm doing it utterly wrong way, and eventually I will run into great issues with this approach
Just wanted to know some expert opinions about this case and maybe get some suggestions/advices/critics
Regards