Commit 110a1048 authored by Michael Migliore's avatar Michael Migliore
Browse files

Add support for dropped Uniocode file path

parent 19ea76cc
Pipeline #212466 running with stage
......@@ -27,11 +27,11 @@
#include "vtkHardwareWindow.h"
#include "vtkRenderWindow.h"
#include "vtkStringArray.h"
#include "vtkUnicodeString.h"
#include "vtkWin32RenderWindowInteractor.h"
#include "vtkWindows.h"
#include "vtkStringArray.h"
#include <shellapi.h> // for drag and drop
#include <winuser.h> // for touch support
......@@ -789,7 +789,7 @@ int vtkWin32RenderWindowInteractor::OnDropFiles(HWND, WPARAM wParam)
this->InvokeEvent(vtkCommand::UpdateDropLocationEvent, location);
}
UINT cFiles = DragQueryFile(hdrop, 0xFFFFFFFF, nullptr, 0);
UINT cFiles = DragQueryFileW(hdrop, 0xFFFFFFFF, nullptr, 0);
if (cFiles > 0)
{
......@@ -798,17 +798,12 @@ int vtkWin32RenderWindowInteractor::OnDropFiles(HWND, WPARAM wParam)
for (UINT i = 0; i < cFiles; i++)
{
TCHAR file[MAX_PATH];
UINT cch = DragQueryFile(hdrop, i, file, MAX_PATH);
WCHAR file[MAX_PATH];
UINT cch = DragQueryFileW(hdrop, i, file, MAX_PATH);
if (cch > 0 && cch < MAX_PATH)
{
#ifdef UNICODE
char cFile[MAX_PATH];
wcstombs(cFile, file, cch);
filePaths->InsertNextValue(cFile);
#else
filePaths->InsertNextValue(file);
#endif
filePaths->InsertNextValue(
vtkUnicodeString::from_utf16(reinterpret_cast<vtkTypeUInt16*>(file)).utf8_str());
ret = 1;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment