Hi all. :D

My problem : I would like to open a web page (for instance "http://www.google.fr") in the default browser then later close the window of this browser where there is that page.

This code allows me to open the default browser at the url of Google :

    .586
    .model flat,stdcall
    option casemap :none

    Include \masm32\include\windows.inc
    Include \masm32\include\kernel32.inc
    Include \masm32\include\advapi32.inc
    Include \masm32\include\user32.inc
    include \masm32\include\shell32.inc

    Includelib \masm32\lib\shell32.lib
    Includelib \masm32\lib\user32.lib
    Includelib \masm32\lib\kernel32.lib
    Includelib \masm32\lib\advapi32.lib

    .data
            url        db "http://www.google.fr"

    .data?

    .code

    start:
        push SW_NORMAL
        push 0
        push 0
        push OFFSET url
        push 0
        push 0
        call ShellExecute

        push 0
        call ExitProcess

    end start

Now, what I would like to know to do is to close the window have just opened while avoiding killing the process. It is not very
pleasant to see all the windows closing themselves if one of opened of it others, I would like to thus close only that there... I sought already in FindWindow to try to recover the handle window but I do not see what to put in parameter because I do not know how I can do to get the title of the window.

Consequently you would be super sympas to agree to help me. :D

Thanks in advance.
Posted on 2005-05-17 08:56:49 by azerty1000
If you destroy the window, it's up to the owner application whether to exit or not - there's not much you can do about that. You can use a value other than SW_NORMAL when calling ShellExecute, though.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shellexecute.asp

Hope that helps! :)
Posted on 2005-05-17 13:40:27 by QvasiModo
I don't think there's any easy way to close just the google results window - there are different browsers around (most notably internet explorer, firefox, mozilla and Opera), various versions of these browsers, and tabbed versions as well.

If you want decent control, you should embed a browser object in your application instead. Someone from this board had an example how to embed both Internet Explorer and the Mozilla engines with assembly..
Posted on 2005-05-17 13:49:58 by f0dder