Programming > General

Shellexecute and windows photo viewer corrupts all menus in app.

(1/2) > >>

snorkel:
I have this app that I have not looked at in a long time.
Anyways I compiled it and it uses shellexecute to open a image file and when I do that it corrupts all the menus in the app, the main menu gets messed up the worst and even the popup menus start showing up not attached the app anymore.

Shellexecute launches the image file in the windows photo viewer.  If I put a URL in instead of a path to a image the menu corruption does not happen.  This is on Windows 7.

it also does it in the Delphi community edition.

I put a coinitilize call to see if it was something with com threading or something but that made no difference.  It only does it with the windows photo viewer.

Here is the code:

--- Code: Pascal  window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---ShellExecute(0, nil, pchar(fpath), nil, nil, SW_RESTORE)

440bx:
Hi there,

Here is something I would try, I'd explicitly set the verb (second parameter.)  Passing nil makes things somewhat unpredictable and dependent on whatever is specified in the registry.

I don't know if that will solve the problem but, it is the first thing I'd try.

HTH.

snorkel:
ok, I will give that a shot.

wp:
Why don't you do it in the Lazarus way?

--- Code: Pascal  window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---uses  LCLIntf;...  OpenDocument(fpath);

snorkel:

--- Quote from: wp on August 17, 2018, 09:03:04 pm ---Why don't you do it in the Lazarus way?

--- Code: Pascal  window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---uses  LCLIntf;...  OpenDocument(fpath);
--- End quote ---

I tried that already and it does the same thing, on windows Opendocument must call shellexecute.

Navigation

[0] Message Index

[#] Next page

Go to full version