Log in

View Full Version : Buy now button


Davaris
12-16-2003, 02:56 AM
Hey Guys,
I was wondering if there is any free code out there that implements the Buy Now button that I have seen on shareware games. What I want to be able to do is click on it and the game will minimise and a given web address will open in the default browser. Unfortuantely I don't have a clue about internet programming and I have a game that is ready for release. :)

luggage
12-16-2003, 02:59 AM
We just use...

ShellExecute( windowHwnd, "open", "https://secure.bmtmicro.com/ECommerce-OffSite/14110000.html", NULL, NULL, SW_SHOWMAXIMIZED );

Which appears to work fine.

scott

StAn
12-16-2003, 03:58 AM
I use ShellExecute( NULL, "open", "http://.../", "", NULL, SW_MAXIMIZE );

That doesn't minimize the game window.
Just to say that the window handle isn't mandatory.

Davaris
12-16-2003, 03:53 PM
Thanks guys. :)

Davaris
12-18-2003, 01:30 PM
Hi again,

I tried the ShellExecute function and it said it didn't know where PROGRAM.EXE was on my harddrive. Should I give it any additional parameters? When I searched for PROGRAM.EXE in the windows directory it was not there.


This is the code I used:

ShellExecute( NULL, "open", "www.mywebpage.com/index.html", "", NULL, SW_MAXIMIZE );


Should the "open" string have something else in it?

escotia
12-18-2003, 01:40 PM
You just need to stick http:// at the start of the address

ShellExecute( NULL, "open", "http://www.mywebpage.com/index.html", "", NULL, SW_MAXIMIZE );


SC

BrewKnowC
12-18-2003, 04:25 PM
I currently use this code in my game:

ShellExecute(0, "open", "iexplore.exe", "http://www.bantamcity.com/werlin/order.html", NULL, SW_SHOWMAXIMIZED);

Now I realize that this will only work for IE browsers, so I tried the code that was just provided in this thread. It works except when it opens the browser window it closes my game (not minimizes it but completely closes it). With the IE code it just minimized my game and opened a browser seperately. Is there a parameter I'm missing?

escotia
12-18-2003, 04:29 PM
I suspect it was my laziness, not scrolling far enough to get the correct final parameter - SW_SHOWMAXIMIZED

ShellExecute( NULL, "open", "http://www.mywebpage.com/index.html", "", NULL, SW_SHOWMAXIMIZED);

SC

BrewKnowC
12-18-2003, 05:09 PM
hmmm... it still just closes out my game completely and opens a browser in place of it.

Davaris
12-18-2003, 05:36 PM
This is the only one that works in my case:

ShellExecute(0, "open", "iexplore.exe", "http://www.bantamcity.com/werlin/order.html", NULL, SW_SHOWMAXIMIZED);

This one asks for PROGRAME.EXE.

ShellExecute( NULL, "open", "http://www.mywebpage.com/index.html", "", NULL, SW_SHOWMAXIMIZED);


I think its fine that Internet Explorer be opened as it is standard on everything after and including Win95.

Thanks for your help.

Nutter
12-18-2003, 06:36 PM
ShellExecute( NULL, "open", "http://www.mywebpage.com/index.html", "", NULL, SW_SHOWMAXIMIZED);
The 4th parameter should be NULL if you specify a document in the 3rd parameter, which you are doing.

ShellExecute( NULL, "open", "http://www.mywebpage.com/index.html", NULL, NULL, SW_SHOWMAXIMIZED);

I think its fine that Internet Explorer be opened as it is standard on everything after and including Win95.
I don't. :p I use Mozilla Firebird (muuuuch better) as my default browser now, and despise applications that open IE instead.

BrewKnowC
12-18-2003, 07:23 PM
Just tried it again with the NULL as the 4th parameter and... same effect. Game Window closes completely and browser pops up. For now I'm gonna stick with the iexporer call I guess...

StAn
02-01-2004, 11:56 PM
Hey, I see a lot of posts I had missed here... And lots of problems. I hope these are the exception rather than the rule, since I really don't want to launch IE instead of the default browser!

Anyway I wanted to know if anyone knew how to open the URL in a _new_ browser window (or tab), rather than in the current one?

(I admit I haven't even tried to search on msdn... I'll have a look now)

Edit: After searching for several hours, it looks like this behaviour is browser-dependant and nothing can be done about it. I'm using Netscape 7 and it reuses the last used window to open URLs, but apparently IE and some Mozilla versions open a new window...

Ok, maybe something can be done using DDE. There is some code in Delphi that supposedly opens URLs in new browser windows here: http://www.delphi32.com/info_facts/faq/faq_389.asp