Skip to content

Commit

Permalink
yopmost
Browse files Browse the repository at this point in the history
  • Loading branch information
pedromagician committed Jun 2, 2022
1 parent 3d62672 commit 7aad14f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ int _tmain(int argc, _TCHAR* argv[])
cmd.Add(CommandLine::_ENUM, 2, _T("-position"), _T("-pos"), _T("The 'xxx' argument specifies the default position. Allowed options: Center|Top|Bottom|Left|Right|Pointer|xy."), &InputBox::position.type, &string2positionType);
cmd.Add(CommandLine::_INT, 1, _T("-x"), _T("The 'xxx' argument specifies the position offset along the X coordinate."), &InputBox::position.delta.x);
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);

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

wstring InputBox::title = _T("Input Box");
wstring InputBox::prompt = _T("Please input text");
Expand Down Expand Up @@ -241,7 +242,12 @@ LRESULT CALLBACK InputBox::WndProc(HWND _hWnd, UINT _message, WPARAM _wParam, LP
x += InputBox::position.delta.x;
y += InputBox::position.delta.y;

SetWindowPos(_hWnd, HWND_TOPMOST, x, y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_SHOWWINDOW);

UINT flags = SWP_NOSIZE | SWP_SHOWWINDOW;
if (InputBox::topMost == false)
flags |= SWP_NOZORDER;

SetWindowPos(_hWnd, HWND_TOPMOST, x, y, 0, 0, flags);

break;
}
Expand Down
1 change: 1 addition & 0 deletions InputBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class InputBox
static int linesOfText;
static bool password;
static wstring fontName;
static bool topMost;

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 5
#define VERSION_PATCH 8
#define VERSION_PATCH 9
#define VERSION_REVISION 0

#define VER_COMPANYNAME_STR "Pedro"
Expand Down

0 comments on commit 7aad14f

Please sign in to comment.