本文整理汇总了C++中DragFinish函数的典型用法代码示例。如果您正苦于以下问题:C++ DragFinish函数的具体用法?C++ DragFinish怎么用?C++ DragFinish使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DragFinish函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DragQueryFileW
void DragData::asFilenames(Vector<String>& result) const
{
WCHAR filename[MAX_PATH];
STGMEDIUM medium;
if (FAILED(m_platformDragData->GetData(cfHDropFormat(), &medium)))
return;
HDROP hdrop = (HDROP)GlobalLock(medium.hGlobal);
if (!hdrop)
return;
const unsigned numFiles = DragQueryFileW(hdrop, 0xFFFFFFFF, 0, 0);
for (unsigned i = 0; i < numFiles; i++) {
if (!DragQueryFileW(hdrop, 0, filename, ARRAYSIZE(filename)))
continue;
result.append((UChar*)filename);
}
// Free up memory from drag
DragFinish(hdrop);
GlobalUnlock(medium.hGlobal);
}
示例2: DragAcceptFiles
void CFilesHashDlg::OnDropFiles(HDROP hDropInfo)
{
if(!m_thrdData.threadWorking)
{
unsigned int i;
TCHAR szDragFilename[MAX_PATH];
DragAcceptFiles(FALSE);
m_thrdData.nFiles = DragQueryFile(hDropInfo, -1, NULL, 0);
ClearFilePaths();
for(i=0; i < m_thrdData.nFiles; i++)
{
DragQueryFile(hDropInfo, i, szDragFilename, sizeof(szDragFilename));
CString tmp;
tmp.Format(_T("%s"), szDragFilename);
m_thrdData.fullPaths.push_back(tmp);
}
DragFinish(hDropInfo);
DragAcceptFiles(TRUE);
DoMD5();
}
}
示例3: DragQueryFile
//---------------------------------------------------------------------------
void __fastcall TRefEditForm::WMDropFiles(TWMDropFiles &message)
{
AnsiString FileName;
FileName.SetLength(MAX_PATH);
int Count = DragQueryFile((HDROP)message.Drop, 0xFFFFFFFF, NULL, MAX_PATH);
// index through the files and query the OS for each file name...
for (int index = 0; index < Count; ++index)
{
// the following code gets the FileName of the dropped file. I know it
// looks cryptic but that's only because it is. Hey, Why do you think
// Delphi and C++ Builder are so popular anyway?
FileName.SetLength(DragQueryFile((HDROP)message.Drop, index,
FileName.c_str(), MAX_PATH));
// examine the filename's extension.
// If it's a Word file then ...
if (UpperCase(ExtractFileExt(FileName)) == ".DOC")
{
ListBox_Words->Items->Add(FileName);
}
}
// tell the OS that we're finished...
DragFinish((HDROP) message.Drop);
}
示例4: OnDropFiles
void OnDropFiles(HDROP hdrop)
{
if(!hdrop)
return;
int filesDropped = DragQueryFile(hdrop, 0xffffffff, NULL, 0); //获取拖拽文件的个数
TCHAR pathDropped[1024];
for(int i = 0; i < filesDropped; ++i)
{
ZeroMemory(pathDropped, sizeof(pathDropped));
DragQueryFile(hdrop, i, pathDropped, 1024);
if (0 == _tcsicmp(::PathFindExtension(pathDropped), TEXT(".bmp")))
{
_tcscpy(pathOut, pathDropped);
}
else
{
::StringCbCopy(pathOut, sizeof(pathOut), pathDropped);
::PathRemoveExtension(pathOut);
::PathAddExtension(pathOut, TEXT(".bmp"));
Png2AlphaBitmap(pathDropped, pathOut);
}
}
DragFinish(hdrop);
}
示例5: OnDropFile
void OnDropFile (DWORD wParam)
{
TCHAR FileName [FilePathLen + 1] ;
LPTSTR pFileNameStart ;
HANDLE hFindFile ;
WIN32_FIND_DATA FindFileInfo ;
int NameOffset ;
int NumOfFiles = 0 ;
NumOfFiles = DragQueryFile ((HDROP) wParam, 0xffffffff, NULL, 0) ;
if (NumOfFiles > 0)
{
// we only open the first file for now
DragQueryFile((HDROP) wParam, 0, FileName, FilePathLen) ;
pFileNameStart = ExtractFileName (FileName) ;
NameOffset = pFileNameStart - FileName ;
// convert short filename to long NTFS filename if necessary
hFindFile = FindFirstFile (FileName, &FindFileInfo) ;
if (hFindFile && hFindFile != INVALID_HANDLE_VALUE)
{
// append the file name back to the path name
lstrcpy (&FileName[NameOffset], FindFileInfo.cFileName) ;
FindClose (hFindFile) ;
}
FileOpen (hWndMain, (int)0, (LPTSTR)FileName) ;
PrepareMenu (GetMenu (hWndMain));
}
DragFinish ((HDROP) wParam) ;
}
示例6: HandleFiles
void HandleFiles(WPARAM wParam)
{
// DragQueryFile() takes a LPWSTR for the name so we need a TCHAR string
TCHAR szName[MAX_PATH];
// Here we cast the wParam as a HDROP handle to pass into the next functions
HDROP hDrop = (HDROP)wParam;
// This functions has a couple functionalities. If you pass in 0xFFFFFFFF in
// the second parameter then it returns the count of how many filers were drag
// and dropped. Otherwise, the function fills in the szName string array with
// the current file being queried.
int count = DragQueryFile(hDrop, 0xFFFFFFFF, szName, MAX_PATH);
// Here we go through all the files that were drag and dropped then display them
for (int i = 0; i < count; i++)
{
// Grab the name of the file associated with index "i" in the list of files dropped.
// Be sure you know that the name is attached to the FULL path of the file.
DragQueryFile(hDrop, i, szName, MAX_PATH);
// Bring up a message box that displays the current file being processed
MessageBox(GetForegroundWindow(), szName, "Current file received", MB_OK);
}
// Finally, we destroy the HDROP handle so the extra memory
// allocated by the application is released.
DragFinish(hDrop);
}
示例7: ASSERT
void CFileEditCtrl::OnDropFiles(HDROP hDropInfo)
{
// handles drag and drop file entry, control must have the
// WS_EX_ACCEPTFILES extended style set.
CString szSeperator;
#if defined FEC_NORESOURCESTRINGS
szSeperator = FEC_IDS_SEPERATOR;
#else
szSeperator.LoadString(FEC_IDS_SEPERATOR);
#endif
ASSERT (_tcslen(szSeperator) == 1); // must be one character only
szSeperator += _T(" "); // get the file seperator character
CString szDroppedFiles; // buffer to contain all the dropped files
TCHAR lpstrDropBuffer[_MAX_PATH];
UINT nDropCount = DragQueryFile(hDropInfo,0xffffffff,NULL,0);
if (nDropCount && (m_bFindFolder || (!m_bFindFolder && !(m_pCFileDialog->m_ofn.Flags & OFN_ALLOWMULTISELECT))))
nDropCount = 1;
if (nDropCount)
{
DragQueryFile(hDropInfo, 0, lpstrDropBuffer, _MAX_PATH);
szDroppedFiles = lpstrDropBuffer;
}
for (UINT x = 1; x < nDropCount; x++)
{
DragQueryFile(hDropInfo, x, lpstrDropBuffer, _MAX_PATH);
szDroppedFiles += szSeperator;
szDroppedFiles += lpstrDropBuffer;
}
DragFinish (hDropInfo);
SetWindowText (szDroppedFiles);
}
示例8: handle_drop
static void
handle_drop( HDROP hDrop )
{
size_t bufsize;
char *namebuf;
/* Check that only one file was dropped */
if( DragQueryFile( hDrop, ~0UL, NULL, 0 ) == 1) {
bufsize = DragQueryFile( hDrop, 0, NULL, 0 ) + 1;
if( ( namebuf = malloc( bufsize ) ) ) {
DragQueryFile( hDrop, 0, namebuf, bufsize );
fuse_emulation_pause();
utils_open_file( namebuf, tape_can_autoload(), NULL );
free( namebuf );
display_refresh_all();
fuse_emulation_unpause();
}
}
DragFinish( hDrop );
}
示例9: DragQueryFile
void CPatchListCtrl::OnDropFiles(HDROP hDropInfo)
{
UINT nNumFiles = DragQueryFile(hDropInfo, 0xFFFFFFFF, nullptr, 0);
for (UINT i = 0; i < nNumFiles; ++i)
{
CString file;
DragQueryFile(hDropInfo, i, file.GetBufferSetLength(MAX_PATH), MAX_PATH);
file.ReleaseBuffer();
if (PathIsDirectory(file))
continue;
// no duplicates
LVFINDINFO lvInfo;
lvInfo.flags = LVFI_STRING;
lvInfo.psz = file;
if (FindItem(&lvInfo, -1) != -1)
continue;
int index = InsertItem(GetItemCount(), file);
if (index >= 0)
SetCheck(index, true);
}
DragFinish(hDropInfo);
SetColumnWidth(0, LVSCW_AUTOSIZE);
}
示例10: onDropFile
/*----------*/
void onDropFile(HDROP hDrop)
{
DWORD i, nb, len;
wchar_t wbuf[MAX_PATH+32];
wchar_t* wp;
nb = DragQueryFile(hDrop, (DWORD)-1, NULL, 0);
for(i = 0 ; i < nb ; i++) {
len = DragQueryFile(hDrop, i, NULL, 0);
if(len < 1 || len > MAX_PATH)
continue;
wp = wbuf + 1;
if(! DragQueryFile(hDrop, i, wp, MAX_PATH))
continue;
wp[len] = 0;
while(*wp > 0x20) wp++;
if(*wp) {
wp = wbuf;
len++;
wp[0] = wp[len++] = L'\"';
}
else {
wp = wbuf + 1;
}
wp[len++] = L' ';
__write_console_input(wp, len);
}
DragFinish(hDrop);
}
示例11: USE
unsigned DragData::numberOfFiles() const
{
#if USE(CF)
if (!m_platformDragData)
return 0;
STGMEDIUM medium;
if (FAILED(m_platformDragData->GetData(cfHDropFormat(), &medium)))
return 0;
HDROP hdrop = static_cast<HDROP>(GlobalLock(medium.hGlobal));
if (!hdrop)
return 0;
unsigned numFiles = DragQueryFileW(hdrop, 0xFFFFFFFF, 0, 0);
DragFinish(hdrop);
GlobalUnlock(medium.hGlobal);
return numFiles;
#else
return 0;
#endif
}
示例12: ase_wnd_proc
static LRESULT CALLBACK ase_wnd_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
switch (msg) {
case WM_DROPFILES:
{
ScopedLock lock(*dropped_files_mutex);
HDROP hdrop = (HDROP)(wparam);
int index, count, length;
count = DragQueryFile(hdrop, 0xFFFFFFFF, NULL, 0);
for (index=0; index<count; ++index) {
length = DragQueryFile(hdrop, index, NULL, 0);
if (length > 0) {
TCHAR* lpstr = new TCHAR[length+1];
DragQueryFile(hdrop, index, lpstr, length+1);
dropped_files->push_back(lpstr);
delete[] lpstr;
}
}
DragFinish(hdrop);
}
break;
}
return ::CallWindowProc(base_wnd_proc, hwnd, msg, wparam, lparam);
}
示例13: Thread
/*
Поток для загрузки музыки в плейлист
*/
DWORD WINAPI Thread(LPVOID lp)
{
HDROP hDrop = (HDROP)lp;
CHAR szFileName[MAX_PATH];
TCHAR buff[MAX_PATH];
DWORD dwCount = DragQueryFileA(hDrop, 0xFFFFFFFF, szFileName, MAX_PATH); //Определение количества загружаемых песен
for (INT i = 0; i < dwCount; i++)
{
DragQueryFileA(hDrop, i, szFileName, MAX_PATH); //Определение пути к файлу
INT len = strlen(szFileName);
CHAR buffFormat[4]; //Формат песни
INT j = 0; //для прохода по буферу формата песни
for (INT i = len - 4; i < len; i++)
{
buffFormat[j] = szFileName[i];
j++;
}
if (me_strcmp(".mp3", buffFormat))
{
HSTREAM stream = BASS_StreamCreateFile(0, szFileName, 0, 0, 0); //Создание потока
mbstowcs(buff, szFileName, MAX_PATH); //преобразование CHAR to TCHAR
DlgPlayList::_this->addSongToPlayList(stream, buff); //Добавление песни в плейлист
}
}
DragFinish(hDrop);
return FALSE;
}
示例14: system_event_proc
void system_event_proc(SDL_SysWMmsg *m, AnimPlayer *p){
//process drag and drop event
#if TARGET_OS == WIN
if(m->msg == WM_DROPFILES) {
TCHAR lpszFile[1000]; //buffer for file path
HDROP hDrop = (HDROP)(m->wParam);
DragQueryFile(hDrop, 0, lpszFile, 1000);
DragFinish(hDrop);
//char *file = WIN_StringToUTF8(buffer);
//CStringA cstrText(lpszFile);
//cout << "File dragged: " << lpszFile << endl;
cout << "File dragged!" << endl;
//player polls string
//if string is not empty, player opens file path
p->file_to_open = (const char*)(lpszFile);
}
#elif TARGET_OS == LINUX
if(m->subsystem == SDL_SYSWM_X11) {
//todo
//XdndAware XdndDrop
}
#endif
//other OS ...
}
示例15: text_drag_drop
/* Windows 3.1 drag-drop feature */
void
text_drag_drop(TW *tw, HDROP hdrop)
{
TCHAR *szFile;
int i, cFiles;
unsigned int Len, error;
const char *p;
const TCHAR *t;
if ( (tw->DragPre==NULL) || (tw->DragPost==NULL) )
return;
cFiles = DragQueryFile(hdrop, (UINT)(-1), (LPTSTR)NULL, 0);
for (i=0; i<cFiles; i++) {
Len = DragQueryFile(hdrop, i, NULL, 0);
szFile = (TCHAR *)malloc((Len+1)*sizeof(TCHAR));
if (szFile != 0) {
error = DragQueryFile(hdrop, i, szFile, Len+1);
if (error != 0) {
for (p=tw->DragPre; *p; p++)
SendMessage(tw->hwnd,WM_CHAR,*p,1L);
for (t=szFile; *t; t++) {
if (*t == '\\')
SendMessage(tw->hwnd,WM_CHAR,'/',1L);
else
SendMessage(tw->hwnd,WM_CHAR,*t,1L);
}
for (p=tw->DragPost; *p; p++)
SendMessage(tw->hwnd,WM_CHAR,*p,1L);
}
free(szFile);
}
}
DragFinish(hdrop);
}