SHARE
Facebook X Pinterest WhatsApp

Class that Enables Drag ‘& Drop of Internet Links from IE to a List Control

Environment: VC6 , Window98 Using OLE Drag and Drop, this control enables you to drag and drop any link from Internet Explorer (IE) directly to a list control. You can even drag the icon from the IE address bar so that the current Web page’s URL is inserted into the list control! Here is sample […]

Written By
thumbnail
CodeGuru Staff
CodeGuru Staff
Dec 11, 1999
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

GetLink sample image

Environment: VC6 , Window98

Using OLE Drag and Drop, this control enables you to drag and drop any link from Internet Explorer (IE) directly to
a list control. You can even drag the icon from the IE address bar so that the current
Web page’s URL is inserted into the list control!

Here is sample list control that get the Internet link from Internet Explorer.

1. Insert Following Routine into the Main App.

BOOL CPerfectGetApp::InitInstance()
{
	CoInitialize(NULL);

    if (!AfxOleInit())
    {
        AfxMessageBox("Ole Initialization Failed");
        return FALSE;
    }

    .....

}


int CPerfectGetApp::ExitInstance()
{
	CoUninitialize();

	return CWinApp::ExitInstance();
}


2. In the main dialog header file.

#include "GetList.h"

#define IDC_GET_LIST	4321		// define any constant. ;-)

class CPerfectGetDlg : public CResizingDialog
{

    ....

// Attributes
protected:
	CGetList m_ctrGetList;

    ....
}


3. In the main dialog cpp file.

////////////////////////
// OnCreate
///////////////////////
int CPerfectGetDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{

	....


	// Create GetList control.
	m_ctrGetList.Create(
		LVS_REPORT | WS_VISIBLE | WS_CHILD,
			CRect( 10, 10 , 460, 200),
			this, IDC_GET_LIST);

	m_ctrGetList.SetTextColor(RGB(255,255,255));
	m_ctrGetList.SetTextBkColor(RGB(69,83,103));
	m_ctrGetList.SetBkColor(RGB(69,83,103));


	// List Control Header Initializing.
	LV_COLUMN Lvc;

	Lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
	Lvc.fmt = LVCFMT_LEFT;

	// First Column.
	Lvc.pszText = (LPTSTR)(LPCSTR)"Internet Link";
	Lvc.cx = 440;
	Lvc.iSubItem = 0;
	m_ctrGetList.InsertColumn(0, &Lvc);


	// Set Extended style.
	m_ctrGetList.SetExtendedStyle(
		LVS_EX_ONECLICKACTIVATE |
		LVS_EX_FULLROWSELECT |
		LVS_EX_UNDERLINEHOT |
		LVS_EX_INFOTIP |
		LVS_EX_FLATSB  |
		LVS_EX_GRIDLINES |
		LVS_EX_CHECKBOXES
		);

	...
}


4. Just use it. ;-)



If you drag any link to your new program, your new GetList object show the fully qualified URL.

Downloads

Download demo project – 21 Kb
Download source – 3 Kb

Recommended for you...

Configuring Security Rules In Azure Firewall
Tapas Pal
May 7, 2022
Implementing Circuit Breaker Using Polly
Tapas Pal
Jan 26, 2022
Cloud Computing Types Overview
Zaher Talab
Oct 7, 2021
“Some Day”: 1984: An Editorial on the Future of Computers
Bradley L. Jones
Aug 24, 2021
CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.