Hi there!!
I've got a question concerning the internet. The question is easy. How can I make my program open a webpage with the default browser? Is there a component which makes this?
Thx
Han
Hi there!!
I've got a question concerning the internet. The question is easy. How can I make my program open a webpage with the default browser? Is there a component which makes this?
Thx
Han
Code:HINSTANCE ShellExecute( HWND hwnd, LPCTSTR lpOperation, LPCTSTR lpFile, LPCTSTR lpParameters, LPCTSTR lpDirectory, INT nShowCmd );
While you're breakin' down my back n'
I been rackin' out my brain
It don't matter how we make it
'Cause it always ends the same
You can push it for more mileage
But your flaps r' wearin' thin
And I could sleep on it 'til mornin'
But this nightmare never ends
Don't forget to call my lawyers
With ridiculous demands
An you can take the pity so far
But it's more than I can stand
'Cause this couchtrip's gettin' older
Tell me how long has it been
'Cause 5 years is forever
An you haven't grown up yet
-- You Could Be Mine - Guns N' Roses
This is just what I wanted to avoid... But if there's no other way....
Not one that I personally know of.
While you're breakin' down my back n'
I been rackin' out my brain
It don't matter how we make it
'Cause it always ends the same
You can push it for more mileage
But your flaps r' wearin' thin
And I could sleep on it 'til mornin'
But this nightmare never ends
Don't forget to call my lawyers
With ridiculous demands
An you can take the pity so far
But it's more than I can stand
'Cause this couchtrip's gettin' older
Tell me how long has it been
'Cause 5 years is forever
An you haven't grown up yet
-- You Could Be Mine - Guns N' Roses
how exactly does that work?
It sounds like a cool thing to have happen.
I do not see url, so how would it know where to go?
Is that all the code you need?
Does it require a special header file?
"Hence to fight and conquer in all your battles is not supreme excellence;
supreme excellence consists in breaking the enemy's resistance without fighting."
Art of War Sun Tzu
Read up on it at www.msdn.microsoft.com It requires windows.h
While you're breakin' down my back n'
I been rackin' out my brain
It don't matter how we make it
'Cause it always ends the same
You can push it for more mileage
But your flaps r' wearin' thin
And I could sleep on it 'til mornin'
But this nightmare never ends
Don't forget to call my lawyers
With ridiculous demands
An you can take the pity so far
But it's more than I can stand
'Cause this couchtrip's gettin' older
Tell me how long has it been
'Cause 5 years is forever
An you haven't grown up yet
-- You Could Be Mine - Guns N' Roses
Well using Shellexecute is quite problematic....
I've got a problem with putting the contents of a String into a *char.
I usually get an error.
My code is:
Here filebuffer is a *char array. I won't use constants, since I can't. The web address I'd like to use isn't always the same. However I tried with a constant web address, and it worked so there's nothing wrong with Shellexecute. I only don't know how to use a *char array with it.Code:Error = (int) ShellExecute(NULL, "open", filebuffer, NULL, NULL, SW_SHOWNORMAL);
Could you be more specific with your link.
I"m assuming you are talking about c++, but
I see stuff on VB. Is it VB code?
What should I look for to find it?
"Hence to fight and conquer in all your battles is not supreme excellence;
supreme excellence consists in breaking the enemy's resistance without fighting."
Art of War Sun Tzu
It's quite weird though..
I try to open the page... pardon me, the contents of filebuffer and I get it's contents back in a msgbox and nothing else happens.
The error code it gives is 5... What does that mean? Where can I look it up? msdn.msoft.com isn't quite the best place.. However, I use Borland C++Builder..
>The error code it gives is 5...
#define SE_ERR_ACCESSDENIED 5 // access denied
and
ShellExecute
The information given in this message is known to work on FreeBSD 4.8 STABLE.
*The above statement is false if I was too lazy to test it.*
Please take note that I am not a technical writer, nor do I care to become one.
If someone finds a mistake, gleaming error or typo, do me a favor...bite me.
Don't assume that I'm ever entirely serious or entirely joking.
Well, if you get an error, VS has a thing called error lookup... but there's no one for Borland I fear. However, there's a header called winerror.h in which you should take a look. By doing so, I found that error 5L is defined as ERROR_ACCESS_DENIED and by searching into my Platform SDK collection, I found that it corresponds to:
Even if twm gave you the answer, you should remember the ehader.SE_ERR_ACCESSDENIED The operating system denied access to the specified file.
Anyway, there seems not to be any problems with char * as the parameter expected is a char *. The only condition is that it must be null-terminated.
Nothing about VB here but as Widnows API and all MS stuffs are VB compatible, the function is as well. Besides MSDN provide both examples.Could you be more specific with your link.
I"m assuming you are talking about c++, but
I see stuff on VB. Is it VB code?
What should I look for to find it?
If you are interested in Windows programming, you should definitely take the Platform SDK with its documentation all available at MSDN. (somewhere, you have to search)
It works now. Don't ask me how, but it works. When I check the filebuffer during debugging, I see the webaddress plus some stupid characters.. And guess what... it opens the specified web address..
So I hope it'll work fine from now on...
Never rely on luck...
Does this mean if I'm programming for the command line promp I will not be able to use this capability?
I'm currently learning command line, and have not even touched the gui or window interface yet. Will this restrict me from doing this?
"Hence to fight and conquer in all your battles is not supreme excellence;
supreme excellence consists in breaking the enemy's resistance without fighting."
Art of War Sun Tzu