URLLabel.cpp
上传用户:szb0815
上传日期:2007-06-13
资源大小:338k
文件大小:3k
- /*
- Software and source code Copyright (C) 1998-2000 Stanford University
- Written by Michael Eisen (eisen@genome.stanford.edu)
- This software is copyright under the following conditions:
- Permission to use, copy, and modify this software and its documentation
- is hereby granted to all academic and not-for-profit institutions
- without fee, provided that the above copyright notice and this permission
- notice appear in all copies of the software and related documentation.
- Permission to distribute the software or modified or extended versions
- thereof on a not-for-profit basis is explicitly granted, under the above
- conditions. However, the right to use this software in conjunction with
- for profit activities, and the right to distribute the software or modified or
- extended versions thereof for profit are *NOT* granted except by prior
- arrangement and written consent of the copyright holders.
- Use of this source code constitutes an agreement not to criticize, in any
- way, the code-writing style of the author, including any statements regarding
- the extent of documentation and comments present.
- The software is provided "AS-IS" and without warranty of ank kind, express,
- implied or otherwise, including without limitation, any warranty of
- merchantability or fitness for a particular purpose.
- In no event shall Stanford University or the authors be liable for any special,
- incudental, indirect or consequential damages of any kind, or any damages
- whatsoever resulting from loss of use, data or profits, whether or not
- advised of the possibility of damage, and on any theory of liability,
- arising out of or in connection with the use or performance of this software.
- This code was written using Borland C++ Builder 4 (Inprise Inc., www.inprise.com)
- and may be subject to certain additional restrictions as a result.
- */
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #pragma hdrstop
- #include "URLLabel.h"
- #include "ShellApi.h"
- #pragma package(smart_init)
- //---------------------------------------------------------------------------
- // ValidCtrCheck is used to assure that the components created do not have
- // any pure virtual functions.
- //
- static inline void ValidCtrCheck(TURLLabel *)
- {
- new TURLLabel(NULL);
- }
- //---------------------------------------------------------------------------
- __fastcall TURLLabel::TURLLabel(TComponent* Owner)
- : TLabel(Owner)
- {
- URL = "";
- }
- //---------------------------------------------------------------------------
- namespace Urllabel
- {
- void __fastcall PACKAGE Register()
- {
- TComponentClass classes[1] = {__classid(TURLLabel)};
- RegisterComponents("Extras", classes, 0);
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TURLLabel::Click()
- {
- if (URL != "")
- {
- //HTML->RequestDoc(URL);
- ShellExecute(Handle, "open", URL.c_str(), 0, 0, SW_SHOWNORMAL);
- }
- }