Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: different behaviour on different computers



Permlink Replies: 8 - Last Post: Aug 3, 2017 10:33 AM Last Post By: Remy Lebeau (Te...
Alain Bourgeois

Posts: 26
Registered: 3/15/00
different behaviour on different computers
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 1, 2017 1:39 AM
Hi,

I have a vcl win32 application built with XE10 seattle. I run it on 2 computers running windows 10 pro x64, and I have different behaviour when minimizing the application on both computers. On one of the computers I even restore the windows after minimizing.

On my computer (laptop, port replicator, 2 external screens), when I minimize the application, there is in the bottom left corner a minimized windows (just title bar) and I can restore it using this window. clicking icon in the task bar show and hides this minimized window. When the minimized window is displayed, pressing alt-space doesn't propose the "restore" option.

On the second computer, same executable, same windows version, there is just an icon in task bar. When I click minimize, no mini-windows is displayed, and clicking the icon in task bar doesn't restore the application. alt-space doesn't also propose to restore the application. The only thing that can be done is to kill the task and restart the app, no way to "un-minimize" it. All other apps (ms word, lotus notes, ...) work fine with this computer when minimizing and restoring. Only c++ builder app has a problem on this computer. Computers are laptops with 2 screens. I disabled the external screen, no change, even with one single screen (the one of the laptop).

Any hint?

Edited by: Alain Bourgeois on Aug 1, 2017 1:57 AM
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: different behaviour on different computers [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 1, 2017 1:18 PM   in response to: Alain Bourgeois in response to: Alain Bourgeois
Alain Bourgeois wrote:

On my computer (laptop, port replicator, 2 external screens), when I
minimize the application, there is in the bottom left corner a
minimized windows (just title bar)

That is not correct behavior, and should not be happening under normal
conditions. It means the window is not minimizing to the Taskbar
correctly.

On the second computer, same executable, same windows version, there
is just an icon in task bar.

That is the correct behavior.

clicking the icon in task bar doesn't restore the application.

That is not correct behavior, though. It should be restoring.

These kind of symptoms usually only occur when you are manually
messing around with the styles and message handling of the VCL's
windows. Are you? Standard windows should not be experiencing these
symptoms.

--
Remy Lebeau (TeamB)
Alain Bourgeois

Posts: 26
Registered: 3/15/00
Re: different behaviour on different computers [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 1, 2017 11:26 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
I am not using VCL styles, nor messing with message handling.
The only "special" thing is that main form is hidden, and the visible GUI is instantiated dynamically (new TForm1) from the invisible form.

What is more strange is the different behaviour of the same .exe on 2 different computers having the same Windows!

Edited by: Alain Bourgeois on Aug 1, 2017 11:45 PM
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: different behaviour on different computers [Edit] [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 2, 2017 9:27 AM   in response to: Alain Bourgeois in response to: Alain Bourgeois
Alain Bourgeois wrote:

I am not using VCL styles, nor messing with message handling.

I was referring to Win32 API window style bits, not VCL styles.

The only "special" thing is that main form is hidden, and the visible
GUI is instantiated dynamically (new TForm1) from the invisible form.

Well, that is important information you should have said up front.

Secondary forms are NOT designed to minimize to the Taskbar by default,
only the MainForm is.

To minimize a seconday Form to the Taskbar, you must override its
virtual CreateParams() method to enable the WS_EX_APPWINDOW extended
window style bit, as well as set its parent HWND (in Win32 terms, not
VCL terms) to either Application->Handle or the HWND returned by the
Win32 GetDesktopWindow() function.

--
Remy Lebeau (TeamB)
Alain Bourgeois

Posts: 26
Registered: 3/15/00
Re: different behaviour on different computers [Edit] [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 2, 2017 9:30 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
God bluss you :)
Do you have a sample?
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: different behaviour on different computers [Edit] [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 2, 2017 10:20 AM   in response to: Alain Bourgeois in response to: Alain Bourgeois
Alain Bourgeois wrote:

Do you have a sample?

class TForm1 : public TForm
{
...
protected:
    void __fastcall CreateParams(TCreateParams &Params);
...
public:
    __fastcall TForm1(TComponent *Owner);
...
};
 
__fastcall TForm1::TForm1(TComponent *Owner)
    : TForm(Owner)
{
    ShowWindow(Application->Handle, SW_HIDE);
    SetWindowLongPtr(Application->Handle, GWL_EXSTYLE, 
GetWindowLongPtr(Application->Handle, GWL_EXSTYLE) | 
WS_EX_TOOLWINDOW);
    ShowWindow(Application->Handle, SW_SHOW);
}
 
void __fastcall TForm1::CreateParams(TCreateParams &Params)
{
    TForm::CreateParams(Params);
    Params.ExStyle |= WS_EX_APPWINDOW;
    Params.WndParent = Application->Handle; // or: = GetDesktopWindow();
}


--
Remy Lebeau (TeamB)
Alain Bourgeois

Posts: 26
Registered: 3/15/00
Re: different behaviour on different computers [Edit] [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 3, 2017 12:07 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
When using this code, it minimizes to taskbar... but as if app was opened twice: 2 instances.
When I put the mouse on Icon, I see 2 times the visible window. One is clickable (restore), the other not (no effect when clicking).

Any hint?
Alain Bourgeois

Posts: 26
Registered: 3/15/00
Re: different behaviour on different computers [Edit] [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 3, 2017 4:52 AM   in response to: Alain Bourgeois in response to: Alain Bourgeois
I finally updated the app so that main form is visible and "hidden" form is created afterwards. It works without overriding anything, on both computers.
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: different behaviour on different computers [Edit] [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 3, 2017 10:33 AM   in response to: Alain Bourgeois in response to: Alain Bourgeois
Alain Bourgeois wrote:

When using this code, it minimizes to taskbar... but as if app was
opened twice: 2 instances.

Then you are not hiding the default Taskbar button of other Forms.
This code allows individual Forms to appear on the Taskbar.

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02