![]() ![]() We pass the index number, a PChar buffer large enough to hold the file name (with #0 terminator), and the actual buffer size.Īll this makes for extremely unreadable code. The function then returns the buffer size required.įetching the name of the file at a given index. We pass the file's index number in the Index parameter, nil for the file name and 0 for the buffer size. Obvious isn't it!įinding the size of buffer needed to store the file name at a specific (zero based) index. The return value is the number of files dropped. We get this information by passing $FFFFFFFF as the Indexparameter, nil as the file name parameter and 0 as the BufSize parameter. The three tasks the function performs are: BufSize: Integer – size of buffer for the above.FileName: PChar – pointer to a dropped file name.Index: Integer – the index of the file to query in the list of dropped files.DropHandle: HDROP – the drop handle provided by the WM_DROPFILES message.This makes it hard to remember exactly how to use it. Like many Windows API functions, DragQueryFile can perform several functions depending on the parameters passed to it. Both of these require the drop handle from the WM_DROPFILE messages. We use two API function to get information about dropped files – DragQueryFile and DragQueryPoint. When we've finished good manners require that we tell Windows we no longer need to be told about drops. The message supplies us with a "drop handle" that we pass to various API routines to get information about what was dropped. The nominated window has to handle the WM_DROPFILES message that Windows sends us when a drop occurs. To support it we need to tell Windows we want to be notified about file drops, and nominate a window to receive the notifications. Overviewįile drag and drop is not enabled in Windows applications by default. OLE drag and drop is explored in the article " How to receive data dragged from other applications". We'll explore the first, and most simple, of these methods here. The second method uses OLE (COM), and additionally supports inter and intra-application drag and drop. The first is to use Windows drag and drop API functions and handle a related Windows message. There are two main ways to add support to a Windows application. Adding similar support to your program makes it appear more professional. This is often more convenient to the user than using the normal File | Open menu option or toolbar button, since it misses out the step of navigating an Open File dialog box. Many programs allow the user to open files by dragging them from Explorer and dropping them on the program's window. Getting information about dropped files. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |