1. Windows Programming
Hi, does anyone know how to launch the default browser and make it point at
a web page from an EU program?
And also how to make a window minimise it's self. I'm using Exotica, and
these things would be useful.
Thanks,
Mark.
2. Re: Windows Programming
- Posted by David Cuny <dcuny at LANSET.COM>
Oct 13, 1999
-
Last edited Oct 14, 1999
Mark wrote:
>Hi, does anyone know how to launch the default browser and make it point at
>a web page from an EU program?
In my Stones game, I wrote:
constant
xShellExecute = linkFunc( shell32, "ShellExecuteA",
{C_LONG, C_LONG, C_LONG, C_LONG, C_LONG, C_LONG}, C_LONG )
procedure shellExecute( sequence cmd, sequence file, atom style )
-- call ShellExecute to display a file
atom result, file_string, cmd_string
-- convert to strings
file_string = allocate_string( file )
cmd_string = allocate_string( cmd )
-- call ShellExecute
result = c_func( xShellExecute,
{ getHandle( Win ), cmd_string, file_string, 0, 0,
style } )
-- free the strings
free( cmd_string )
free( file_string )
end procedure
-- open the html help file
shellExecute( "open", "stones.htm", SW_SHOWDEFAULT )
>And also how to make a window minimise it's self. I'm using Exotica, and
>these things would be useful.
Use the ShowWindow call with SW_MINIMIZE.
-- David Cuny
3. Re: Windows Programming
On Wed, 13 Oct 1999 20:07:52 -0700, David Cuny <dcuny at LANSET.COM> wrote:
>Mark wrote:
>
>
>>Hi, does anyone know how to launch the default browser and make it point
>>at a web page from an EU program?
>
>In my Stones game, I wrote:
<SNIP CODE>
Does this require Win32Lib to run? I don't have access to Win32Lib routines,
because win32lib won't work with Exotica.
I realy meant how could I send the browser to a web site that's on the net,
but I guess I could cheat and make a html file with the game, which somehow
redirects to the web site.
I want to be able to direct users of my program to my web site, so they can
get info, updates and other files.
>>And also how to make a window minimise it's self. I'm using Exotica, and
>>these things would be useful.
>
>Use the ShowWindow call with SW_MINIMIZE.
Is ShowWindow a win32lib routine?
-Mark.
4. Re: Windows Programming
On Thu, 14 Oct 1999 00:16:38 -0400, Liquid-Nitrogen Software
<nitrogen_069 at HOTMAIL.COM> wrote:
>Does this require Win32Lib to run? I don't have access to Win32Lib
>routines, because win32lib won't work with Exotica.
David's code requires win32lib but you don't need it (but I don't see why
it wouldn't work with Exotica since the win32lib calls simply wrap calls
from dll.e and machine.e with some error reporting). I give code below
that doesn't use win32lib...
>I realy meant how could I send the browser to a web site that's on the net,
>but I guess I could cheat and make a html file with the game, which somehow
>redirects to the web site.
I found that this snippet will open a browser with your website in it...
-- start --
include dll.e
include machine.e
atom shell32, window_handle
shell32 = open_dll( "shell32.dll" )
parent_handle = 0
constant
SW_SHOWDEFAULT = 10,
xShellExecute = define_c_func( shell32, "ShellExecuteA",
{C_LONG, C_LONG, C_LONG, C_LONG, C_LONG, C_LONG}, C_LONG )
procedure shellExecute( sequence cmd, sequence file, atom style )
-- call ShellExecute to display a file
atom result, file_string, cmd_string
-- convert to strings
file_string = allocate_string( file )
cmd_string = allocate_string( cmd )
-- call ShellExecute
result = c_func( xShellExecute,
{ parent_handle, cmd_string, file_string, 0, 0, style } )
-- free the strings
free( cmd_string )
free( file_string )
end procedure
-- open the URL
shellExecute( "open", "http://members.xoom.com/nitrogen2000/",
SW_SHOWDEFAULT )
-- end --
NOTE: In the example I set parent_handle to 0. It still works but you
should set it to the handle of the parent window.
(see
e.htm for more info)
>>Use the ShowWindow call with SW_MINIMIZE.
>
>Is ShowWindow a win32lib routine?
ShowWindow is an API call from user32.dll.
(see http://msdn.microsoft.com/library/psdk/winui/windows_2tdj.htm )
Also, these API calls are in Bernie's Win32API.ew library (check recent
contributers page).
-- Brian
5. Re: Windows Programming
On Thu, 14 Oct 1999 03:50:36 -0400, Brian K. Broker <bkb at CNW.COM> wrote:
>I found that this snippet will open a browser with your website in it...
>
>-- start --
>include dll.e
>include machine.e
>
>atom shell32, window_handle
>shell32 = open_dll( "shell32.dll" )
>
>parent_handle = 0
>
...oops, I changed the name of a variable and forgot to change the
declaration. You'll need to change:
atom shell32, window_handle
to
atom shell32, parent_handle
6. Re: Windows Programming
Mark wrote:
>Does [your example code] require Win32Lib to run?
> I don't have access to Win32Lib routines, because
> win32lib won't work with Exotica.
To get the code to run outside of Win32Lib, you need to:
1. Replace linkFunc() with link_c_func.
2. Replace getHandle( Win ) with a handle to your window
> I realy meant how could I send the browser to a web site that's on the
net,
> but I guess I could cheat and make a html file with the game, which
somehow
> redirects to the web site.
I suspect that if you gave it an URL, it just might work.
>Is ShowWindow a win32lib routine?
No, it's part of the Win32 API. Here's how you could link to it without
Win32Lib:
-- ShowWindow() Commands
constant
SW_HIDE = 0,
SW_SHOWNORMAL = 1,
SW_NORMAL = 1,
SW_SHOWMINIMIZED = 2,
SW_SHOWMAXIMIZED = 3,
SW_MAXIMIZE = 3,
SW_SHOWNOACTIVATE = 4,
SW_SHOW = 5,
SW_MINIMIZE = 6,
SW_SHOWMINNOACTIVE = 7,
SW_SHOWNA = 8,
SW_RESTORE = 9,
SW_SHOWDEFAULT = 10,
SW_MAX = 10
-- open the user32 dll, which contains the ShowWindow function
constant
user32 = open_dll( "user32.dll")
-- link to the ShowWindow function in the user32 dll
constant
xShowWindow = linkFunc(user32, "ShowWindow", {C_POINTER, C_INT}, C_INT)
-- wrap the ShowWindow function
procedure ShowWindow( atom handle, integer style )
integer ok
ok = c_func( xShowWindow, { handle, style } )
end procedure
If you had the handle to the window you want to minimize, you would then
write:
ShowWindow( handle, SW_MINIMIZE )
-- David Cuny
7. Re: Windows Programming
Thanks a lot for the help. It works great!
The reason I can't use win32lib with exotica is it has naming conflicts.
It'd probably take a bit of work to make everything work together.
Also, If a dll is open, and you try to open it again, does it re-open it or
just give the same dll-handle-thing as the first time you opened it? just
wanted to make sure it's safe to do that.
-Mark.
8. Re: Windows Programming
On Thu, 14 Oct 1999, Liquid-Nitrogen Software wrote:
> Also, If a dll is open, and you try to open it again, does it re-open it or
> just give the same dll-handle-thing as the first time you opened it? just
> wanted to make sure it's safe to do that.
>
> -Mark.
Should be no problem. According to the Euphoria Reference: "You can open
the same .dll file as many times as you like. No extra memory is used and
you'll get the same number returned each time."
-- Brian
9. Re: Windows Programming
Mark (Liquid-Nitrogen Software) writes:
> Also, If a dll is open, and you try to open it again, does it re-open=
it or
> just give the same dll-handle-thing as the first time you opened it? =
just
> wanted to make sure it's safe to do that.
> =C2=A0
> -Mark.
>
Well, Mark,
It's easy to try that out yourself. I tried it and no bad things
happened. Opening the same DLL a second time gives the same handle
and I don't think that the routines are actually loaded again.
Ad
| Gratis e-mail en meer: http://www.dolfijn.nl/
| Een product van Ilse: http://www.ilse.nl/