Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile Exe
#Dim All
%Unicode=1
#Include "Win32API.inc"
Global hDlg As Dword
Function PBMain() As Long
Dialog New Pixels, 0, "Drop Test",600,1400,200,200, %WS_OverlappedWindow To hDlg
DragAcceptFiles hDlg, %True
Control Add Label, hDlg, 200,"Drag/drop file anywhere within app!", 20,40,170,20
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local i,FileCount As Long, FileName As WStringZ * %Max_Path, temp$
Select Case Cb.Msg
Case %WM_DROPFILES
FileCount = DragQueryFile(Cb.WParam, -1, ByVal 0, 0)
For i = 0 To FileCount-1
DragQueryFile Cb.WParam, i, FileName, SizeOf(FileName)
temp$ = temp$ + $CrLf + FileName
Next i
DragFinish Cb.WParam
MsgBox "Dropped filenames: " + $CrLf + $CrLf + Trim$(temp$,$CrLf)
End Select
End Function
' If UCase$(Right$(FILENAME, 4)) = ".LNK" Then FILENAME = GetLinkInfo(FILENAME, 1)
' Case %WM_DROPFILES
' ' Drag+Drop file handler
' Local i As Long
' Local lFileCnt As Long
' Local szFile As AsciiZ * %Max_Path
' lFileCnt = DragQueryFile(Cb.WParam, -1, ByVal 0, 0)
' For i = 0 To lFileCnt - 1
' DragQueryFile Cb.WParam, i, szFile, SizeOf(szFile)
' MsgBox Format$(i + 1) + " of " + Format$(lFileCnt) + $Cr + _
' szFile, %MB_TaskModal
' Next i
' DragFinish Cb.WParam
'gbs_01196
'Date: 05-11-2013
http://www.garybeene.com/sw/gbsnippets.htm