Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Sun, 17 Aug 2008 07:00:00 -0700,    group: microsoft.public.platformsdk.shell        back       


DragQueryFile doesn't work for me   
I'm trying to create a custom form, using Borland C++BuilderX, that will read 
the name of a file that has been dropped into it.  I've seen many examples 
like this:


// Upon window creation
DragAcceptFiles(hMywindow);

// Message Handler
LRESULT CALLBACK WndProc(HWND hWindow, UINT msg, WPARAM wParam, LPARAM lParam)
{
  switch (msg)
  {
    case WM_DROPFILES:
        HDROP hDrop;
        _uiNUMFILES = DragQueryFile(hDrop,0xFFFFFFFF,NULL,0);
        DragFinish(hDrop);
        return 0;
    }
  return DefWindowProc(hWindow,msg,wParam,lParam);
}


I have verified that I am receiving the WM_DROPFILES message, and that the 
value of NUMFILES has been changed upon file-drop, but the return value is 
always -1, regardless of how many files are dropped.  What am I doing wrong?
date: Sun, 17 Aug 2008 07:00:00 -0700   author:   Sumdood

Re: DragQueryFile doesn't work for me   
>    case WM_DROPFILES:
>        HDROP hDrop;
>        _uiNUMFILES = DragQueryFile(hDrop,0xFFFFFFFF,NULL,0);
>        DragFinish(hDrop);
>        return 0;

If that's your real code, hDrop is never initialised - it's random
rubbish.

You need to have:

HDROP hDrop = (HDROP) wParam;

Dave
date: Sun, 17 Aug 2008 16:58:25 +0100   author:   David Lowndes lid

Re: DragQueryFile doesn't work for me   
"David Lowndes" wrote:

> 
> If that's your real code, hDrop is never initialised - it's random
> rubbish.
> 
> You need to have:
> 
> HDROP hDrop = (HDROP) wParam;
> 
> Dave
> 


Ah, now I see.  Thank you.
date: Sun, 17 Aug 2008 09:06:01 -0700   author:   Sumdood

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us