News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Run URL from default browser

Started by hutch--, December 10, 2019, 10:11:52 PM

Previous topic - Next topic

hutch--

Simple stuff but useful enough. I have added it to the library.


    url "http://www.masm32.com/download/masm32v11r.zip

  The MACRO

    url MACRO quoted
      rcall RunUrl,quoted
    ENDM

  The proc

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

RunUrl proc URLpath:QWORD

    LOCAL pbuf  :QWORD
    LOCAL buff[512]:BYTE

    mov pbuf, ptr$(buff)
    mcat pbuf,"explorer.exe ",URLpath
    rcall execute,pbuf

    ret

RunUrl endp

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

sinsi

Why not ShellExecute with "open" and the url?

Hard-coding "explorer.exe" is bad practice, no? i.e. is it the same name in different languages?

hutch--

I am sure there are multiple ways of doing this, if I find a better way, I will try it but the procedure is basically to test the "execute" procedure which is just a wrapper for CreateProcess.

This works well.

    invoke ShellExecute,0,"open","http://www.masm32.com/download/masm32v11r.zip",0,".",SW_SHOW