locked
How to run application through LabelHyperlink click? RRS feed

  • Question

  • Dear All,

    I'm using following code:

    oIE = CREATEOBJECT("InternetExplorer.Application")
    oIE.Navigate("www.foxite.com")
    oIE.Visible = .T.
    It works properly to open Internet Explorer, But I tried many ways to open Google Chrome using 'Chrome', 'GoogleChrome', 'Google Chrome', Its not opening Google Chrome application. Can anyone advice me what appropriate way to be use to open the Chrome. And how to get the application name if we want to run any application through this?
    I'm using Label Click event to execute.

    Regards
    ShahidSQL (India)

    Tuesday, October 8, 2019 6:30 AM

All replies

  • Hello,

    try run "start www.foxite.com".

    This should open the website with the standardbrowser.

    Or use shellexecute.

    Regards

    tom


    Tuesday, October 8, 2019 7:39 AM
  • Hi ShahidSQL,

    nowadays, most browsers are available as 32bit as well as 64bit version. As soon as a 64bit version of the wanted app is installed, you won't be able to use createobject() to instantiate an ole version of it. This is mostly the reason why so many 32bit office installations have been made instead of the <activate_reverb> 64bit </activate_reverb> office version. 32bit apps simply can't call/use 64bit apps.

    Another thing is the existence of an 32bit OLE version of the app you want to automate. The Internet Explorer version you use in your code isn't the current IE. It's a really old IE9(or even 8?) that doesn't even know the current up to date web standards but is the only OLE web control VFP can use!

    However, the internal shell command START, as Tom Knauf correctly wrote in his post, can do this. It searches the directory where the app is installed (based of registry data), just as good old shellexecute does.

    JM2C


    Gruss / Best regards
    -Tom
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible,
    you are, by definition, not smart enough to debug it. 010101100100011001010000011110000101001001101111011000110110101101110011

    Wednesday, October 9, 2019 11:34 AM
    Answerer
  • Thanks Tom Knauf, Tom Borgmann.

    I used run "start www.foxite.com" that Tom Knauf adviced to me, but while program execution it opens 'CMD Command Window' for a second it doesn't make problem but I wanted to run browser directly. Well I got your concept of 32bit/64bit. I just wanted to know if I use :

    CREATEOBJECT("InternetExplorer.Application")
    CREATEOBJECT("Excel.Application")
    CreateObject("WORD.APPLICATION")

    and we are able to use run IE, Excel, Word through CREATEOBJECT(),
    So is there any possibility to run Chrome also like this way? or any other way to run directyly.

    Regards
    ShahidSQL (India)
    Wednesday, October 9, 2019 3:41 PM
  • Hi ShahidSQL,

    as said, you will need some OLE automation available for 32bit.

    I don't have chrome installed, but AFAIK there is a 'chrome.automation' available. Perhaps this is what you need, but don't be to optimistic about that. For firefox there was a thread on foxite ~10 years ago. So in the meantime there will have been several changes to that browser, but it should be a start (foxite link)

    the shell command START that was already mentioned can indeed start chrome/internet explorer/firefox/winword a.s.o. as long as you have the apps FNAME, which means, that you have to use the physical filename of exe file i.e. Word = winword.

    RUN start iexplore "https://social.msdn.microsoft.com/Forums/en-US/home?forum=visualfoxprogeneral"
    RUN start firefox "https://social.msdn.microsoft.com/Forums/en-US/home?forum=visualfoxprogeneral"
    RUN start chrome "https://social.msdn.microsoft.com/Forums/en-US/home?forum=visualfoxprogeneral"
    RUN start winword "C:\Users\<LOGIN>\Documents\myWordDoc.docx"
    RUN start excel "C:\Users\<LOGIN>\Documents\myExcelXls.xlsx"
    If you want to show chrome or firefox within a VFP form, then you would need an activeX control and both browsers don't support them anymore (if ever).



    Gruss / Best regards
    -Tom
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible,
    you are, by definition, not smart enough to debug it. 010101100100011001010000011110000101001001101111011000110110101101110011

    Thursday, October 10, 2019 6:27 AM
    Answerer
  • Hello,

    then use shellexecute, it has a parameter to not show the dos window

    I never found a way to use createobject with chrome, FF.

    regards

    tom


    • Edited by tom knauf Thursday, October 10, 2019 7:45 AM
    Thursday, October 10, 2019 7:45 AM