source: dev/trunk/ab5.0/abdev/ab_common/src/Environment.cpp@ 763

Last change on this file since 763 was 763, checked in by イグトランス (egtra), 15 years ago

#228試行

File size: 1.8 KB
Line 
1#include "stdafx.h"
2#include <uxtheme.h>
3
4std::string ActiveBasic::Common::Environment::rootPath;
5bool ActiveBasic::Common::Environment::isRemoveExternal = false;
6
7using namespace ActiveBasic::Common;
8
9void Environment::SetAbdevRootPath( const std::string &rootPath )
10{
11 Environment::rootPath = Jenga::Common::Path::MakeFullPath( rootPath, Jenga::Common::Environment::GetAppDir() );
12}
13const std::string Environment::GetAbdevRootPath()
14{
15 if( rootPath.empty() )
16 {
17 SetAbdevRootPath( "" );
18 }
19 return rootPath;
20}
21
22const std::string Environment::GetUserAppDir()
23{
24 return Jenga::Common::Environment::GetUserAppDir() + "\\ActiveBasic";
25}
26
27const std::string Environment::GetCompilerExePath( Platform::EnumType platform )
28{
29 switch( platform )
30 {
31 case Platform::X86:
32 return rootPath + "\\bin\\x86\\abc.exe";
33 case Platform::X64:
34 return rootPath + "\\bin\\x64\\abc.exe";
35 }
36 throw;
37}
38
39BOOL EnableLFH(HANDLE hHeap)
40{
41 ULONG enableLFH = 2;
42 return HeapSetInformation(hHeap, HeapCompatibilityInformation, &enableLFH, sizeof enableLFH);
43}
44
45void* operator new( std::size_t n )
46{
47 if ( void* p = dlmalloc(n) ){
48 return p;
49 }
50 else{
51 throw std::bad_alloc();
52 }
53}
54
55void* operator new[]( std::size_t n )
56{
57 return ::operator new( n );
58}
59
60void operator delete( void* p )
61{
62 dlfree( p );
63}
64
65void operator delete[]( void* p )
66{
67 ::operator delete( p );
68}
69
70typedef HRESULT (WINAPI* PFN_EnableThemeDialogTexture)(HWND, DWORD);
71
72HMODULE hmodUxTheme = LoadLibrary("uxtheme");
73
74HRESULT ApplyDialogTexture( HWND hwnd )
75{
76 if( hmodUxTheme )
77 {
78 if( PFN_EnableThemeDialogTexture pfn = reinterpret_cast<PFN_EnableThemeDialogTexture>(
79 GetProcAddress(hmodUxTheme, "EnableThemeDialogTexture")) )
80 {
81 return pfn(hwnd, ETDT_ENABLETAB);
82 }
83 }
84 return E_NOTIMPL;
85}
Note: See TracBrowser for help on using the repository browser.