-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPvMessageBox.h
38 lines (29 loc) · 1010 Bytes
/
PvMessageBox.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// *****************************************************************************
//
// Copyright (c) 2010, Pleora Technologies Inc., All rights reserved.
//
// *****************************************************************************
#pragma once
inline CString PvTrimFilename( const PvString &aString )
{
CString lString = aString.GetUnicode();
int lIndex = lString.Find( _T( ".cpp:" ) );
if ( lIndex > 0 )
{
lIndex = lString.Find( _T( " " ) );
int lCount = lString.GetLength() - ( lIndex + 1 );
if ( ( lIndex > 0 ) && ( lCount > 0 ) )
{
return lString.Right( lCount );
}
}
return lString;
}
inline void PvMessageBox( CWnd *aWnd, PvResult &aResult )
{
CString lError;
lError.Format( _T( "%s\r\n\r\n%s\r\n" ),
aResult.GetCodeString().GetUnicode(),
(LPCTSTR)PvTrimFilename( aResult.GetDescription() ) );
::MessageBox( aWnd->GetSafeHwnd(), lError, _T( "Error" ), MB_ICONERROR | MB_OK );
}