Handle files that are dragged and dropped onto Projec64's window.

This commit is contained in:
Emmet Young 2015-02-17 01:13:02 +11:00
parent 1f97185f05
commit 45f83e9d2c
1 changed files with 15 additions and 1 deletions

View File

@ -310,7 +310,7 @@ void CMainGui::Caption (LPCSTR Caption) {
void CMainGui::Create (const char * WindowTitle)
{
m_hMainWindow = (HWND)CreateWindow ("Project64 2.0", WindowTitle, WS_OVERLAPPED | WS_CLIPCHILDREN |
m_hMainWindow = (HWND)CreateWindowEx(WS_EX_ACCEPTFILES, "Project64 2.0", WindowTitle, WS_OVERLAPPED | WS_CLIPCHILDREN |
WS_CLIPSIBLINGS | WS_SYSMENU | WS_MINIMIZEBOX,5,5,640,480,
NULL,NULL,GetModuleHandle(NULL),this );
m_Created = m_hMainWindow != NULL;
@ -862,6 +862,20 @@ DWORD CALLBACK CMainGui::MainGui_Proc (HWND hWnd, DWORD uMsg, DWORD wParam, DWOR
}
}
break;
case WM_DROPFILES:
{
//We need to stop the filename from the file dropped
char filename[200];
//Set HRDOP to the paramater that we have recieved
HDROP hDrop = (HDROP)wParam;
//Queery the file so we can get the filename
DragQueryFile(hDrop, 0, filename, sizeof(filename));
//Now we have queried, lets tell windows to release the memory.
DragFinish(hDrop);
//Now the important part, run said image.
CN64System::RunFileImage(filename);
}
break;
case WM_DESTROY:
WriteTrace(TraceDebug,__FUNCTION__ ": WM_DESTROY - start");
{