Crash on sending WM_USER+51 with wParam=1003

Please report only one bug per message!

Moderators: white, Hacker, petermad, Stefan2

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

What happens when you choose this menu item
- by mouse?
- by keyboard?

Make sure the cursor is standing on a file before opening the menu.
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Same result for both mouse click and Enter keypress. Directory hotlist blinks and closes, context menu doesn't popup at all.

I call TcMenuPopup.exe via buttonbar button with MNU file as parameter.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Wait, you reported problem with command Nr. 2500, but now you call an external program?
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Christian, I'm always (within this topic) call 2500 from menu that external tool TcMenuPopup.exe displays. :)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Ah, I see, I thought that you clicked on the menu item with Nr. 2500 within Total Commander! Maybe the tool should use PostMessage instead of SendMessage?

Does it work via AutoHotkey?
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Doesn't work with PostMessage too.

Can you reproduce it with this tool and this menu file?

I have no AHK and not familiar with it. :)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Yes, when I call your tool from the button bar.
No, when I call it from the TC command line.
Strange indeed...
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Yes, it is strange. Within TC it works from any place (buttonbar, command line, start menu) but why it doesn't work from external menu... I don't know what differences between internal command execution and execution from window procedure but it seems that it does matter.
Maybe you can debug something? Message processing procedure, opening context menu... also why directory hotlist menu closes immediately after opening...
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I just checked my code, and found the reason: TC ignores message 2500 if it isn't the active window:

Code: Select all

    cm_ContextMenu: if getactivewindow=handle then
        InvokeContextMenu(handle);
This is done because otherwise (if TC is in the background or minimized) this would cause troubles or even a crash.

Try calling SetActiveWindow first.
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Hm-m, it may be the reason why short delay before sending command had worked...

Unfortunately SetActiveWindow can only be used within that window's thread.

It seems that easiest workaround is to call Sleep before sending a command... But what if it is not enough?

I've used following:

Code: Select all

SetForegroundWindow(hTcWnd);
for (int try_count=1000; try_count>0 && GetForegroundWindow()!=hTcWnd; --try_count) Sleep(2);
exec_tc_command(hTcWnd, param);
It works well. :)

Code: Select all

MIME-Version: 1.0
Content-Type: application/octet-stream; name="TcMenuPopupNew.7z"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="TcMenuPopupNew.7z"

N3q8ryccAAPOWRFfBQoAAAAAAABpAAAAAAAAAEbcRjwAJpaOcAAX9+wFu+r0/5QBL0TuTr0JScWp
wXIs+2C8FAvofZL9OQyrmdRJ6fFEUwUox4AepJrWfamkx9MSo1AMPur1FMg8of0jfCyT3T8/4QjX
pnYBL7RWA+NS9H6KfDPbUtFVa+g60rip9yvx/Jg3SHnt7UA/td5s22NmN/tHdAHZYtqHXUa6w70k
kejWwtzAMTsl4xYH/JrS6n4y3L0Qdmg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ywXHV+Sqf+wB2vc4lTLfI9edQAABBAYAAQmKBQAHCwEAAiMDAQEFXQAAAQAE
AwMBAwEADJQAlAAACAoBWyTEQQAABQERIQBUAGMATQBlAG4AdQBQAG8AcAB1AHAALgBlAHgAZQAA
ABQKAQD3/LdmapXMARUGAQAgCAAAAAA=

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

2MVV
It may be sufficient to close your menu and then just wait until TC is again the foreground window - Windows itself will give it the focus eventually.
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Maybe, but my way is more reliable (who knows that Windows :D), and it is not hard to add single function call. :)
User avatar
TyBontage
Junior Member
Junior Member
Posts: 2
Joined: 2012-02-15, 03:04 UTC
Location: United States

Crash on sending WM_USER51 with wParam 1003

Post by *TyBontage »

Can you email us and well send directions on how to send your presentation to us so we can test this?

Thanks.
Post Reply