Are there something wrong with dragqueryfile or extracticon?

  • Thread starter Thread starter Kenny
  • Start date Start date
K

Kenny

Hi,all!
I am new to VC++.net. When I debug these code followed, It doesn't
work.Could anyone tell me why?
(This is an example in Programming Windows with MFC,Second Edition)
void CShowIconDlg::OnDropFiles(HDROP hDropInfo)
{


int nCount = ::DragQueryFile(hDropInfo,(UINT)-1,NULL,0);

if(nCount ==1)
{
m_wndIconListBox.ResetContent();

char szFile[MAX_PATH]="newfile";

::DragQueryFile(hDropInfo,0,szFile,sizeof(szFile));
int nIcons = (int) ::ExtractIcon(NULL,szFile,(UINT)-1);

if(nIcons)
{
HICON hIcon;
for(int i=0; i<nIcons; i++)
{
hIcon = ::ExtractIcon(AfxGetInstanceHandle(),szFile,i);
m_wndIconListBox.AddIcon(hIcon);
}
}

CString strWndTitle = szFile;
strWndTitle += _T(" - IconView");
SetWindowText(strWndTitle);

CClientDC dc(this);
m_wndIconListBox.SetCurSel(0);
m_wndIconListBox.ProjectImage(&dc,m_rcImage,::GetSysColor(COLOR_3DFACE));
}
::DragFinish(hDropInfo);
}

Thanks in advance,

Kenny


--
Do you fear the force of the wind,
The slash of the rain?
Go face them and fight them,
Be savage again,
Go hungry and cold like the wolf,
Go wade like the crane:
The palms of your hands wil thicken,
The skin of your cheeks will tan,
You'll grow ragged and weary and swarthy,
But you'll walk like a man!

MSN:[email protected]
WEB site:www.feifeinet.com
 
Hi,all!
I am new to VC++.net. When I debug these code followed, It doesn't
work.Could anyone tell me why?

When you drop a file, your application is already
started or the drop launches the application ?
 
Back
Top