Open URL

Open URL

Post by Ivan Mayrako » Tue, 08 Jul 2003 03:44:33



Hello all,
I try to open URLs by ShellExecute(..), it's work under Windows 98 but
not working under Windows XP. The Internet Explorer  starts but not
searching site, the IE custom bar is not shown until I not click "stop"
icon. I try create and use ".url" files instead of  use URL link like
http://www.some.com as lpFile parameter but it not take effect.

Is there a other way to open URLs under Windows XP?

Thank you.

 
 
 

Open URL

Post by Srinivas Chakravarthula [MSFT » Wed, 09 Jul 2003 03:28:37


Hi Ivan:

Can you post the exact code you are using?  That will help in analyzing your
problem.

Thanks
Srinivas [MSFT]
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.


Quote:> Hello all,
> I try to open URLs by ShellExecute(..), it's work under Windows 98 but
> not working under Windows XP. The Internet Explorer  starts but not
> searching site, the IE custom bar is not shown until I not click "stop"
> icon. I try create and use ".url" files instead of  use URL link like
> http://www.some.com as lpFile parameter but it not take effect.

> Is there a other way to open URLs under Windows XP?

> Thank you.


 
 
 

Open URL

Post by Ivan Mayrako » Wed, 09 Jul 2003 09:10:18


Hello all,

Here is code:

#include <windows.h>

LPSTR sMailto="mailto:";
LPSTR sHttp="http://";

BOOL LinkShell(LPSTR sLink) // First procedure by ShellExecute
{
LPSTR sTmp;
LPSTR sTmp2;

sTmp=sLink;

if (*sTmp!=':')
{

sTmp2=(LPSTR)LocalAlloc(LMEM_FIXED,lstrlen(sLink)+lstrlen(sTmp)+10);
if (sTmp2==NULL) return FALSE;
lstrcpy(sTmp2,sTmp);lstrcat(sTmp2,sLink);

Quote:} else sTmp2=sLink;

//MessageBox(NULL,sTmp2,"",MB_OK);
ShellExecute(NULL,"open",sTmp2,NULL,NULL,SW_SHOWNORMAL);
if (sLink!=sTmp2) LocalFree(sTmp2);
return TRUE;

Quote:}

LPSTR sUrlPrint="[InternetShortcut]\r\nURL=%s\r\n";
LPSTR sUrlFile="%i.url";

BOOL LinkShell2(LPSTR sLink) // Second try by .URL files

{
LPSTR sTmp;
LPSTR sTmp2;
LPSTR sTmp3;
char urlfilename[1000];
HANDLE hFile;
DWORD Tmp;

sTmp=sLink;

if (*sTmp!=':')
{

sTmp2=(LPSTR)LocalAlloc(LMEM_FIXED,lstrlen(sLink)+lstrlen(sTmp)+10);
if (sTmp2==NULL) return FALSE;
lstrcpy(sTmp2,sTmp);lstrcat(sTmp2,sLink);

Quote:} else sTmp2=sLink;

sTmp3=(LPSTR)LocalAlloc(LMEM_FIXED,lstrlen(sUrlPrint)+lstrlen(sTmp2));
if (sTmp3!=NULL)
{
wsprintf((LPSTR)&urlfilename,sUrlFile,GetTickCount());
wsprintf(sTmp3,sUrlPrint,sTmp2);
hFile=CreateFile((LPSTR)&urlfilename, GENERIC_WRITE, 0, NULL,CREATE_ALWAYS, 0,
NULL);
if (hFile!=INVALID_HANDLE_VALUE)
 {
        WriteFile(hFile,sTmp3,lstrlen(sTmp3), &Tmp, NULL);
 CloseHandle(hFile);
 }
LocalFree(sTmp3);

ShellExecute(NULL,"open",(LPSTR)&urlfilename,NULL,NULL,SW_SHOWNORMAL);
Sleep(5000); // Delay to allow IE open link
DeleteFile((LPSTR)&urlfilename);

Quote:}

if (sLink!=sTmp2) LocalFree(sTmp2);
return TRUE;

Quote:}

// Test
main()
{
LinkShell("www.microsoft.com");

Quote:}

thank you,
Good Luck!

> Hi Ivan:

> Can you post the exact code you are using?  That will help in analyzing your
> problem.

> Thanks
> Srinivas [MSFT]
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
> Use of included script samples are subject to the terms specified at
> http://www.microsoft.com/info/cpyright.htm.



> > Hello all,
> > I try to open URLs by ShellExecute(..), it's work under Windows 98 but
> > not working under Windows XP. The Internet Explorer  starts but not
> > searching site, the IE custom bar is not shown until I not click "stop"
> > icon. I try create and use ".url" files instead of  use URL link like
> > http://www.some.com as lpFile parameter but it not take effect.

> > Is there a other way to open URLs under Windows XP?

> > Thank you.

 
 
 

1. Hypertext (open URL) in German Frame 6.0

Hi,

the German version of FrameMaker 6.0 translated too much. :-( They not
only translated the standard suffixes (which makes it very hard to use
international book templates), they also translated the hypertext
markers:

adding a hypertext marker "message URL <url>" got in the window
translated to "Meldung URL <url>". Unfortunatelly Frame does not
recognize this translation which results in an error "'Meldung' is a
unknown command"... One always has to change the text manually to
"message..."

Did anyone solve that problem or is it just a bug I have to live with
unutin the next update of Frame?

        Gerhard.

--
Gerhard M?ller, Carl-von-Ossietzky Universit?t Oldenburg

2. A Multi-Media E-Mail Tutorial With MH

3. Open URL in new window

4. unable to upgrade PIX system

5. trouble opening xll from a URL in excel 97

6. maybe...

7. How to have a PDF url link open in a new window?

8. The Windows API

9. Open a URL with Adobe Acrobat from API?

10. pdf's don't always open via url link

11. How do I open a url in mozilla from Vim?

12. can I use command line to launch internet explorer and open one url each time