Article View: borland.public.cppbuilder.nativeapi
Article #152Re: Drag-and-drop 101
From: Eliot Frank
Date: Tue, 17 Jun 2008 13:13
Date: Tue, 17 Jun 2008 13:13
19 lines
1695 bytes
1695 bytes
Mike K wrote: > > filename.SetLength(DragQueryFile((HDROP)message.Drop,i,fname.c_str(),MAX_PATH)); This is very very wrong. What's "fname"? Is fname initialized to be long enough to accept up to MAX_PATH bytes? Since you don't show the initialization code, I guess the answer is no. If fname is an uninitialized String (aka AnsiString), c_str() returns NULL (bad bad craziness there). Also you are passing a char const * (the result of c_str()) to a function that expects a char * (I don't see why that should even compile). Just use the simple, char name[MAX_PATH]; DragQueryFile((HDROP)message.Drop,i,name,MAX_PATH); filename = name; -Eliot
Technical Details
Message-ID:
<4857b861@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<4857aabb$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,15dfb293aacb32ec X-Google-Attributes: gid10cc67,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Date: Tue, 17 Jun 2008 09:13:03 -0400 From: Eliot Frank <eliot_h_frank@yahoosky.comski> User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Drag-and-drop 101 References: <4857aabb$1@newsgroups.borland.com> In-Reply-To: <4857aabb$1@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 18.125.1.130 Message-ID: <4857b861@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1213708385 18.125.1.130 (17 Jun 2008 06:13:05 -0700) Lines: 19 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail