HSHELL_WINDOWCREATED fires twice when Skinned app launched with active skin

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #71063
    ABell_Thermco
    Participant

    Hi all

    This is a very obscure problem, but my company produces its own Windows Shell (for a variety of reasons) which restricts the PCs we supply to running only our applications.

    It keeps track of when an app is opened by getting HSHELL_WINDOWCREATED messages and creates a taskbar with Icons on it when an app is launched.

    The problem is, under Win 7, when a skinned app is launched with the skin manager active, HSHELL_WINDOWCREATED is received twice and the Icons get created twice. We can (and do) work around it by making sure we don’t process the same file handle twice, but I’m wondering if this is a bug in AC.

    The attached sample projected (C++ Builder Alexandria) demonstrates the message received twice problem. If you run the sample app on Win 7 and then launch a skinned app you’ll see its handle appear twice in the list box. But launch a normal app (notepad, for example) or a skinned app with the Skin Manager->Active = false, and only one message appears.

    If anyone knows a way to stop this happening I’d be grateful 🙂

    Andy

    Attachments:
    You must be logged in to view attached files.
    #71065
    Dima1024
    Participant

    Hello, Andy!

    What is placed in “shell.zip“? Source code or compiled exe/dll?
    It is not safe to download compiled executables and dlls made by unknown man, sorry.
    Can you provide minimal source code to compile simple shell-observer by anyone who wants to help you?
    By the way, how do you get this HSHELL_WINDOWCREATED notification? Via SetWindowHookEx?

    #71066
    ABell_Thermco
    Participant

    Hi

    Sorry about the ZIP file – I’ve now created one with just the source code.

    Because we’re producing our own Windows Shell we’ve used RegisterShellHookWindow to get HSHELL_WINDOWCREATED messages.

    The workaround I’m using is to create the apps with the skinning disables and, in the main form’s OnShow event, enable the skinning. This works well enough, but I am curious why the HSHELL_WINDOWCREATED is received twice when a skinned application is launched.

    Andy

    Attachments:
    You must be logged in to view attached files.
    #71068
    Dima1024
    Participant

    Hello, Andy!

    Thank you for the code. Which version of AlphaSkins do you use? Friend of mine has source code of package version 16.18. And in this version wrong behaviour you described can be seen also.

    Friend was so kind to gave me access to his PC, so I could track down this little problem. But he has no interest in this process))

    The main reason for this behaviour stays unclear for me even after a few hours of debugging.

    But I can say that you can workaround this problem by disabling animation of form showing in TsSkinManager.
    If you still want opportunity to have animation and cure described problem, you have to dig a little bit into the source code.

    Naturally, there are two options (in version 16.18, at least)
    First option is:
    – Open “sSkinProvider” unit and search for implementation of method named “AC_CMShowingChanged”.
    – Locate in the code of this method the following line: AnimShowForm(XXX).
    – Before this line you could see next lines: if lInted then DoLayered(Form.Handle, False). *they are placed on different lines.
    – Comment these two lines.
    – Run your app. You will get only one HSHELL_WINDOWCREATED notification.

    Second option is:
    – Open “sVclUtils” unit and search for implementation of method named “AnimShowForm”.
    – Then search in this method for the following code: ShowWindow(sp.Form.Handle, ShowCommands[sp.Form.WindowState]);
    – As you locate it, comment it out.
    – Now add this code instead of “ShowWindow” method:
    SetWindowLong(sp.Form.Handle, GWL_STYLE, GetWindowLong(sp.Form.Handle, GWL_STYLE) or WS_VISIBLE);
    – Run your app. You will get only one HSHELL_WINDOWCREATED notification.

    Well, suppose it should help you a bit!)
    At least now you have starting point to try yourself in tracking down of this issue.

    To Serge and/or other developers of AlphaSkins Package
    Hope, my friend was honest when said that he bought copy of source code.
    I agreed with zero-tolerance for software piracy, but even if he just downloaded source code from piracy site, I think, information, which I got when was trying to track down the problem, described in this topic, will be useful for you and your team. And for other developers too.
    My apologies, if me or my friend upset you!

    P.S.
    You didn’t log in very long time 🙁
    Hope, you are normal, alive and stay in safety place.
    Good luck!

    #71076
    ABell_Thermco
    Participant

    Hi

    Thanks for the info.

    I’m using V16.21 – I have the source code (genuine purchase!) and will look at the code to see if I can apply a change to fix the issue.

    Many thanks

    Andy

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.