mirror of
https://github.com/Open-Shell/Open-Shell-Menu.git
synced 2026-04-20 10:44:37 +10:00
Use C++17 by default
Plus C++ standard conformance fixes.
This commit is contained in:
@@ -16,7 +16,7 @@ bool CreateFakeFolder( const wchar_t *source, const wchar_t *fname )
|
||||
HRESULT hr=pLink.CoCreateInstance(CLSID_ShellLink);
|
||||
if (FAILED(hr)) return false;
|
||||
pLink->SetPath(source);
|
||||
CComQIPtr<IPersistFile> pFile=pLink;
|
||||
CComQIPtr<IPersistFile> pFile(pLink);
|
||||
if (!pFile) return false;
|
||||
hr=pFile->Save(path,TRUE);
|
||||
if (FAILED(hr)) return false;
|
||||
|
||||
@@ -344,7 +344,7 @@ LRESULT CLanguageSettingsDlg::OnInitDialog( UINT uMsg, WPARAM wParam, LPARAM lPa
|
||||
m_Tooltip.Create(TOOLTIPS_CLASS,m_hWnd,NULL,NULL,WS_POPUP|TTS_NOPREFIX);
|
||||
TOOLINFO tool={sizeof(tool),TTF_SUBCLASS|TTF_IDISHWND,m_hWnd,'CLSH'};
|
||||
tool.uId=(UINT_PTR)list.m_hWnd;
|
||||
tool.lpszText=L"";
|
||||
tool.lpszText=(LPWSTR)L"";
|
||||
m_Tooltip.SendMessage(TTM_ADDTOOL,0,(LPARAM)&tool);
|
||||
|
||||
return TRUE;
|
||||
@@ -378,7 +378,7 @@ LRESULT CLanguageSettingsDlg::OnCheckUpdates( WORD wNotifyCode, WORD wID, HWND h
|
||||
CWindow list=GetDlgItem(IDC_LISTLANGUAGE);
|
||||
for (int idx=0;idx<(int)m_LanguageIDs.size();idx++)
|
||||
{
|
||||
const wchar_t *name=idx>0?m_LanguageIDs[idx].name:L"";
|
||||
const wchar_t *name=idx>0?m_LanguageIDs[idx].name.GetString():L"";
|
||||
if (_wcsicmp(language,name)==0)
|
||||
{
|
||||
ListView_SetItemState(list,idx,LVIS_SELECTED|LVIS_FOCUSED,LVIS_SELECTED|LVIS_FOCUSED);
|
||||
@@ -403,7 +403,7 @@ LRESULT CLanguageSettingsDlg::OnSelChange( int idCtrl, LPNMHDR pnmh, BOOL& bHand
|
||||
int idx=ListView_GetNextItem(list,-1,LVNI_SELECTED);
|
||||
if (idx<0) return 0;
|
||||
|
||||
const wchar_t *name=idx>0?m_LanguageIDs[idx].name:L"";
|
||||
const wchar_t *name=idx>0?m_LanguageIDs[idx].name.GetString():L"";
|
||||
CSettingsLockWrite lock;
|
||||
CComVariant val(name);
|
||||
if (m_pSetting->value!=val)
|
||||
@@ -499,7 +499,7 @@ void CLanguageSettingsDlg::SetGroup( CSetting *pGroup )
|
||||
CWindow list=GetDlgItem(IDC_LISTLANGUAGE);
|
||||
for (int idx=0;idx<(int)m_LanguageIDs.size();idx++)
|
||||
{
|
||||
const wchar_t *name=idx>0?m_LanguageIDs[idx].name:L"";
|
||||
const wchar_t *name=idx>0?m_LanguageIDs[idx].name.GetString():L"";
|
||||
if (_wcsicmp(language,name)==0)
|
||||
{
|
||||
ListView_SetItemState(list,idx,LVIS_SELECTED|LVIS_FOCUSED,LVIS_SELECTED|LVIS_FOCUSED);
|
||||
|
||||
@@ -93,6 +93,8 @@
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
@@ -105,6 +107,8 @@
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
@@ -118,6 +122,8 @@
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
@@ -134,6 +140,8 @@
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -732,7 +732,7 @@ CString CSettingsManager::LoadSettingsXml( const wchar_t *fname )
|
||||
DWORD ver=0;
|
||||
{
|
||||
CComVariant value;
|
||||
CComQIPtr<IXMLDOMElement> element=node;
|
||||
CComQIPtr<IXMLDOMElement> element(node);
|
||||
if (!element || element->getAttribute(CComBSTR(L"component"),&value)!=S_OK || value.vt!=VT_BSTR)
|
||||
return CString(L"XML parsing error: The tag 'Settings' is missing the 'component' attribute.");
|
||||
if (_wcsicmp(value.bstrVal,m_CompName)!=0)
|
||||
@@ -797,7 +797,7 @@ CString CSettingsManager::LoadSettingsXml( const wchar_t *fname )
|
||||
}
|
||||
else
|
||||
{
|
||||
CComQIPtr<IXMLDOMElement> element=child;
|
||||
CComQIPtr<IXMLDOMElement> element(child);
|
||||
if (element)
|
||||
{
|
||||
CComVariant value;
|
||||
|
||||
@@ -1223,7 +1223,7 @@ bool BrowseLinkHelper( HWND parent, wchar_t *text )
|
||||
CComPtr<IFileOpenDialog> pDialog;
|
||||
if (FAILED(pDialog.CoCreateInstance(CLSID_FileOpenDialog,NULL,CLSCTX_INPROC_SERVER)))
|
||||
return false;
|
||||
CComQIPtr<IFileDialogCustomize> pCustomize=pDialog;
|
||||
CComQIPtr<IFileDialogCustomize> pCustomize(pDialog);
|
||||
if (!pCustomize)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -34,16 +34,16 @@ public:
|
||||
|
||||
void Create( HWND hWndParent, DLGTEMPLATE *pTemplate )
|
||||
{
|
||||
ATLASSUME(m_hWnd == NULL);
|
||||
if (!m_thunk.Init(NULL,NULL))
|
||||
ATLASSUME(this->m_hWnd == NULL);
|
||||
if (!this->m_thunk.Init(NULL,NULL))
|
||||
{
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
return;
|
||||
}
|
||||
|
||||
_AtlWinModule.AddCreateWndData(&m_thunk.cd,(CDialogImplBaseT<CWindow>*)this);
|
||||
_AtlWinModule.AddCreateWndData(&this->m_thunk.cd,(CDialogImplBaseT<CWindow>*)this);
|
||||
HWND hWnd=::CreateDialogIndirect(_AtlBaseModule.GetResourceInstance(),pTemplate,hWndParent,T::StartDialogProc);
|
||||
ATLASSUME(m_hWnd==hWnd);
|
||||
ATLASSUME(this->m_hWnd==hWnd);
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -110,13 +110,13 @@ protected:
|
||||
pThis->GetWindowRect(&rc);
|
||||
m_WindowSize.cx=rc.right-rc.left;
|
||||
m_WindowSize.cy=rc.bottom-rc.top;
|
||||
for (std::vector<Control>::iterator it=m_Controls.begin();it!=m_Controls.end();++it)
|
||||
for (auto& it : m_Controls)
|
||||
{
|
||||
it->hwnd=pThis->GetDlgItem(it->id);
|
||||
Assert(it->hwnd);
|
||||
if (!it->hwnd) continue;
|
||||
::GetWindowRect(it->hwnd,&it->rect0);
|
||||
::MapWindowPoints(NULL,m_hWnd,(POINT*)&it->rect0,2);
|
||||
it.hwnd=pThis->GetDlgItem(it.id);
|
||||
Assert(it.hwnd);
|
||||
if (!it.hwnd) continue;
|
||||
::GetWindowRect(it.hwnd,&it.rect0);
|
||||
::MapWindowPoints(NULL,this->m_hWnd,(POINT*)&it.rect0,2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,22 +129,22 @@ protected:
|
||||
int dy=rc.bottom-m_ClientSize.cy;
|
||||
int dx2=dx/2;
|
||||
int dy2=dy/2;
|
||||
for (std::vector<Control>::iterator it=m_Controls.begin();it!=m_Controls.end();++it)
|
||||
for (const auto& it : m_Controls)
|
||||
{
|
||||
if (!it->hwnd) continue;
|
||||
int x1=it->rect0.left;
|
||||
int y1=it->rect0.top;
|
||||
int x2=it->rect0.right;
|
||||
int y2=it->rect0.bottom;
|
||||
if (it->flags&MOVE_LEFT) x1+=dx;
|
||||
else if (it->flags&MOVE_LEFT2) x1+=dx2;
|
||||
if (it->flags&MOVE_TOP) y1+=dy;
|
||||
else if (it->flags&MOVE_TOP2) y1+=dy2;
|
||||
if (it->flags&MOVE_RIGHT) x2+=dx;
|
||||
else if (it->flags&MOVE_RIGHT2) x2+=dx2;
|
||||
if (it->flags&MOVE_BOTTOM) y2+=dy;
|
||||
else if (it->flags&MOVE_BOTTOM2) y2+=dy2;
|
||||
::SetWindowPos(it->hwnd,NULL,x1,y1,x2-x1,y2-y1,SWP_NOZORDER|SWP_NOCOPYBITS);
|
||||
if (!it.hwnd) continue;
|
||||
int x1=it.rect0.left;
|
||||
int y1=it.rect0.top;
|
||||
int x2=it.rect0.right;
|
||||
int y2=it.rect0.bottom;
|
||||
if (it.flags&MOVE_LEFT) x1+=dx;
|
||||
else if (it.flags&MOVE_LEFT2) x1+=dx2;
|
||||
if (it.flags&MOVE_TOP) y1+=dy;
|
||||
else if (it.flags&MOVE_TOP2) y1+=dy2;
|
||||
if (it.flags&MOVE_RIGHT) x2+=dx;
|
||||
else if (it.flags&MOVE_RIGHT2) x2+=dx2;
|
||||
if (it.flags&MOVE_BOTTOM) y2+=dy;
|
||||
else if (it.flags&MOVE_BOTTOM2) y2+=dy2;
|
||||
::SetWindowPos(it.hwnd,NULL,x1,y1,x2-x1,y2-y1,SWP_NOZORDER|SWP_NOCOPYBITS);
|
||||
}
|
||||
if (m_Gripper.m_hWnd)
|
||||
{
|
||||
@@ -170,7 +170,7 @@ protected:
|
||||
|
||||
void GetStoreRect( RECT &rc )
|
||||
{
|
||||
GetWindowRect(&rc);
|
||||
this->GetWindowRect(&rc);
|
||||
rc.right-=rc.left+m_WindowSize.cx;
|
||||
rc.bottom-=rc.top+m_WindowSize.cy;
|
||||
}
|
||||
@@ -178,7 +178,7 @@ protected:
|
||||
void GetPlacementRect( RECT &rc )
|
||||
{
|
||||
WINDOWPLACEMENT placement;
|
||||
GetWindowPlacement(&placement);
|
||||
this->GetWindowPlacement(&placement);
|
||||
rc=placement.rcNormalPosition;
|
||||
rc.right-=rc.left+m_WindowSize.cx;
|
||||
rc.bottom-=rc.top+m_WindowSize.cy;
|
||||
@@ -186,8 +186,8 @@ protected:
|
||||
|
||||
void SetStoreRect( const RECT &rc )
|
||||
{
|
||||
SetWindowPos(NULL,rc.left,rc.top,m_WindowSize.cx+rc.right,m_WindowSize.cy+rc.bottom,SWP_NOZORDER|SWP_NOCOPYBITS);
|
||||
SendMessage(DM_REPOSITION);
|
||||
this->SetWindowPos(NULL,rc.left,rc.top,m_WindowSize.cx+rc.right,m_WindowSize.cy+rc.bottom,SWP_NOZORDER|SWP_NOCOPYBITS);
|
||||
this->SendMessage(DM_REPOSITION);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -19,5 +19,5 @@ public:
|
||||
private:
|
||||
HINSTANCE m_hInstance;
|
||||
|
||||
static BOOL CALLBACK CStringSet::EnumResNameProc( HMODULE hModule, LPCTSTR lpszType, LPTSTR lpszName, LONG_PTR lParam );
|
||||
static BOOL CALLBACK EnumResNameProc( HMODULE hModule, LPCTSTR lpszType, LPTSTR lpszName, LONG_PTR lParam );
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user