diff --git a/build/dxwnd.dll b/build/dxwnd.dll
index f16fa96..51a40a3 100644
--- a/build/dxwnd.dll
+++ b/build/dxwnd.dll
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:49d7c2658bf62db9650233f60f2cf5dd82912f2a522c26d4c115891440ccabd9
-size 659968
+oid sha256:7fd28d3540f74ceab1034bff9cd6fd4059e759568c2c207393d61fe20f0367da
+size 660480
diff --git a/build/dxwnd.exe b/build/dxwnd.exe
index 275e23a..5b71e95 100644
--- a/build/dxwnd.exe
+++ b/build/dxwnd.exe
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:c966fe71e5250ed781b9e1415ce53fec601a93c4384893a2afb78bab76d75e56
-size 640512
+oid sha256:b4833fd88b00f606494df68b4af21d27e5f419a90686cb407e0539166dea762e
+size 642560
diff --git a/build/readme-relnotes.txt b/build/readme-relnotes.txt
index 91bdde8..a2a517c 100644
--- a/build/readme-relnotes.txt
+++ b/build/readme-relnotes.txt
@@ -1146,4 +1146,13 @@ add: revised log configuration, added "Separate" mode to make each process to wr
v2.03.74
fix: logging of dwFOURCC field text value
fix: Injection routine: avoid closing a few handles that should not be closed, simplified logic.
-add: GUI global configuration panel
\ No newline at end of file
+add: GUI global configuration panel
+
+v2.03.75
+fix: handling of restore previous screen mode when a primary fullscreen window is terminated. Fixes "Dethkarz" initialization error after 8BPP intro movie termination.
+fix: SystemParameterInfo for SPI_SETSCREENSAVERRUNNING does not return an error
+fix: added default pixel format specification to backbuffer: improves the possibility of ZBUFFER attach
+fix: recovery of DDERR_SURFACELOST error on primary surface in PrimaryStretchBlt routine.
+fix: possible palette handle leakage
+fix: DC leakage caused by CreateCompatibleDC. Fix "Mechwarrior 3" repeated play sessions.
+add: GUI drag & drop of game executables
\ No newline at end of file
diff --git a/dll/ddraw.cpp b/dll/ddraw.cpp
index 0cd05af..98909f8 100644
--- a/dll/ddraw.cpp
+++ b/dll/ddraw.cpp
@@ -2659,6 +2659,10 @@ static HRESULT BuildBackBufferEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateS
ddsd.dwFlags &= ~(DDSD_BACKBUFFERCOUNT|DDSD_REFRESHRATE);
ddsd.dwFlags |= (DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH|DDSD_PIXELFORMAT);
ddsd.ddsCaps.dwCaps &= ~(DDSCAPS_BACKBUFFER|DDSCAPS_PRIMARYSURFACE|DDSCAPS_FLIP|DDSCAPS_COMPLEX|DDSCAPS_VIDEOMEMORY|DDSCAPS_LOCALVIDMEM);
+
+ // v2.03.75: if a surface desc is NOT specified, build one. This will allow ZBUF attach.
+ if(!(lpddsd->dwFlags & DDSD_PIXELFORMAT)) SetPixFmt((LPDDSURFACEDESC2)&ddsd);
+
// DDSCAPS_OFFSCREENPLAIN seems required to support the palette in memory surfaces
ddsd.ddsCaps.dwCaps |= (DDSCAPS_SYSTEMMEMORY|DDSCAPS_OFFSCREENPLAIN);
if(ddsd.ddsCaps.dwCaps & DDSCAPS_3DDEVICE) ddsd.ddsCaps.dwCaps &= ~DDSCAPS_SYSTEMMEMORY; // necessary: Martian Gotic crashes otherwise
@@ -3426,14 +3430,27 @@ HRESULT WINAPI PrimaryStretchBlt(int dxversion, Blt_Type pBlt, LPDIRECTDRAWSURFA
OutTraceE("PrimaryStretchBlt: Blt ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
}
else {
- // fast-blit to primary
- if(dxw.dwFlags3 & FORCECLIPPER){
- res= (*pBlt)(lpdds, lpdestrect, lpddsTmp, &TmpRect, DDBLT_WAIT, 0);
- if(res) OutTraceE("PrimaryStretchBlt: Blt ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
- }
- else{
- res= (*pBltFast)(lpdds, lpdestrect->left, lpdestrect->top, lpddsTmp, &TmpRect, DDBLTFAST_WAIT);
- if(res) OutTraceE("PrimaryStretchBlt: BltFast ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
+ while(TRUE) {
+ // fast-blit to primary
+ if(dxw.dwFlags3 & FORCECLIPPER){
+ res= (*pBlt)(lpdds, lpdestrect, lpddsTmp, &TmpRect, DDBLT_WAIT, 0);
+ if(res) OutTraceE("PrimaryStretchBlt: Blt ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
+ }
+ else{
+ res= (*pBltFast)(lpdds, lpdestrect->left, lpdestrect->top, lpddsTmp, &TmpRect, DDBLTFAST_WAIT);
+ if(res) OutTraceE("PrimaryStretchBlt: BltFast ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
+ }
+ if(res == DDERR_SURFACELOST){
+ res = lpdds->Restore();
+ if(res) {
+ OutTraceE("PrimaryStretchBlt: Restore ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
+ }
+ else {
+ OutTraceDW("PrimaryStretchBlt: surface sucessfully recovered, retry\n");
+ continue;
+ }
+ }
+ break;
}
}
(*pReleaseSMethod(dxversion))(lpddsTmp);
@@ -5522,8 +5539,16 @@ HRESULT WINAPI extReleaseP(LPDIRECTDRAWPALETTE lpddPalette)
OutTraceDDRAW("Release(P): lpddPalette=%x ref=%x\n", lpddPalette, ref);
if (lpddPalette == lpDDP) {
- OutTraceDW("Release(P): lpDDP extrarefcount=%d\n", iDDPExtraRefCounter);
- ref -= iDDPExtraRefCounter;
+ if(dxw.dwFlags4 & FIXREFCOUNTER) {
+ OutTraceDW("Release(P): lpDDP extrarefcount=%d\n", iDDPExtraRefCounter);
+ if((ULONG)iDDPExtraRefCounter >= ref){
+ while(ref) ref = (*pReleaseP)(lpddPalette);
+ lpDDP=NULL;
+ iDDPExtraRefCounter = 0;
+ return 0;
+ }
+ ref -= iDDPExtraRefCounter;
+ }
if (ref <= 0) {
ref = 0;
OutTraceDW("Release(P): clearing lpDDP=%x->NULL\n", lpDDP);
diff --git a/dll/dxwnd.cpp b/dll/dxwnd.cpp
index d8d9631..ace19f4 100644
--- a/dll/dxwnd.cpp
+++ b/dll/dxwnd.cpp
@@ -27,7 +27,7 @@ along with this program. If not, see .
#include "TlHelp32.h"
-#define VERSION "2.03.74"
+#define VERSION "2.03.75"
#define DDTHREADLOCK 1
//#define LOCKTHREADS
diff --git a/dll/dxwnd.vs2008.suo b/dll/dxwnd.vs2008.suo
index b035987..fe92775 100644
Binary files a/dll/dxwnd.vs2008.suo and b/dll/dxwnd.vs2008.suo differ
diff --git a/dll/gdi32.cpp b/dll/gdi32.cpp
index 7362d22..7867f9a 100644
--- a/dll/gdi32.cpp
+++ b/dll/gdi32.cpp
@@ -921,12 +921,15 @@ HDC WINAPI extCreateICA(LPCTSTR lpszDriver, LPCTSTR lpszDevice, LPCTSTR lpszOutp
HDC WINAPI extGDICreateCompatibleDC(HDC hdc)
{
+ // v2.03.75: fixed dc leakage that crashed "Mechwarrior 3"
HDC RetHdc;
DWORD LastError;
+ BOOL bSwitchedToMainWin = FALSE;
OutTraceDW("GDI.CreateCompatibleDC: hdc=%x\n", hdc);
if(hdc==0){
hdc=(*pGDIGetDC)(dxw.GethWnd());
+ bSwitchedToMainWin = TRUE;
if(dxw.dwFlags6 & CREATEDESKTOP){
extern HWND hDesktopWindow;
hdc=(*pGDIGetDC)(hDesktopWindow);
@@ -937,6 +940,7 @@ HDC WINAPI extGDICreateCompatibleDC(HDC hdc)
// eliminated error message for errorcode 0.
SetLastError(0);
RetHdc=(*pGDICreateCompatibleDC)(hdc);
+ if(bSwitchedToMainWin) (*pGDIReleaseDC)(dxw.GethWnd(),hdc);
LastError=GetLastError();
if(LastError == 0){
OutTraceDW("GDI.CreateCompatibleDC: returning HDC=%x\n", RetHdc);
diff --git a/dll/user32.cpp b/dll/user32.cpp
index e2d3ff6..2e34e3d 100644
--- a/dll/user32.cpp
+++ b/dll/user32.cpp
@@ -108,6 +108,9 @@ BOOL WINAPI extDrawMenuBar(HWND);
//typedef BOOL (WINAPI *TranslateMessage_Type)(MSG *);
//TranslateMessage_Type pTranslateMessage = NULL;
//BOOL WINAPI extTranslateMessage(MSG *);
+typedef BOOL (WINAPI *EnumDisplayDevicesA_Type)(LPCSTR, DWORD, PDISPLAY_DEVICE, DWORD);
+EnumDisplayDevicesA_Type pEnumDisplayDevicesA = NULL;
+BOOL WINAPI extEnumDisplayDevicesA(LPCSTR, DWORD, PDISPLAY_DEVICE, DWORD);
#ifdef TRACEPALETTE
@@ -200,6 +203,8 @@ static HookEntryEx_Type Hooks[]={
{HOOK_HOT_CANDIDATE, 0, "ShowScrollBar", (FARPROC)ShowScrollBar, (FARPROC *)&pShowScrollBar, (FARPROC)extShowScrollBar},
{HOOK_HOT_CANDIDATE, 0, "DrawMenuBar", (FARPROC)DrawMenuBar, (FARPROC *)&pDrawMenuBar, (FARPROC)extDrawMenuBar},
+ //{HOOK_HOT_CANDIDATE, 0, "EnumDisplayDevicesA", (FARPROC)EnumDisplayDevicesA, (FARPROC *)&pEnumDisplayDevicesA, (FARPROC)extEnumDisplayDevicesA},
+
{HOOK_IAT_CANDIDATE, 0, 0, NULL, 0, 0} // terminator
};
@@ -1466,6 +1471,9 @@ static BOOL IsFullscreenWindow(
return FALSE;
}
+static HWND hLastFullScrWin = 0;
+static DDPIXELFORMAT ddpLastPixelFormat;
+
static HWND WINAPI extCreateWindowCommon(
LPCTSTR ApiName,
BOOL WideChar,
@@ -1529,6 +1537,12 @@ static HWND WINAPI extCreateWindowCommon(
RECT screen;
POINT upleft = {0,0};
+ // if already in fullscreen mode, save previous settings
+ if(dxw.IsFullScreen() && dxw.GethWnd()){
+ hLastFullScrWin = dxw.GethWnd();
+ ddpLastPixelFormat = dxw.VirtualPixelFormat;
+ }
+
// update virtual screen size if it has grown
// v2.03.58 fix: do't consider CW_USEDEFAULT ad a big unsigned integer!! Fixes "Imperialism".
if((nWidth != CW_USEDEFAULT) && (nHeight != CW_USEDEFAULT)) dxw.SetScreenSize(nWidth, nHeight);
@@ -2648,12 +2662,25 @@ BOOL WINAPI extDestroyWindow(HWND hWnd)
OutTraceB("DestroyWindow: hwnd=%x\n", hWnd);
if (hWnd == dxw.GethWnd()) {
+ OutTraceDW("DestroyWindow: destroy main hwnd=%x\n", hWnd);
+ if(hLastFullScrWin){
+ OutTraceDW("DestroyWindow: revert to main hwnd=%x bpp=%d\n",
+ hWnd, ddpLastPixelFormat.dwRGBBitCount);
+ dxw.SethWnd(hLastFullScrWin);
+ hLastFullScrWin = NULL;
+ dxw.VirtualPixelFormat = ddpLastPixelFormat;
+ extern int iBakBufferVersion;
+ SetBltTransformations(iBakBufferVersion);
+ }
+ else {
+ OutTraceDW("DestroyWindow: destroy main hwnd=%x\n", hWnd);
+ dxw.SethWnd(NULL);
+ }
+
if(dxw.dwFlags6 & NODESTROYWINDOW) {
OutTraceDW("DestroyWindow: do NOT destroy main hwnd=%x\n", hWnd);
return TRUE;
}
- OutTraceDW("DestroyWindow: destroy main hwnd=%x\n", hWnd);
- dxw.SethWnd(NULL);
}
if (hControlParentWnd && (hWnd == hControlParentWnd)) {
OutTraceDW("DestroyWindow: destroy control parent hwnd=%x\n", hWnd);
@@ -3049,6 +3076,7 @@ BOOL WINAPI extSystemParametersInfoA(UINT uiAction, UINT uiParam, PVOID pvParam,
switch(uiAction){
case SPI_SETKEYBOARDDELAY:
case SPI_SETKEYBOARDSPEED:
+ case SPI_SETSCREENSAVERRUNNING: // v2.03.75 used by Dethkarz, but not really necessary
OutTraceDW("SystemParametersInfoA: bypass action=%x\n", uiAction);
return TRUE;
break;
@@ -3722,4 +3750,22 @@ BOOL WINAPI extTranslateMessage(MSG *pMsg)
ret=(*pTranslateMessage)(pMsg);
return ret;
}
-#endif
\ No newline at end of file
+#endif
+
+BOOL WINAPI extEnumDisplayDevicesA(LPCSTR lpDevice, DWORD iDevNum, PDISPLAY_DEVICE lpDisplayDevice, DWORD dwFlags)
+{
+ BOOL ret;
+ MessageBox(0, "EnumDisplayDevicesA", "dxwnd", 0);
+ OutTrace("EnumDisplayDevices: device=%s devnum=%i flags=%x\n", lpDevice, iDevNum, dwFlags);
+
+ ret = (*pEnumDisplayDevicesA)(lpDevice, iDevNum, lpDisplayDevice, dwFlags);
+
+ if(ret){
+ OutTrace("EnumDisplayDevices: cb=%x devname=%s devstring=%s stateflags=%x\n",
+ lpDisplayDevice->cb, lpDisplayDevice->DeviceName, lpDisplayDevice->DeviceString, lpDisplayDevice->StateFlags);
+ }
+ else{
+ OutTraceE("EnumDisplayDevices ERROR: err=%d\n", GetLastError());
+ }
+ return ret;
+}
diff --git a/host/CDragEdit.cpp b/host/CDragEdit.cpp
new file mode 100644
index 0000000..63953c4
--- /dev/null
+++ b/host/CDragEdit.cpp
@@ -0,0 +1,35 @@
+#include "stdafx.h"
+#include "CDragEdit.h"
+
+CDragEdit::CDragEdit()
+{
+}
+
+CDragEdit::~CDragEdit()
+{
+}
+
+BOOL CDragEdit::OnInitDialog()
+{
+ DragAcceptFiles();
+ return TRUE;
+}
+
+void CDragEdit::OnDropFiles(HDROP dropInfo)
+{
+ CString sFile;
+ DWORD nBuffer = 0;
+ // Get number of files
+ UINT nFilesDropped = DragQueryFile(dropInfo, 0xFFFFFFFF, NULL, 0);
+ if(nFilesDropped > 0){
+ nBuffer = DragQueryFile(dropInfo, 0, NULL, 0);
+ DragQueryFile(dropInfo, 0, sFile.GetBuffer(nBuffer+1), nBuffer+1);
+ SetWindowTextA(sFile.GetBuffer());
+ sFile.ReleaseBuffer();
+ }
+ DragFinish(dropInfo);
+}
+
+BEGIN_MESSAGE_MAP(CDragEdit, CEdit)
+ ON_WM_DROPFILES()
+END_MESSAGE_MAP()
diff --git a/host/CDragEdit.h b/host/CDragEdit.h
new file mode 100644
index 0000000..9d7aee3
--- /dev/null
+++ b/host/CDragEdit.h
@@ -0,0 +1,13 @@
+// CDragEdit class: inherited by DEdit, adds drag & drop of file pathnames
+// within the text field.
+
+class CDragEdit : public CEdit
+{
+public:
+ CDragEdit();
+ virtual ~CDragEdit();
+ BOOL OnInitDialog();
+private:
+ afx_msg void OnDropFiles(HDROP hDropInfo);
+ DECLARE_MESSAGE_MAP()
+};
diff --git a/host/TabProgram.cpp b/host/TabProgram.cpp
index 0cce3dd..8582597 100644
--- a/host/TabProgram.cpp
+++ b/host/TabProgram.cpp
@@ -66,9 +66,10 @@ void CTabProgram::DoDataExchange(CDataExchange* pDX)
BEGIN_MESSAGE_MAP(CTabProgram, CDialog)
//{{AFX_MSG_MAP(CTabProgram)
- // NOTE: the ClassWizard will add message map macros here
+ // NOTE: the ClassWizard will add message map macros here
ON_BN_CLICKED(IDC_OPEN, OnOpen)
ON_BN_CLICKED(IDC_OPENLAUNCH, OnOpenLaunch)
+ ON_WM_DROPFILES()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
@@ -150,6 +151,25 @@ void CTabProgram::OnOpenLaunch()
}
}
+void CTabProgram::OnDropFiles(HDROP dropInfo)
+{
+ CString sFile;
+ DWORD nBuffer = 0;
+ // Get number of files
+ UINT nFilesDropped = DragQueryFile(dropInfo, 0xFFFFFFFF, NULL, 0);
+ if(nFilesDropped > 0){
+ nBuffer = DragQueryFile(dropInfo, 0, NULL, 0);
+ DragQueryFile(dropInfo, 0, sFile.GetBuffer(nBuffer+1), nBuffer+1);
+ //CTargetDlg *pDlg = (CTargetDlg *)this->GetParent()->GetParent();
+ //pDlg->m_FilePath = sFile;
+ CDragEdit *pEditFile = (CDragEdit *)this->GetDlgItem(IDC_FILE);
+ pEditFile->SetWindowTextA(sFile.GetBuffer());
+ //MessageBox(sFile.GetBuffer(), "debug", 0);
+ sFile.ReleaseBuffer();
+ }
+ DragFinish(dropInfo);
+}
+
BOOL CTabProgram::OnInitDialog()
{
HINSTANCE Hinst;
@@ -157,6 +177,17 @@ BOOL CTabProgram::OnInitDialog()
CStatic *IconBox;
IFormat *m_pRelIntegerFormat = new(RelIntegerFormat);
+ //ChangeWindowMessageFilter(WM_DROPFILES, MSGFLT_ADD);
+ //ChangeWindowMessageFilter(WM_COPYDATA, MSGFLT_ADD);
+ //ChangeWindowMessageFilter(0x0049, MSGFLT_ADD);
+ DragAcceptFiles();
+ CDragEdit *pEditFile;
+ pEditFile = (CDragEdit *)this->GetDlgItem(IDC_FILE);
+ pEditFile->DragAcceptFiles();
+ pEditFile = (CDragEdit *)this->GetDlgItem(IDC_LAUNCH);
+ pEditFile->DragAcceptFiles();
+ //m_File.DragAcceptFiles();
+ //m_Launch.DragAcceptFiles();
CDialog::OnInitDialog();
CTargetDlg *cTarget = ((CTargetDlg *)(this->GetParent()->GetParent()));
Hinst = ::LoadLibrary(cTarget->m_FilePath);
diff --git a/host/TabProgram.h b/host/TabProgram.h
index efcedb3..d5779b0 100644
--- a/host/TabProgram.h
+++ b/host/TabProgram.h
@@ -45,6 +45,7 @@ public:
protected:
CSpecialEdit m_EditPosX;
CSpecialEdit m_EditPosY;
+ afx_msg void OnDropFiles(HDROP hDropInfo);
};
//{{AFX_INSERT_LOCATION}}
diff --git a/host/TargetDlg.h b/host/TargetDlg.h
index 5903984..bbed84e 100644
--- a/host/TargetDlg.h
+++ b/host/TargetDlg.h
@@ -8,6 +8,7 @@
//
#include "dxTabCtrl.h"
#include "SpecialEdit.h"
+#include "CDragEdit.h"
/////////////////////////////////////////////////////////////////////////////
// CTargetDlg Dialog
@@ -23,8 +24,8 @@ public:
//{{AFX_DATA(CTargetDlg)
enum { IDD = IDD_TARGET };
CDXTabCtrl m_tabdxTabCtrl;
- CEdit m_File;
- CEdit m_Launch;
+ CDragEdit m_File;
+ CDragEdit m_Launch;
int m_DXVersion;
int m_Coordinates;
int m_InitColorDepth;
diff --git a/host/dxwndhost.rc b/host/dxwndhost.rc
index df676ff..f41a4d9 100644
Binary files a/host/dxwndhost.rc and b/host/dxwndhost.rc differ
diff --git a/host/dxwndhost.vs2008.suo b/host/dxwndhost.vs2008.suo
index fa826d6..88714c8 100644
Binary files a/host/dxwndhost.vs2008.suo and b/host/dxwndhost.vs2008.suo differ
diff --git a/host/dxwndhost.vs2008.vcproj b/host/dxwndhost.vs2008.vcproj
index c567b8d..929cf57 100644
--- a/host/dxwndhost.vs2008.vcproj
+++ b/host/dxwndhost.vs2008.vcproj
@@ -221,6 +221,10 @@
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
+
+
@@ -508,6 +512,10 @@
RelativePath=".\cdib.h"
>
+
+
@@ -714,22 +722,22 @@
>
-
-
+
+
diff --git a/host/dxwndhostView.cpp b/host/dxwndhostView.cpp
index 4a3299f..801ba76 100644
--- a/host/dxwndhostView.cpp
+++ b/host/dxwndhostView.cpp
@@ -153,6 +153,7 @@ BEGIN_MESSAGE_MAP(CDxwndhostView, CListView)
ON_COMMAND(ID_MOVE_BOTTOM, OnMoveBottom)
ON_WM_RBUTTONDOWN()
ON_WM_HOTKEY()
+ ON_WM_DROPFILES()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
@@ -1154,6 +1155,11 @@ void CDxwndhostView::OnInitialUpdate()
LV_ITEM listitem;
int i;
+ DragAcceptFiles();
+ ChangeWindowMessageFilter(WM_DROPFILES, MSGFLT_ADD);
+ ChangeWindowMessageFilter(WM_COPYDATA, MSGFLT_ADD);
+ ChangeWindowMessageFilter(0x0049, MSGFLT_ADD);
+
// Create 256 color image lists
HIMAGELIST hList = ImageList_Create(32,32, ILC_COLOR8 |ILC_MASK , 4, 1);
m_cImageListNormal.Attach(hList);
@@ -1295,6 +1301,27 @@ void CDxwndhostView::OnExport()
}
}
+void CDxwndhostView::OnImport(CString sFilePath)
+{
+ LV_ITEM listitem;
+ int i;
+ for (i=0; strlen(TargetMaps[i].path) && iInitDevMode);
}
-void CDxwndhostView::OnAdd()
+void CDxwndhostView::OnAdd()
+{
+ OnAdd(NULL);
+}
+
+void CDxwndhostView::OnAdd(char *sInitialPath)
{
// TODO: Please add a command handler code here.
int i;
@@ -1815,6 +1847,8 @@ void CDxwndhostView::OnAdd()
return;
}
memset(&TargetMaps[i],0,sizeof(TARGETMAP)); // clean up, just in case....
+ if(sInitialPath) dlg.m_FilePath = CString(sInitialPath);
+
if(dlg.DoModal() == IDOK && dlg.m_FilePath.GetLength()){
strnncpy(PrivateMaps[i].title, (char *)dlg.m_Title.GetString(), MAX_TITLE);
PrivateMaps[i].notes = (char *)malloc(strlen(dlg.m_Notes.GetString())+1);
@@ -2759,3 +2793,27 @@ void CDxwndhostView::OnClearCompatibilityFlags()
RegCloseKey(hk);
}
}
+
+void CDxwndhostView::OnDropFiles(HDROP dropInfo)
+{
+ CString sFile;
+ DWORD nBuffer = 0;
+ char *p;
+ // Get number of files
+ UINT nFilesDropped = DragQueryFile(dropInfo, 0xFFFFFFFF, NULL, 0);
+ if(nFilesDropped > 0){
+ nBuffer = DragQueryFile(dropInfo, 0, NULL, 0);
+ DragQueryFile(dropInfo, 0, sFile.GetBuffer(nBuffer+1), nBuffer+1);
+ p = (char *)sFile.GetString();
+ p += (strlen(p)-4);
+ if(!_strnicmp(p, ".dxw", 4)){
+ this->OnImport(sFile);
+ }
+ else {
+ this->OnAdd(sFile.GetBuffer());
+ }
+ sFile.ReleaseBuffer();
+ }
+ DragFinish(dropInfo);
+}
+
diff --git a/host/dxwndhostView.h b/host/dxwndhostView.h
index 835cbd0..e1654cb 100644
--- a/host/dxwndhostView.h
+++ b/host/dxwndhostView.h
@@ -19,6 +19,7 @@ protected: // Create from serialization only features.
DECLARE_DYNCREATE(CDxwndhostView)
BOOL isUpdated;
void SaveConfigFile();
+ BOOL OnInitDialog();
private:
void Resize(void);
@@ -62,10 +63,12 @@ protected:
//{{AFX_MSG(CDxwndhostView)
afx_msg void OnDblclk(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnAdd();
+ afx_msg void OnAdd(char *);
afx_msg void OnDuplicate();
afx_msg void OnModify();
afx_msg void OnExport();
afx_msg void OnImport();
+ afx_msg void OnImport(CString);
afx_msg void OnDelete();
afx_msg void OnExplore();
afx_msg void OnKill();
@@ -109,6 +112,7 @@ protected:
afx_msg void OnMoveUp();
afx_msg void OnMoveDown();
afx_msg void OnMoveBottom();
+ afx_msg void OnDropFiles(HDROP hDropInfo);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};