Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Url
Message
General information
Forum:
Visual FoxPro
Category:
Internet applications
Title:
Re: Url
Miscellaneous
Thread ID:
00513981
Message ID:
00513986
Views:
10
Step #1:

I first created a class called: "slShellExecute"
=> here is the code from the shellexecute() method of the class.

* WinApi :: ShellExecute
** Function: Opens a file in the application that it's
** associated with.
** Pass: lcFileName - Name of the file to open
**
** Return: 2 - Bad Association (e.g., invalid URL)
** 31 - No application association
** 29 - Failure to load application
** 30 - Application is busy
**
** Values over 32 indicate success
** and return an instance handle for
** the application started (the browser)
LPARAMETERS tcFileName,tcWorkDir,tcOperation
LOCAL lcFileName,lcWorkDir,lcOperation

IF EMPTY(tcFileName)
RETURN -1
ENDIF
lcFileName=ALLTRIM(tcFileName)
lcWorkDir=IIF(TYPE("tcWorkDir")="C",ALLTRIM(tcWorkDir),"")
lcOperation=IIF(TYPE("tcOperation")="C" AND NOT EMPTY(tcOperation),ALLTRIM(tcOperation),"Open")

*-* HINSTANCE ShellExecute(hwnd, lpszOp, lpszFile, lpszParams, lpszDir, wShowCmd)
*-*
*-* HWND hwnd - handle of parent window
*-* LPCTSTR lpszOp - address of string for operation to perform
*-* LPCTSTR lpszFile - address of string for filename
*-* LPTSTR lpszParams - address of string for executable-file parameters
*-* LPCTSTR lpszDir - address of string for default directory
*-* INT wShowCmd - whether file is shown when opened
DECLARE INTEGER ShellExecute ;
IN SHELL32.DLL ;
INTEGER nWinHandle,;
STRING cOperation,;
STRING cFileName,;
STRING cParameters,;
STRING cDirectory,;
INTEGER nShowWindow
RETURN ShellExecute(0,lcOperation,lcFilename,"",lcWorkDir,1)


Step #2:
I then created a label with a property ( webAddress ). The property can be set at run or design time, and should have something like "www.levelextreme.com".

Here is the code in the click event of the label:

LOCAL lcExecuteString, loObject

lcExecuteString = "http://" + ALLT( THIS.webAddress )
loObject = CREATEOBJECT( "slShellExecute" )
loObject.shellexecute( lcExecuteString )

loObject = .NULL.
RELEASE loObject

You can then extend this to send e-mail also:

Step #3: Email
I then created a label with a property ( emailAddress ). The property can be set at run or design time, and should have something like "you@somewhere.com".

LOCAL lcExecuteString, loObject

lcExecuteString = "mailto:" + ALLT( THIS.emailAddress )
loObject = CREATEOBJECT( "Slshellexecute" )
loObject.shellexecute( lcExecuteString )

loObject = .NULL.
RELEASE loObject


I'm sure there are many ways to do this, but this is how we did it.

Thanks,
Andreas.
Previous
Reply
Map
View

Click here to load this message in the networking platform