Пример #1
1
// fires an event when a file, or files are dropped onto the application.
void __fastcall TForm1::WMDropFiles(TWMDropFiles &message)
{ AnsiString FileName;
  FileName.SetLength(MAX_PATH);
  FileName.SetLength(DragQueryFile((HDROP)message.Drop, 0,FileName.c_str(), MAX_PATH));

  if(UpperCase(ExtractFileExt(FileName)) == ".BMP")
  {   bmp->LoadFromFile(FileName) ;
      img->Picture->Bitmap->Assign(bmp) ;
  } else if(UpperCase(ExtractFileExt(FileName)) == ".JPG")
         {   TJPEGImage * jpeg = new TJPEGImage();
             jpeg->LoadFromFile(FileName);
             jpeg->DIBNeeded();   
             bmp->Assign(jpeg);
             img->Picture->Bitmap->Assign(bmp) ;
             delete jpeg;
         }
  preview->frmSelect->Position = 0 ;
  outType->ItemIndex = 1 ;
  if(preview->Visible) updatePreview();
  int l = bmp->Width, h = bmp->Height ;
  transType->ItemIndex = 0 ;
  //preview->TransparentColor = 0 ;
  // auto compute frame number and frameset way
   if(l < 142 || h < 142)
    {  
       int s ; int yyop ; int *v=&h, *vh=&l ;
       if(l > h*2) { v=&l ; vh=&h ; vertical=0 ; } // horizontal frameset
       else vertical = 1 ;
       flipWay->Checked = !vertical ;
       s = *vh + 3 ;
       do { yyop = (*v)/s ; } while(s && yyop*s-- != *v) ; ++s ;
       if(s < 4)
       {  frmNb->Text = 1 ;
          sprintf(msg,"frames of %i*%i",l,h) ;
          LabelSize->Caption = msg ; fsx = l ; fsy = h ;
       }
       else {nb = yyop ; fsx = s ; fsy = *vh ;
             frmNb->Text = yyop ;
             sprintf(msg,"frames of %i*%i",s,*vh) ;
             LabelSize->Caption = msg ;
       }
    } else { frmNb->Text = 1 ;
             sprintf(msg,"frames of %i*%i",l,h) ;
             LabelSize->Caption = msg ;
             nb=1 ;
           }
  preview->ClientHeight = h ;
  preview->ClientWidth  = l + (nb > 1)*15 ;
  preview->Caption      = FileName + " (" + nb + ")" ;
  fname = FileName ;
  outTypeChange((TObject*)42) ;
  Form1->Button1->Enabled = 1 ;
  Form1->Height = 304 ;
  Form1->StatusBar->Visible = 1 ;
  // tell the OS that you're finished...
  DragFinish((HDROP) message.Drop);
}
Пример #2
0
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 );
}
Пример #3
0
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);
}
Пример #4
0
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();
	}
}
Пример #5
0
//---------------------------------------------------------------------------
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);
}
Пример #6
0
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);
}
Пример #7
0
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) ;
   }
Пример #8
0
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);
}
Пример #9
0
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);
}
Пример #10
0
/*
	Поток для загрузки музыки в плейлист
*/
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;
}
Пример #11
0
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);
}
Пример #12
0
/*----------*/
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);
}
Пример #13
0
void HandleDrag(HWND hwnd, HDROP hDrop)
{
	int cFiles, i;
	char szFile[MAX_PATH];
	char *ext;
	int flag = 0;

	cFiles = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0);
	for (i = 0; i < cFiles; i++)
	{
		DragQueryFile(hDrop, i, szFile, sizeof(szFile));

		if (ext = strrchr(szFile, '.'))
		{
			if (stricmp(ext, ".aac") == 0 || stricmp(ext, ".mp4") == 0)
			{
				flag = 1;
				decthread_addfile(szFile);
				stop_decoding = 0;
			}
		}
	}

	DragFinish(hDrop);

	if (flag)
		SetEvent(event);
}
Пример #14
0
void OnDropFiles(HDROP hDrop, HWND hDlg, thread_param* ptp)
{
	struct CB cb;
	TCHAR FileName[MAXPATH];
	DWORD i;
	DWORD FileNum;

	cb.cnt = 0;
	cb.filter = 0;
	cb.ptp = ptp;


	GetDlgItemText(hDlg, IDC_EXEPATH, g_ExePath, MAX_PATH);
	GetDlgItemText(hDlg, IDC_KEYPATH, g_KeyPath, MAX_PATH);

	if (!g_ExePath[0] || !g_KeyPath[0])
	{
		AppendMsg(L"路径不合法\r\n");
		return;
	}

	FileNum  = DragQueryFile(hDrop, -1, NULL, 0);

	for (i=0; i<FileNum; ++i)
	{
		DragQueryFile(hDrop, i, (LPTSTR)FileName, MAXPATH);
		AppendFileToQueue(FileName, callback, &cb);
	}
	DragFinish(hDrop);

	return;
}
Пример #15
0
void DragData::asFilenames(Vector<String>& result) const
{
#if USE(CF)
    if (m_platformDragData) {
        WCHAR filename[MAX_PATH];

        STGMEDIUM medium;
        if (FAILED(m_platformDragData->GetData(cfHDropFormat(), &medium)))
            return;

        HDROP hdrop = reinterpret_cast<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, i, filename, WTF_ARRAY_LENGTH(filename)))
                continue;
            result.append(static_cast<UChar*>(filename));
        }

        // Free up memory from drag
        DragFinish(hdrop);

        GlobalUnlock(medium.hGlobal);
        return;
    }
    result = m_dragDataMap.get(cfHDropFormat()->cfFormat);
#endif
}
Пример #16
0
    STDMETHOD (DragEnter) (LPDATAOBJECT pDataObject, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect)
    {
        AddRef();
        m_filename[0] = 0;
        if (pDataObject)
        {
            FORMATETC fmte;
            fmte.cfFormat   = CF_HDROP;
            fmte.ptd        = NULL;
            fmte.dwAspect   = DVASPECT_CONTENT;  
            fmte.lindex     = -1;
            fmte.tymed      = TYMED_HGLOBAL;

            STGMEDIUM medium;
            if (SUCCEEDED(pDataObject->GetData(&fmte, &medium)))
            {
                HDROP hDrop = (HDROP)medium.hGlobal;
                m_filename[0] = 0;
                DragQueryFile(hDrop, 0, m_filename, sizeof(m_filename));
                DragFinish(hDrop);
                m_flags = is_stylefile(m_filename) ? 2 : 0;
            }
        }
        *pdwEffect = DROPEFFECT_NONE;
        return S_OK;
    }
Пример #17
0
void CMainFrame::OnDropFiles( HDROP hDropInfo )
{
	SetActiveWindow();      // activate us first !

	CWinApp* pApp = AfxGetApp();
	ASSERT(pApp != NULL);

	CString strFile;
	UINT nFilesCount=DragQueryFile(hDropInfo,INFINITE,NULL,0);
	for(UINT i=0; i<nFilesCount; i++)
	{
		int pathLen = DragQueryFile(hDropInfo, i, strFile.GetBuffer(MAX_PATH), MAX_PATH);
		strFile.ReleaseBuffer(pathLen);
		DWORD dwFileAttr = ::GetFileAttributes(strFile);
		if ((dwFileAttr & FILE_ATTRIBUTE_DIRECTORY)==FILE_ATTRIBUTE_DIRECTORY)
		{
			//目录,需要递归里面包含的文件
		}
		else
		{
			CString strExt=strFile.Mid(strFile.GetLength()-4,4);
			if (strExt.CompareNoCase(_T(".xml"))==0)
			{
				pApp->OpenDocumentFile(strFile);
			}
		}
	}
	DragFinish(hDropInfo);
}
Пример #18
0
LRESULT MetroWindow::OnDropfiles(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL & bHandled)
{
    const LPCWSTR PackageSubffix[] = { L".exe", L".dll", L".com", L".sys", L"scr", L"fon", L"drv" };
    HDROP hDrop = (HDROP)wParam;
    UINT nfilecounts = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0);
    WCHAR dropfile_name[MAX_PATH];
    std::vector<std::wstring> filelist;
    for (UINT i = 0; i < nfilecounts; i++) {
        DragQueryFileW(hDrop, i, dropfile_name, MAX_PATH);
        auto ext=PathFindExtensionW(dropfile_name);
        if (ext) {
            for (auto s : PackageSubffix) {
                if (_wcsicmp(s, ext)) {
                    filelist.push_back(dropfile_name);
                    break;
                }
            }
        }
        if (!filelist.empty()) {
            ::SetWindowTextW(::GetDlgItem(m_hWnd, IDC_IMAGE_URI_EDIT), filelist[0].c_str());
            if (PortableExecutableFileRander(filelist.at(0)) != S_OK) {
                ::MessageBoxW(m_hWnd, filelist.at(0).c_str(), L"Cannot analyzer this file", MB_OK | MB_ICONSTOP);
                return S_FALSE;
            }
        }
    }
    DragFinish(hDrop);
    ::InvalidateRect(m_hWnd, NULL, TRUE);
    return S_OK;
}
Пример #19
0
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);
}
Пример #20
0
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 ...
}
Пример #21
0
/**	@fn	void CTransportDlg::OnDropFiles(HDROP hDropInfo)
 *	@brief	拖拉文件至主窗口,启动文件发送线程发送文件
 *	@param hDropInfo 系统定义.
 */
void CTransportDlg::OnDropFiles(HDROP hDropInfo)
{
	char *filename = new char[100];
	int count = ::DragQueryFile(hDropInfo, 0xffffffff, NULL, 512);	//get count of dropped files

	for (int i = 0; i < count; i++)
	{
		//get filename
		int nchar = DragQueryFile(hDropInfo, i, filename, 512);

		SENDPROCPARAM *pSendFileProcParam = new SENDPROCPARAM;
		pSendFileProcParam->dwIPOpposite = m_dwIPOpposite;
		pSendFileProcParam->iPort = SERVERPORT;
		pSendFileProcParam->hMainWnd = m_hWnd;
		pSendFileProcParam->strFileName = filename;
		pSendFileProcParam->piProcess = &m_iProcess;

		HANDLE hSendFileThread = CreateThread(NULL, 0, SendFileProc, (LPVOID)pSendFileProcParam, 0, NULL);
		CloseHandle(hSendFileThread);		//close this handle to release its counter

	}

	DragFinish(hDropInfo);
	delete[] filename;

	CDialog::OnDropFiles(hDropInfo);
}
Пример #22
0
/* 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);
}
Пример #23
0
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
}
Пример #24
0
// ==> drag & drop support, added by regret
static void onDropFiles(HWND, WPARAM wParam)
{
    TCHAR filename[MAX_PATH];
    HDROP hDrop = (HDROP)wParam;
    DragQueryFile(hDrop, 0, filename, MAX_PATH); // get first filename
    DragFinish(hDrop);
    directLoadGame(filename);
}
Пример #25
0
char *get_dragged_file(char *buffer, WPARAM wParam)
{
    HDROP hDrop = (HDROP) wParam;
    buffer[0] = 0;
    DragQueryFile(hDrop, 0, buffer, MAX_PATH);
    DragFinish(hDrop);
    return buffer;
}
Пример #26
0
void OnDropFiles(HDROP hDrop)
{
	char path[256];

	DragQueryFile(hDrop, 0, path, sizeof(path));
	DragFinish(hDrop);
	OpenMedia(path);
}
Пример #27
0
/***********************************************************************
 *          NOTEPAD_OnDropFiles
 *
 *  WM_DROPFILES window message handle function
 *
 *  ARGUMENTS:
 *    - handle of window:
 *         HWND hWnd
 *    - drop info:
 *         HDROP hDrop
 *  RETURNS: none
 */
static void NOTEPAD_OnDropFiles(HWND hWnd, HDROP hDrop)
{
    char FileName[MAX_PATH];
    //HANDLE hDrop = (HANDLE)wParam;

    DragQueryFile(hDrop, 0, FileName, ARRAY_SIZE(FileName));
    DragFinish(hDrop);
    DoOpenFile(FileName);
}
Пример #28
0
void Notepad_OnDropFiles(HWND hwnd, HDROP hDropInfo, char * filename ) {
	int nb, taille ;
	nb=DragQueryFile(hDropInfo, 0xFFFFFFFF, NULL, 0 );
	if( nb> 0 ) {
		taille=DragQueryFile(hDropInfo, 0, NULL, 0 )+1;
		DragQueryFile(hDropInfo, 0, filename, taille );
		}
	DragFinish(hDropInfo);
	}
Пример #29
0
void CEzShortcutDlg::OnDropFiles(HDROP hDropInfo)
{
	TCHAR szPathName[MAX_PATH];

	// 드롭된 파일의 갯수
	int nFiles=DragQueryFile(hDropInfo, 0xFFFFFFFF, szPathName, MAX_PATH);
	if( nFiles != 1)
	{
		AfxMessageBox(_T("This application is not support multi-file drag & drop"));
		return;
	}

	for(int index=0 ; index < nFiles ; index++)
	{
		DragQueryFile(hDropInfo, index, szPathName, MAX_PATH);     // 파일의 경로 얻어옴
		std::wstring strExt = light::get_file_ext(szPathName);

		if( strExt == _T("lnk" ))
		{
			IShellLink *link;
			IPersistFile *pfile;
			BSTR szLinkPath;
			CString szPrePath;
			TCHAR szBuffer[MAX_PATH];

			CString fname = szPathName;
			if(SUCCEEDED(CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&link))) 
			{
				link->QueryInterface(IID_IPersistFile, (void **)&pfile);
				szLinkPath = fname.AllocSysString();
				pfile->Load(szLinkPath, STGM_READ);
				SysFreeString(szLinkPath);
				link->Resolve(NULL, NULL);
				link->GetPath(szBuffer, MAX_PATH, NULL, 0);

				// 리스트 박스나 메세지 박스로 해당 경로 값을 불러온다. (szBuffer)
				_tcsncpy_s(szPathName , szBuffer, _TRUNCATE);
				pfile->Release();
				link->Release();
			}
		}
		
		SHORTCUT_INFO ShortcutInfo(GetSafeHwnd());
		ShortcutInfo.m_strShortcutName = light::get_file_name_without_ext(szPathName);
		ShortcutInfo.m_strProgramPath = szPathName;
		if( true == OnEditShortcutDlg(ShortcutInfo) )
		{
			AddShortCutInfo(ShortcutInfo);
			RebuildShortcutList();
			AutoSave();
		}
	}

	DragFinish(hDropInfo);

	CDialog::OnDropFiles(hDropInfo);
}
Пример #30
0
INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	char error[1000];
	static bool pause = false;

	switch (uMsg)
	{
	case WM_INITDIALOG:
		// Set Class icon
		SetClassLongPtr(hDlg, GCL_HICON, (LONG_PTR)LoadIcon(g_instance, MAKEINTRESOURCE(IDI_ICON)));

		SetTimer(hDlg, 1, 500, NULL);

		return TRUE;  // return FALSE if modeless and SetFocus is called

	case WM_DROPFILES:
		DragQueryFile((HDROP)wParam, 0, filename, MAX_PATH);
		DragFinish((HDROP)wParam);
		g_new = true;
		return TRUE;

	case WM_TIMER:
		if (!pause)
		{
			LoadFile(hDlg, filename, error, &g_ftLastWriteTime, g_new);
			g_new = false;

			if (*error)
			{
				pause = true;
				*filename = 0;
				MessageBox(hDlg, error, "Error", MB_OK);
				SetWindowText(hDlg, "Tail");
				pause = false;
			}
		}
		return TRUE;

	case WM_SIZE:
		MoveWindow(GetDlgItem(hDlg, IDC_TEXT), 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE);
		return TRUE;

	case WM_COMMAND:
		switch (LOWORD(wParam))
		{
		case IDOK:
			return TRUE;

		case IDCANCEL:
			// Quit program...
			EndDialog(hDlg, wParam);  // Close dialogwindow
			return TRUE;
		}
	}

	return FALSE;
}