Skip to content

Commit

Permalink
ability to block the parent process
Browse files Browse the repository at this point in the history
  • Loading branch information
pedromagician committed Jun 10, 2022
1 parent 7c15f7d commit 1c61901
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ int _tmain(int argc, _TCHAR* argv[])
cmd.Add(CommandLine::_INT, 1, _T("-y"), _T("The 'xxx' argument specifies the position offset along the Y coordinate."), &InputBox::position.delta.y);
cmd.Add(CommandLine::_TRUE, 1, _T("-topmost"), _T("This argument places the window above all windows that are not in the highest position.The window retains its highest position even if it is deactivated."), &InputBox::topMost);
cmd.Add(CommandLine::_STRING, 1, _T("-iconapp"), _T("The 'xxx' argument specifies the icon file for the application. (ICO/BMP)"), &InputBox::iconApp);
cmd.Add(CommandLine::_TRUE, 1, _T("-block"), _T("This argument blocks the parent process that started the InputBox."), &InputBox::blockParent);

if (cmd.ParseCommandLine(argc, argv, correctParameters) != 0) {
cmd.Help();
Expand Down
Binary file modified Bin/InputBox.exe
Binary file not shown.
7 changes: 6 additions & 1 deletion InputBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ int InputBox::linesOfText = 1;
bool InputBox::password = false;
wstring InputBox::fontName = _T("Consolas");
bool InputBox::topMost = false;
bool InputBox::blockParent = false;

wstring InputBox::title = _T("Input Box");
wstring InputBox::prompt = _T("Please input text");
Expand Down Expand Up @@ -344,12 +345,16 @@ bool InputBox::GetString(wstring & _result)
int buttonY = inputY + inputHeight + 15;
int buttonHeight = fontSize + 8;

HWND parent = nullptr;
if (InputBox::blockParent)
parent = mhWndParent;

mhWndInputBox = CreateWindowEx(
WS_EX_DLGMODALFRAME, _T("InputBox"), title.c_str(),
WS_POPUPWINDOW | WS_CAPTION | WS_TABSTOP | WS_VISIBLE,
(rc.right - InputBox::width) / 2, (rc.bottom - InputBox::width / 2) / 2,
InputBox::width, 50 + buttonY + buttonHeight,
/*mhWndParent*/ nullptr, nullptr, nullptr, nullptr
parent, nullptr, nullptr, nullptr
);
if (mhWndInputBox == nullptr) {
return false;
Expand Down
1 change: 1 addition & 0 deletions InputBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class InputBox
static bool password;
static wstring fontName;
static bool topMost;
static bool blockParent;

static pair<bool, wstring> brush;
static pair<bool, wstring> background;
Expand Down
2 changes: 1 addition & 1 deletion version.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#define VERSION_MAJOR 0
#define VERSION_MINOR 6
#define VERSION_PATCH 0
#define VERSION_PATCH 1
#define VERSION_REVISION 0

#define VER_COMPANYNAME_STR "Pedro"
Expand Down

0 comments on commit 1c61901

Please sign in to comment.