🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #5592

Re: Dragging from application to explorer

#5592
From: Stefano Bonifazi
Date: Wed, 03 Aug 2005 15:30
84 lines
3968 bytes
While I discuss with Mr Gambit about the rules of posting via email I try to 
help you anyway:

here are the main changes I made to Mr. Chandler's code:

in the function CanAcceptText I changed
  if (format.cfFormat == CF_TEXT)
with
 if (format.cfFormat == CF_HDROP)

In the BasicDataObject:::OnGetData event handler

 UINT uBuffSize = 0;
 DROPFILES* pDrop;
 for(int i=0;i<FilesList->Count;i++) //FilesList is a TStringList with the 
files names we have to drag&drop
 {
   uBuffSize += FilesList->Strings[i].Length() + 1;
 }
 uBuffSize = sizeof(DROPFILES) + sizeof(TCHAR) * (uBuffSize + 1);
  // allocate memory
    HGLOBAL const hMem = GlobalAlloc(
    GHND | GMEM_SHARE, uBuffSize
    );
  if (hMem != NULL)
  {
    pDrop = (DROPFILES*) GlobalLock ( hMem );
    // Fill in the DROPFILES struct.
    pDrop->pFiles = sizeof(DROPFILES);
    TCHAR* pszBuff;
    pszBuff = (TCHAR*) (LPBYTE(pDrop) + sizeof(DROPFILES));
    //copy all the filesnames
    for(int i=0;i<FilesList->Count;i++)
    {
      lstrcpy ( pszBuff, (LPCTSTR) FileList->Strings[i].c_str() );
     //pszBuff = 1 + _tcschr ( pszBuff, '\0' );
     pszBuff += (FileList->Strings[i].Length()+1);
    }
    GlobalUnlock ( hMem );

Hope this may help, anyway if Mr. Gambit allow us, I will be glad to send 
You my code!
See You

"Stefano Bonifazi" <stefboombastic@libero.it> ha scritto nel messaggio 
news:42ebf94b@newsgroups.borland.com...
> Hi again!
> I modified the sample code to work with a files list ... if anyone needs 
> it, feel free to email me!
>
> To Mr Chandler: I read You wrote for the BCB5 developers guide, GREAT that 
> book has been my best investment ever!! It introduced me to BCB changing 
> my life :-)
>
> "Damon Chandler (TeamB)" <editor@_REMOVE_THIS_SPAM_GUARD_bcbjournal.com> 
> ha scritto nel messaggio news:42ea4ca4@newsgroups.borland.com...
>> Hi Stefano,
>>   I covered OLE-based drag sources in the December 2002 issue of the 
>> C++Builder Developer's Journal.  You can access the article (in 
>> particular, see Figure A) and source code here...
>>
>> http://bcbjournal.com/free_issue/December02-01.htm
>> http://bcbjournal.com/free_issue/December02Code.zip
>>
>> The code comes with two components, TBasicDropSource and 
>> TBasicDataObject, which are VCL-based descendants of IDropSource and 
>> IDataObject; there's also an example BCB project.
>>
>> HTH,
>> --
>> Damon (TeamB)
>>
>> C++Builder Developer's Journal
>>  http://bcbjournal.com
>> BCB Commonly Asked Questions
>>  http://bcbjournal.com/bcbcaq
>>
>>
>> Stefano Bonifazi wrote:
>>> I guess COleDropSource is the Microsoft implemented class for 
>>> IDropSource and IDataObjetc ... Why did not we have something like that 
>>> with BCB? Where may I see how to implement that my own?
>
> 
Technical Details
Message-ID: <42f0e2fd@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!news.glorb.com!news.moat.net!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.spamkiller.net!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <42e93634@newsgroups.borland.com> <42e94260$1@newsgroups.borland.com> <42e9f481@newsgroups.borland.com> <42ea4ca4@newsgroups.borland.com> <42ebf94b@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,fe3349103cecbbb9
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Stefano Bonifazi" <stefboombastic@libero.it>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <42e93634@newsgroups.borland.com> <42e94260$1@newsgroups.borland.com> <42e9f481@newsgroups.borland.com> <42ea4ca4@newsgroups.borland.com> <42ebf94b@newsgroups.borland.com>
Subject: Re: Dragging from application to explorer
Date: Wed, 3 Aug 2005 17:30:06 +0200
Lines: 86
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 81.211.146.192
Message-ID: <42f0e2fd@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1123083005 81.211.146.192 (3 Aug 2005 08:30:05 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!news.glorb.com!news.moat.net!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.spamkiller.net!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail