|
Post by flotul on Jan 15, 2022 16:06:34 GMT -5
Hi there,
I'm adding a help file to my program.
To do so, I have made a PDF I would like to display lauching it with RUN command.
It does work wery well but it launches a Command Prompt window too.
Can I avoid this DOS window?
|
|
|
Post by Brandon Parker on Jan 15, 2022 16:44:29 GMT -5
Can you post the code that you are using so that we can help resolve the issue? It should be easily doable, but if it does not work for some reason or another, I have ShellExecute function that I can post for you. It would be better to work from you code to start with though so that we can get a sense if something else is going on.
{:0)
Brandon Parker
|
|
|
Post by flotul on Jan 16, 2022 2:29:39 GMT -5
Hello Brandon,
In my program, I do have a "Help" option in the menu bar. This will trigger the [CODE-LIST-WINDOW] subroutine here under.
' ----- CODE-LIST-WINDOW -------------------- [CODE-LIST-WINDOW] RUN "LISTE_DES_CODES_UTILISATEURS.PDF" WAIT
To display PDF documents, I use SUMATRA (https://www.sumatrapdfreader.org/free-pdf-reader). It's a very light reader and it is set as default viewer in "my" Windows10.
I just noticed that if I change my default viewer for another viewer, i.e. CHROME, the DOS window will not appear.
On the other hand, when I open a PDF document with SUMATRA from my desktop (= not launched from within LB), I don't have the DOS window opening.
Finally, the DOS window will automatically close when I close the SUMATRA viewer confirming it is related.
Still, why is it doing this?
|
|
|
Post by Rod on Jan 16, 2022 3:35:23 GMT -5
|
|
|
Post by flotul on Jan 16, 2022 3:44:12 GMT -5
Thanks Rod ;-)
|
|
|
Post by metro on Jan 16, 2022 4:08:41 GMT -5
you could also try
b$ = "C:\path2ThePDF\screen.pdf"
RUN "rundll32.exe url.dll,FileProtocolHandler ";b$
|
|
|
Post by flotul on Jan 16, 2022 9:47:36 GMT -5
you could also try b$ = "C:\path2ThePDF\screen.pdf"
RUN "rundll32.exe url.dll,FileProtocolHandler ";b$
WOW!!!!! Thanks so much Metro!! It does the trick :-) No DOS windows anymore. BRAVO! Thanks again :-)
|
|
|
Post by mknarr on Jan 16, 2022 11:10:20 GMT -5
I use the following and have no issues when the pdf closes.
run "explorer ";DefaultDir$+"\help\"+"ShowSec Manual.pdf" This is the main help file for the whole program but it is a commercial program that has 59 Dialog Modal windows for different features and each one has a help button. That button opens an rtf file in another dialog window by passing the name of the help file to this subroutine.
[Help] 'Display Help files WindowWidth = 800 if DisplayHeight<601 then WindowHeight=600 else WindowHeight = DisplayHeight-100 end if BackgroundColor$ = "buttonface" ForegroundColor$ = "black" button #help.default, "enter", [helpok],UL,-400,-400 button #help.b1, "", [helpok], UL,368, WindowHeight-85,63,39 'ok stylebits #help.b1, _BS_BITMAP,0,0,0 button #help.b2, "", [helpprint], UL,755, WindowHeight-70,25,25 'print stylebits #help.b2, _BS_BITMAP,0,0,0 stylebits #help, _DS_CENTER,0,0,0 open "Show Secretary Help" For dialog_modal As #help
#help, "trapclose [helpok]" #help, "font arial 10 "+WindowFont$ hTip=CreateTooltip(hwnd(#help)) call AddToolTip Hwnd(#help.b1),hTip, "Close Help " call AddToolTip Hwnd(#help.b2),hTip, "Print Help window " Call BitmapButton Hwnd(#help.b1), HBmp("ok") Call BitmapButton Hwnd(#help.b2), HBmp("print") open "RICHED32.DLL" for dll as #re calldll #comctl32, "InitCommonControlsEx",ret as void hlpT=CreateTextEdit(hWnd(#help),10,10,775,WindowHeight-110) HelpFile$=DefaultDir$+"\help\"+help$ open HelpFile$ for input as #HelpText text$=input$(#HelpText,lof(#HelpText)) close #HelpText call SetWindowText hlpT,text$ wait
[helpprint] 'Print help if Owner$="Show Secretary Demo Program" then notice "Sorry!"+chr$(13)+"Printing is disabled in the demo!" wait end if run "write.exe "+chr$(34)+HelpFile$+chr$(34)+" /p",hide wait
[helpok] close #help close #re return
Just another idea.
|
|
|
Post by flotul on Jan 16, 2022 13:52:28 GMT -5
Thanks mknarr.
I'll keep that for my next program - excellent idea! ;-)
|
|