|
-
June 4th, 2012, 08:45 PM
#1
Drag&Drop works in IDE but crashes in EXE
I have a dialog that accepts a Drag&Drop of a file. I have it working, without a problem, in the IDE while testing. I can compile it without error. But when I try it from the EXE, it crashes the program.
Putting some windows prompts, I can see that it goes through the entire Drag&Drop routine without a problem but when that function apparently ends, that is where it crashes.
Here's the code:
Code:
class CMayDlg : public CDialog
{
// Construction
public:
CString m_sFiles;
void OnDropFiles(HDROP hdrop);
...
};
BEGIN_MESSAGE_MAP(CMyDlg, CDialog)
//{{AFX_MSG_MAP(CMyDlg)
...
ON_MESSAGE(WM_DROPFILES,OnDropFiles)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CMyDlg::OnDropFiles(HDROP hdrop)
{
UINT uNumFiles;
TCHAR szNextFile[8096];
UpdateData(true);
// Get the # of files being dropped.
uNumFiles = DragQueryFile ( hdrop, -1, NULL, 0 );
m_sFiles="";
for ( UINT uFile = 0; uFile < uNumFiles; uFile++ )
{
// Get the next filename from the HDROP info.
if ( DragQueryFile ( hdrop, uFile, szNextFile, 8096 ) > 0 )
{
m_sFiles += szNextFile;
m_sFiles +="\r\n";
}
}
// Free up memory.
DragFinish ( hdrop );
}
As said, I am at a loss. Not sure if this is a VC++ v6 bug or I accidentally overlooked something. Not sure how to debug this any further because I am leaving the "called" routine via the WM_MESSAGE. It's something after that that is crashing it appears.
Any help is greatly appreciated.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|