1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

added a flag that can be used to avoid building in win98 compatibility support if it's not needed.

This commit is contained in:
jules 2007-06-27 21:49:19 +00:00
parent 4efaaf65ee
commit b3bf45208d
9 changed files with 495 additions and 86 deletions

View file

@ -137,8 +137,6 @@ DECLARE_INTERFACE_(IDirectSoundCaptureBuffer, IUnknown)
};
#define USE_UNICODE_FUNCTIONS 1
//==============================================================================
BEGIN_JUCE_NAMESPACE
@ -255,9 +253,12 @@ typedef BOOL (CALLBACK *LPDSENUMCALLBACKA) (LPGUID, LPCSTR, LPCSTR, LPVOID);
DSOUND_FUNCTION (DirectSoundCreate, (const GUID*, IDirectSound**, LPUNKNOWN))
DSOUND_FUNCTION (DirectSoundCaptureCreate, (const GUID*, IDirectSoundCapture**, LPUNKNOWN))
DSOUND_FUNCTION (DirectSoundEnumerateW, (LPDSENUMCALLBACKW, LPVOID))
DSOUND_FUNCTION (DirectSoundEnumerateA, (LPDSENUMCALLBACKA, LPVOID))
DSOUND_FUNCTION (DirectSoundCaptureEnumerateW, (LPDSENUMCALLBACKW, LPVOID))
DSOUND_FUNCTION (DirectSoundCaptureEnumerateA, (LPDSENUMCALLBACKA, LPVOID))
#if JUCE_ENABLE_WIN98_COMPATIBILITY
DSOUND_FUNCTION (DirectSoundEnumerateA, (LPDSENUMCALLBACKA, LPVOID))
DSOUND_FUNCTION (DirectSoundCaptureEnumerateA, (LPDSENUMCALLBACKA, LPVOID))
#endif
static void initialiseDSoundFunctions()
{
@ -269,8 +270,11 @@ static void initialiseDSoundFunctions()
DSOUND_FUNCTION_LOAD (DirectSoundCaptureCreate)
DSOUND_FUNCTION_LOAD (DirectSoundEnumerateW)
DSOUND_FUNCTION_LOAD (DirectSoundCaptureEnumerateW)
#if JUCE_ENABLE_WIN98_COMPATIBILITY
DSOUND_FUNCTION_LOAD (DirectSoundEnumerateA)
DSOUND_FUNCTION_LOAD (DirectSoundCaptureEnumerateA)
#endif
}
}
@ -1445,11 +1449,13 @@ public:
dsDirectSoundEnumerateW (outputEnumProcW, this);
dsDirectSoundCaptureEnumerateW (inputEnumProcW, this);
}
#if JUCE_ENABLE_WIN98_COMPATIBILITY
else if (dsDirectSoundEnumerateA != 0)
{
dsDirectSoundEnumerateA (outputEnumProcA, this);
dsDirectSoundCaptureEnumerateA (inputEnumProcA, this);
}
#endif
}
const StringArray getDeviceNames (const bool preferInputNames) const

View file

@ -50,28 +50,30 @@ BEGIN_JUCE_NAMESPACE
#endif
//==============================================================================
UNICODE_FUNCTION (SHBrowseForFolderW, LPITEMIDLIST, (LPBROWSEINFOW))
UNICODE_FUNCTION (SHGetPathFromIDListW, BOOL, (LPCITEMIDLIST, LPWSTR))
UNICODE_FUNCTION (GetSaveFileNameW, BOOL, (LPOPENFILENAMEW))
UNICODE_FUNCTION (GetOpenFileNameW, BOOL, (LPOPENFILENAMEW))
#if JUCE_ENABLE_WIN98_COMPATIBILITY
UNICODE_FUNCTION (SHBrowseForFolderW, LPITEMIDLIST, (LPBROWSEINFOW))
UNICODE_FUNCTION (SHGetPathFromIDListW, BOOL, (LPCITEMIDLIST, LPWSTR))
UNICODE_FUNCTION (GetSaveFileNameW, BOOL, (LPOPENFILENAMEW))
UNICODE_FUNCTION (GetOpenFileNameW, BOOL, (LPOPENFILENAMEW))
static void juce_initialiseUnicodeFileBrowserFunctions()
{
static bool initialised = false;
if (! initialised)
static void juce_initialiseUnicodeFileBrowserFunctions()
{
initialised = true;
static bool initialised = false;
HMODULE h = LoadLibraryA ("shell32.dll");
UNICODE_FUNCTION_LOAD (SHBrowseForFolderW)
UNICODE_FUNCTION_LOAD (SHGetPathFromIDListW)
if (! initialised)
{
initialised = true;
h = LoadLibraryA ("comdlg32.dll");
UNICODE_FUNCTION_LOAD (GetSaveFileNameW)
UNICODE_FUNCTION_LOAD (GetOpenFileNameW)
HMODULE h = LoadLibraryA ("shell32.dll");
UNICODE_FUNCTION_LOAD (SHBrowseForFolderW)
UNICODE_FUNCTION_LOAD (SHGetPathFromIDListW)
h = LoadLibraryA ("comdlg32.dll");
UNICODE_FUNCTION_LOAD (GetSaveFileNameW)
UNICODE_FUNCTION_LOAD (GetOpenFileNameW)
}
}
}
#endif
//==============================================================================
@ -96,9 +98,13 @@ static int CALLBACK browseCallbackProc (HWND hWnd, UINT msg, LPARAM lParam, LPAR
{
if (msg == BFFM_INITIALIZED)
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
SendMessage (hWnd, (wSHBrowseForFolderW != 0) ? BFFM_SETSELECTIONW
: BFFM_SETSELECTIONA,
TRUE, (LPARAM) defaultDirPath);
#else
SendMessage (hWnd, BFFM_SETSELECTIONW, TRUE, (LPARAM) defaultDirPath);
#endif
}
else if (msg == BFFM_VALIDATEFAILEDW)
{
@ -156,12 +162,16 @@ static UINT_PTR CALLBACK openCallback (HWND hdlg, UINT uiMsg, WPARAM /*wParam*/,
path[0] = 0;
CommDlg_OpenSave_GetFilePath (GetParent (hdlg), (LPARAM) &path, MAX_PATH);
#if JUCE_ENABLE_WIN98_COMPATIBILITY
String fn;
if (wGetOpenFileNameW != 0)
fn = (const WCHAR*) path;
else
fn = path;
#else
const String fn ((const WCHAR*) path);
#endif
comp->selectedFileChanged (File (fn));
}
@ -206,7 +216,9 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results,
bool selectMultipleFiles,
FilePreviewComponent* extraInfoComponent)
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
juce_initialiseUnicodeFileBrowserFunctions();
#endif
const int numCharsAvailable = 32768;
MemoryBlock filenameSpace ((numCharsAvailable + 1) * sizeof (WCHAR), true);
@ -238,10 +250,14 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results,
}
else
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wSHBrowseForFolderW != 0)
currentFileOrDirectory.getFileName().copyToBuffer (fname, numCharsAvailable);
else
currentFileOrDirectory.getFileName().copyToBuffer ((char*) fname, numCharsAvailable);
#else
currentFileOrDirectory.getFileName().copyToBuffer (fname, numCharsAvailable);
#endif
initialDir = currentFileOrDirectory.getParentDirectory().getFullPathName();
}
@ -257,6 +273,7 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results,
LPITEMIDLIST list = 0;
filenameSpace.fillWith (0);
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wSHBrowseForFolderW != 0)
{
BROWSEINFOW bi;
@ -305,6 +322,31 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results,
returnedString = String::empty;
}
}
#else
{
BROWSEINFOW bi;
zerostruct (bi);
bi.hwndOwner = (HWND) w.getWindowHandle();
bi.pszDisplayName = fname;
bi.lpszTitle = title;
bi.lpfn = browseCallbackProc;
#ifdef BIF_USENEWUI
bi.ulFlags = BIF_USENEWUI | BIF_VALIDATE;
#else
bi.ulFlags = 0x50;
#endif
defaultDirPath = (const WCHAR*) initialDir;
list = SHBrowseForFolderW (&bi);
if (! SHGetPathFromIDListW (list, fname))
{
fname[0] = 0;
returnedString = String::empty;
}
}
#endif
LPMALLOC al;
if (list != 0 && SUCCEEDED (SHGetMalloc (&al)))
@ -314,12 +356,16 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results,
if (returnedString.isNotEmpty())
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
String stringFName;
if (wSHBrowseForFolderW != 0)
stringFName = fname;
else
stringFName = (char*) fname;
#else
const String stringFName (fname);
#endif
results.add (new File (File (stringFName).getSiblingFile (returnedString)));
returnedString = String::empty;
@ -350,6 +396,7 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results,
currentExtraFileWin->enterModalState();
}
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wGetSaveFileNameW != 0)
{
WCHAR filters [1024];
@ -436,6 +483,50 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results,
fnameIdx = of.nFileOffset;
}
}
#else
{
WCHAR filters [1024];
zeromem (filters, sizeof (filters));
filter.copyToBuffer (filters, 1024);
filter.copyToBuffer (filters + filter.length() + 1,
1022 - filter.length());
OPENFILENAMEW of;
zerostruct (of);
#ifdef OPENFILENAME_SIZE_VERSION_400W
of.lStructSize = OPENFILENAME_SIZE_VERSION_400W;
#else
of.lStructSize = sizeof (of);
#endif
of.hwndOwner = (HWND) w.getWindowHandle();
of.lpstrFilter = filters;
of.nFilterIndex = 1;
of.lpstrFile = fname;
of.nMaxFile = numCharsAvailable;
of.lpstrInitialDir = initialDir;
of.lpstrTitle = title;
of.Flags = flags;
if (extraInfoComponent != 0)
of.lpfnHook = &openCallback;
if (isSaveDialogue)
{
if (! GetSaveFileNameW (&of))
fname[0] = 0;
else
fnameIdx = of.nFileOffset;
}
else
{
if (! GetOpenFileNameW (&of))
fname[0] = 0;
else
fnameIdx = of.nFileOffset;
}
}
#endif
}
}
#if JUCE_CATCH_UNHANDLED_EXCEPTIONS
@ -447,8 +538,10 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results,
deleteAndZero (currentExtraFileWin);
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wGetSaveFileNameW != 0)
{
#endif
const WCHAR* const files = fname;
if (selectMultipleFiles && fnameIdx > 0 && files [fnameIdx - 1] == 0)
@ -466,6 +559,8 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results,
{
results.add (new File (files));
}
#if JUCE_ENABLE_WIN98_COMPATIBILITY
}
else
{
@ -487,6 +582,7 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results,
results.add (new File (files));
}
}
#endif
}
END_JUCE_NAMESPACE

View file

@ -61,6 +61,7 @@ const tchar File::separator = T('\\');
const tchar* File::separatorString = T("\\");
//==============================================================================
#if JUCE_ENABLE_WIN98_COMPATIBILITY
UNICODE_FUNCTION (GetFileAttributesW, DWORD, (LPCWSTR))
UNICODE_FUNCTION (SetFileAttributesW, BOOL, (LPCWSTR, DWORD))
UNICODE_FUNCTION (RemoveDirectoryW, BOOL, (LPCWSTR))
@ -104,7 +105,7 @@ void juce_initialiseUnicodeFileFunctions() throw()
UNICODE_FUNCTION_LOAD (SHGetSpecialFolderPathW)
}
}
#endif
//==============================================================================
bool juce_fileExists (const String& fileName,
@ -113,8 +114,12 @@ bool juce_fileExists (const String& fileName,
if (fileName.isEmpty())
return false;
#if JUCE_ENABLE_WIN98_COMPATIBILITY
const DWORD attr = (wGetFileAttributesW != 0) ? wGetFileAttributesW (fileName)
: GetFileAttributes (fileName);
#else
const DWORD attr = GetFileAttributesW (fileName);
#endif
return (dontCountDirectories) ? ((attr & FILE_ATTRIBUTE_DIRECTORY) == 0)
: (attr != 0xffffffff);
@ -122,8 +127,12 @@ bool juce_fileExists (const String& fileName,
bool juce_isDirectory (const String& fileName) throw()
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
const DWORD attr = (wGetFileAttributesW != 0) ? wGetFileAttributesW (fileName)
: GetFileAttributes (fileName);
#else
const DWORD attr = GetFileAttributesW (fileName);
#endif
return (attr != 0xffffffff)
&& ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0);
@ -131,8 +140,12 @@ bool juce_isDirectory (const String& fileName) throw()
bool juce_canWriteToFile (const String& fileName) throw()
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
const DWORD attr = (wGetFileAttributesW != 0) ? wGetFileAttributesW (fileName)
: GetFileAttributes (fileName);
#else
const DWORD attr = GetFileAttributesW (fileName);
#endif
return ((attr & FILE_ATTRIBUTE_READONLY) == 0);
}
@ -140,8 +153,12 @@ bool juce_canWriteToFile (const String& fileName) throw()
bool juce_setFileReadOnly (const String& fileName,
bool isReadOnly)
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
DWORD attr = (wGetFileAttributesW != 0) ? wGetFileAttributesW (fileName)
: GetFileAttributes (fileName);
#else
DWORD attr = GetFileAttributesW (fileName);
#endif
if (attr == 0xffffffff)
return false;
@ -154,43 +171,66 @@ bool juce_setFileReadOnly (const String& fileName,
else
attr &= ~FILE_ATTRIBUTE_READONLY;
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wSetFileAttributesW != 0)
return wSetFileAttributesW (fileName, attr) != FALSE;
return SetFileAttributes (fileName, attr) != FALSE;
#else
return SetFileAttributesW (fileName, attr) != FALSE;
#endif
}
//==============================================================================
bool juce_deleteFile (const String& fileName) throw()
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (juce_isDirectory (fileName))
return (wRemoveDirectoryW != 0) ? wRemoveDirectoryW (fileName) != 0
: RemoveDirectory (fileName) != 0;
else
return (wDeleteFileW != 0) ? wDeleteFileW (fileName) != 0
: DeleteFile (fileName) != 0;
#else
if (juce_isDirectory (fileName))
return RemoveDirectoryW (fileName) != 0;
return DeleteFileW (fileName) != 0;
#endif
}
bool juce_moveFile (const String& source, const String& dest) throw()
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
return (wMoveFileW != 0) ? wMoveFileW (source, dest) != 0
: MoveFile (source, dest) != 0;
#else
return MoveFileW (source, dest) != 0;
#endif
}
bool juce_copyFile (const String& source, const String& dest) throw()
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
return (wCopyFileW != 0) ? wCopyFileW (source, dest, false) != 0
: CopyFile (source, dest, false) != 0;
#else
return CopyFileW (source, dest, false) != 0;
#endif
}
void juce_createDirectory (const String& fileName) throw()
{
if (! juce_fileExists (fileName, true))
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wCreateDirectoryW != 0)
wCreateDirectoryW (fileName, 0);
else
CreateDirectory (fileName, 0);
#else
CreateDirectoryW (fileName, 0);
#endif
}
}
@ -202,12 +242,17 @@ void* juce_fileOpen (const String& fileName, bool forWriting) throw()
if (forWriting)
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wCreateFileW != 0)
h = wCreateFileW (fileName, GENERIC_WRITE, FILE_SHARE_READ, 0,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
else
h = CreateFile (fileName, GENERIC_WRITE, FILE_SHARE_READ, 0,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
#else
h = CreateFileW (fileName, GENERIC_WRITE, FILE_SHARE_READ, 0,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
#endif
if (h != INVALID_HANDLE_VALUE)
SetFilePointer (h, 0, 0, FILE_END);
@ -216,12 +261,17 @@ void* juce_fileOpen (const String& fileName, bool forWriting) throw()
}
else
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wCreateFileW != 0)
h = wCreateFileW (fileName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, 0);
else
h = CreateFile (fileName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, 0);
#else
h = CreateFileW (fileName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, 0);
#endif
if (h == INVALID_HANDLE_VALUE)
h = 0;
@ -492,6 +542,7 @@ bool File::isOnRemovableDrive() const throw()
static const File juce_getSpecialFolderPath (int type) throw()
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wSHGetSpecialFolderPathW != 0)
{
WCHAR path [MAX_PATH_CHARS];
@ -506,6 +557,12 @@ static const File juce_getSpecialFolderPath (int type) throw()
if (SHGetSpecialFolderPath (0, path, type, 0))
return File (String (path));
}
#else
WCHAR path [MAX_PATH_CHARS];
if (SHGetSpecialFolderPathW (0, path, type, 0))
return File (String (path));
#endif
return File::nonexistent;
}
@ -531,6 +588,7 @@ const File File::getSpecialLocation (const SpecialLocationType type)
return juce_getSpecialFolderPath (CSIDL_PROGRAM_FILES);
case tempDirectory:
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wGetTempPathW != 0)
{
WCHAR dest [2048];
@ -545,12 +603,21 @@ const File File::getSpecialLocation (const SpecialLocationType type)
GetTempPath (2048, dest);
return File (String (dest));
}
#else
{
WCHAR dest [2048];
dest[0] = 0;
GetTempPathW (2048, dest);
return File (String (dest));
}
#endif
case currentExecutableFile:
case currentApplicationFile:
{
HINSTANCE moduleHandle = (HINSTANCE) PlatformUtilities::getCurrentModuleInstanceHandle();
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wGetModuleFileNameW != 0)
{
WCHAR dest [MAX_PATH_CHARS];
@ -565,6 +632,12 @@ const File File::getSpecialLocation (const SpecialLocationType type)
GetModuleFileName (moduleHandle, dest, MAX_PATH_CHARS);
return File (String (dest));
}
#else
WCHAR dest [MAX_PATH_CHARS];
dest[0] = 0;
GetModuleFileNameW (moduleHandle, dest, MAX_PATH_CHARS);
return File (String (dest));
#endif
}
break;
@ -585,6 +658,7 @@ void juce_setCurrentExecutableFileName (const String&) throw()
//==============================================================================
const File File::getCurrentWorkingDirectory() throw()
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wGetCurrentDirectoryW != 0)
{
WCHAR dest [MAX_PATH_CHARS];
@ -599,12 +673,22 @@ const File File::getCurrentWorkingDirectory() throw()
GetCurrentDirectory (MAX_PATH_CHARS, dest);
return File (String (dest));
}
#else
WCHAR dest [MAX_PATH_CHARS];
dest[0] = 0;
GetCurrentDirectoryW (MAX_PATH_CHARS, dest);
return File (String (dest));
#endif
}
bool File::setAsCurrentWorkingDirectory() const throw()
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
return (wSetCurrentDirectoryW != 0) ? wSetCurrentDirectoryW (getFullPathName()) != FALSE
: SetCurrentDirectory (getFullPathName()) != FALSE;
#else
return SetCurrentDirectoryW (getFullPathName()) != FALSE;
#endif
}
//==============================================================================
@ -647,6 +731,7 @@ void* juce_findFileStart (const String& directory, const String& wildCard, Strin
wc += wildCard;
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wFindFirstFileW != 0)
{
WIN32_FIND_DATAW findData;
@ -669,6 +754,16 @@ void* juce_findFileStart (const String& directory, const String& wildCard, Strin
return h;
}
}
#else
WIN32_FIND_DATAW findData;
HANDLE h = FindFirstFileW (wc, &findData);
if (h != INVALID_HANDLE_VALUE)
{
getFindFileInfo (findData, firstResult, isDir, isHidden, fileSize, modTime, creationTime, isReadOnly);
return h;
}
#endif
firstResult = String::empty;
return 0;
@ -678,6 +773,7 @@ bool juce_findFileNext (void* handle, String& resultFile,
bool* isDir, bool* isHidden, int64* fileSize,
Time* modTime, Time* creationTime, bool* isReadOnly) throw()
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wFindNextFileW != 0)
{
WIN32_FIND_DATAW findData;
@ -698,6 +794,15 @@ bool juce_findFileNext (void* handle, String& resultFile,
return true;
}
}
#else
WIN32_FIND_DATAW findData;
if (handle != 0 && FindNextFileW ((HANDLE) handle, &findData) != 0)
{
getFindFileInfo (findData, resultFile, isDir, isHidden, fileSize, modTime, creationTime, isReadOnly);
return true;
}
#endif
resultFile = String::empty;
return false;
@ -819,21 +924,31 @@ bool NamedPipe::openInternal (const String& pipeName, const bool createPipe)
if (createPipe)
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wCreateNamedPipeW != 0)
intern->pipeH = wCreateNamedPipeW (file, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, 0,
1, 64, 64, 0, NULL);
else
intern->pipeH = CreateNamedPipe (file, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, 0,
1, 64, 64, 0, NULL);
#else
intern->pipeH = CreateNamedPipeW (file, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, 0,
1, 64, 64, 0, NULL);
#endif
}
else
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wCreateFileW != 0)
intern->pipeH = wCreateFileW (file, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING,
FILE_FLAG_OVERLAPPED, 0);
else
intern->pipeH = CreateFile (file, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING,
FILE_FLAG_OVERLAPPED, 0);
#else
intern->pipeH = CreateFileW (file, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING,
FILE_FLAG_OVERLAPPED, 0);
#endif
}
if (intern->pipeH != INVALID_HANDLE_VALUE)

View file

@ -41,34 +41,37 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
UNICODE_FUNCTION (GetGlyphOutlineW, DWORD, (HDC, UINT, UINT, LPGLYPHMETRICS, DWORD, LPVOID, CONST MAT2*))
UNICODE_FUNCTION (GetTextMetricsW, BOOL, (HDC, LPTEXTMETRICW))
UNICODE_FUNCTION (GetKerningPairsW, DWORD, (HDC, DWORD, LPKERNINGPAIR))
UNICODE_FUNCTION (EnumFontFamiliesExW, int, (HDC, LPLOGFONTW, FONTENUMPROCW, LPARAM, DWORD))
UNICODE_FUNCTION (CreateFontIndirectW, HFONT, (CONST LOGFONTW *));
#if JUCE_ENABLE_WIN98_COMPATIBILITY
UNICODE_FUNCTION (GetGlyphOutlineW, DWORD, (HDC, UINT, UINT, LPGLYPHMETRICS, DWORD, LPVOID, CONST MAT2*))
UNICODE_FUNCTION (GetTextMetricsW, BOOL, (HDC, LPTEXTMETRICW))
UNICODE_FUNCTION (GetKerningPairsW, DWORD, (HDC, DWORD, LPKERNINGPAIR))
UNICODE_FUNCTION (EnumFontFamiliesExW, int, (HDC, LPLOGFONTW, FONTENUMPROCW, LPARAM, DWORD))
UNICODE_FUNCTION (CreateFontIndirectW, HFONT, (CONST LOGFONTW *));
static void juce_initialiseUnicodeFileFontFunctions()
{
static bool initialised = false;
if (! initialised)
static void juce_initialiseUnicodeFileFontFunctions()
{
initialised = true;
static bool initialised = false;
if ((SystemStats::getOperatingSystemType() & SystemStats::WindowsNT) != 0)
if (! initialised)
{
HMODULE h = LoadLibraryA ("gdi32.dll");
UNICODE_FUNCTION_LOAD (GetGlyphOutlineW)
UNICODE_FUNCTION_LOAD (GetTextMetricsW)
UNICODE_FUNCTION_LOAD (GetKerningPairsW)
UNICODE_FUNCTION_LOAD (EnumFontFamiliesExW)
UNICODE_FUNCTION_LOAD (CreateFontIndirectW)
initialised = true;
if ((SystemStats::getOperatingSystemType() & SystemStats::WindowsNT) != 0)
{
HMODULE h = LoadLibraryA ("gdi32.dll");
UNICODE_FUNCTION_LOAD (GetGlyphOutlineW)
UNICODE_FUNCTION_LOAD (GetTextMetricsW)
UNICODE_FUNCTION_LOAD (GetKerningPairsW)
UNICODE_FUNCTION_LOAD (EnumFontFamiliesExW)
UNICODE_FUNCTION_LOAD (CreateFontIndirectW)
}
}
}
}
#endif
//==============================================================================
#if JUCE_ENABLE_WIN98_COMPATIBILITY
static int CALLBACK fontEnum2 (ENUMLOGFONTEX* lpelfe,
NEWTEXTMETRICEX*,
int type,
@ -83,6 +86,7 @@ static int CALLBACK fontEnum2 (ENUMLOGFONTEX* lpelfe,
return 1;
}
#endif
static int CALLBACK wfontEnum2 (ENUMLOGFONTEXW* lpelfe,
NEWTEXTMETRICEXW*,
@ -99,6 +103,7 @@ static int CALLBACK wfontEnum2 (ENUMLOGFONTEXW* lpelfe,
return 1;
}
#if JUCE_ENABLE_WIN98_COMPATIBILITY
static int CALLBACK fontEnum1 (ENUMLOGFONTEX* lpelfe,
NEWTEXTMETRICEX*,
int type,
@ -129,6 +134,7 @@ static int CALLBACK fontEnum1 (ENUMLOGFONTEX* lpelfe,
return 1;
}
#endif
static int CALLBACK wfontEnum1 (ENUMLOGFONTEXW* lpelfe,
NEWTEXTMETRICEXW*,
@ -152,9 +158,15 @@ static int CALLBACK wfontEnum1 (ENUMLOGFONTEXW* lpelfe,
fontName.copyToBuffer (lf.lfFaceName, LF_FACESIZE - 1);
HDC dc = CreateCompatibleDC (0);
#if JUCE_ENABLE_WIN98_COMPATIBILITY
wEnumFontFamiliesExW (dc, &lf,
(FONTENUMPROCW) &wfontEnum2,
lParam, 0);
#else
EnumFontFamiliesExW (dc, &lf,
(FONTENUMPROCW) &wfontEnum2,
lParam, 0);
#endif
DeleteDC (dc);
}
@ -166,6 +178,7 @@ const StringArray Font::findAllTypefaceNames()
StringArray results;
HDC dc = CreateCompatibleDC (0);
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wEnumFontFamiliesExW != 0)
{
LOGFONTW lf;
@ -200,6 +213,24 @@ const StringArray Font::findAllTypefaceNames()
(FONTENUMPROC) &fontEnum1,
(LPARAM) &results, 0);
}
#else
{
LOGFONTW lf;
zerostruct (lf);
lf.lfWeight = FW_DONTCARE;
lf.lfOutPrecision = OUT_TT_ONLY_PRECIS;
lf.lfQuality = DEFAULT_QUALITY;
lf.lfCharSet = DEFAULT_CHARSET;
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf.lfPitchAndFamily = FF_DONTCARE;
lf.lfFaceName[0] = 0;
EnumFontFamiliesExW (dc, &lf,
(FONTENUMPROCW) &wfontEnum1,
(LPARAM) &results, 0);
}
#endif
DeleteDC (dc);
@ -241,7 +272,9 @@ public:
italic (false),
size (0)
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
juce_initialiseUnicodeFileFontFunctions();
#endif
}
~FontDCHolder() throw()
@ -292,6 +325,7 @@ public:
SetMapperFlags (dc, 0);
SetMapMode (dc, MM_TEXT);
#if JUCE_ENABLE_WIN98_COMPATIBILITY
LOGFONT lf;
LOGFONTW lfw;
HFONT standardSizedFont = 0;
@ -328,6 +362,22 @@ public:
lf.lfHeight = size > 0 ? size : -256;
standardSizedFont = CreateFontIndirect (&lf);
}
#else
LOGFONTW lfw;
zerostruct (lfw);
lfw.lfCharSet = DEFAULT_CHARSET;
lfw.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lfw.lfOutPrecision = OUT_OUTLINE_PRECIS;
lfw.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
lfw.lfQuality = PROOF_QUALITY;
lfw.lfItalic = (BYTE) (italic ? TRUE : FALSE);
lfw.lfWeight = bold ? FW_BOLD : FW_NORMAL;
fontName.copyToBuffer (lfw.lfFaceName, LF_FACESIZE - 1);
lfw.lfHeight = size > 0 ? size : -256;
HFONT standardSizedFont = CreateFontIndirectW (&lfw);
#endif
if (standardSizedFont != 0)
{
@ -340,6 +390,7 @@ public:
OUTLINETEXTMETRIC otm;
if (GetOutlineTextMetrics (dc, sizeof (otm), &otm) != 0)
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wCreateFontIndirectW != 0)
{
lfw.lfHeight = -(int) otm.otmEMSquare;
@ -350,6 +401,10 @@ public:
lf.lfHeight = -(int) otm.otmEMSquare;
fontH = CreateFontIndirect (&lf);
}
#else
lfw.lfHeight = -(int) otm.otmEMSquare;
fontH = CreateFontIndirectW (&lfw);
#endif
SelectObject (dc, fontH);
DeleteObject (standardSizedFont);
@ -375,6 +430,7 @@ public:
{
if (kps == 0)
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wGetKerningPairsW != 0)
{
numKPs = wGetKerningPairsW (dc, 0, 0);
@ -387,6 +443,11 @@ public:
kps = (KERNINGPAIR*) juce_calloc (sizeof (KERNINGPAIR) * numKPs);
GetKerningPairs (dc, numKPs, kps);
}
#else
numKPs = GetKerningPairsW (dc, 0, 0);
kps = (KERNINGPAIR*) juce_calloc (sizeof (KERNINGPAIR) * numKPs);
GetKerningPairsW (dc, numKPs, kps);
#endif
}
numKPs_ = numKPs;
@ -409,6 +470,7 @@ static void addGlyphToTypeface (HDC dc,
float height;
BOOL ok = false;
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wGetTextMetricsW != 0)
{
TEXTMETRICW tm;
@ -423,6 +485,12 @@ static void addGlyphToTypeface (HDC dc,
height = (float) tm.tmHeight;
}
#else
TEXTMETRICW tm;
ok = GetTextMetricsW (dc, &tm);
height = (float) tm.tmHeight;
#endif
if (! ok)
{
@ -435,23 +503,33 @@ static void addGlyphToTypeface (HDC dc,
int bufSize;
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wGetGlyphOutlineW != 0)
bufSize = wGetGlyphOutlineW (dc, character, GGO_NATIVE,
&gm, 0, 0, &identityMatrix);
else
bufSize = GetGlyphOutline (dc, character, GGO_NATIVE,
&gm, 0, 0, &identityMatrix);
#else
bufSize = GetGlyphOutlineW (dc, character, GGO_NATIVE,
&gm, 0, 0, &identityMatrix);
#endif
if (bufSize > 0)
{
char* const data = (char*) juce_malloc (bufSize);
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wGetGlyphOutlineW != 0)
wGetGlyphOutlineW (dc, character, GGO_NATIVE, &gm,
bufSize, data, &identityMatrix);
else
GetGlyphOutline (dc, character, GGO_NATIVE, &gm,
bufSize, data, &identityMatrix);
#else
GetGlyphOutlineW (dc, character, GGO_NATIVE, &gm,
bufSize, data, &identityMatrix);
#endif
const TTPOLYGONHEADER* pheader = (TTPOLYGONHEADER*) data;
@ -608,6 +686,7 @@ void Typeface::initialiseTypefaceCharacteristics (const String& fontName,
float height;
int firstChar, lastChar;
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wGetTextMetricsW != 0)
{
TEXTMETRICW tm;
@ -632,6 +711,19 @@ void Typeface::initialiseTypefaceCharacteristics (const String& fontName,
setAscent (tm.tmAscent / height);
setDefaultCharacter (tm.tmDefaultChar);
}
#else
{
TEXTMETRICW tm;
GetTextMetricsW (dc, &tm);
height = (float) tm.tmHeight;
firstChar = tm.tmFirstChar;
lastChar = tm.tmLastChar;
setAscent (tm.tmAscent / height);
setDefaultCharacter (tm.tmDefaultChar);
}
#endif
setName (fontName);
setBold (bold);

View file

@ -45,9 +45,15 @@ bool AlertWindow::showNativeDialogBox (const String& title,
const String& bodyText,
bool isOkCancel)
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
return MessageBox (0, bodyText, title,
(isOkCancel) ? MB_OKCANCEL
: MB_OK) == IDOK;
#else
return MessageBoxW (0, bodyText, title,
(isOkCancel) ? MB_OKCANCEL
: MB_OK) == IDOK;
#endif
}
//==============================================================================

View file

@ -48,6 +48,7 @@ BEGIN_JUCE_NAMESPACE
#endif
//==============================================================================
#if JUCE_ENABLE_WIN98_COMPATIBILITY
UNICODE_FUNCTION (RegCreateKeyExW, LONG, (HKEY, LPCWSTR, DWORD, LPWSTR, DWORD, REGSAM, LPSECURITY_ATTRIBUTES, PHKEY, LPDWORD))
UNICODE_FUNCTION (RegOpenKeyExW, LONG, (HKEY, LPCWSTR, DWORD, REGSAM, PHKEY))
UNICODE_FUNCTION (RegQueryValueExW, LONG, (HKEY, LPCWSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD))
@ -75,14 +76,16 @@ static void juce_initialiseUnicodeRegistryFunctions() throw()
}
}
}
#endif
//==============================================================================
static HKEY findKeyForPath (String name,
const bool createForWriting,
String& valueName) throw()
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
juce_initialiseUnicodeRegistryFunctions();
#endif
HKEY rootKey = 0;
@ -106,39 +109,42 @@ static HKEY findKeyForPath (String name,
if (createForWriting)
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wRegCreateKeyExW != 0)
{
if (wRegCreateKeyExW (rootKey, name, 0, L"", REG_OPTION_NON_VOLATILE,
(KEY_WRITE | KEY_QUERY_VALUE), 0, &key, &result) == ERROR_SUCCESS)
{
return key;
}
}
else
{
if (RegCreateKeyEx (rootKey, name, 0, _T(""), REG_OPTION_NON_VOLATILE,
(KEY_WRITE | KEY_QUERY_VALUE), 0, &key, &result) == ERROR_SUCCESS)
{
return key;
}
}
#else
if (RegCreateKeyExW (rootKey, name, 0, L"", REG_OPTION_NON_VOLATILE,
(KEY_WRITE | KEY_QUERY_VALUE), 0, &key, &result) == ERROR_SUCCESS)
return key;
#endif
}
else
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wRegOpenKeyExW != 0)
{
if (wRegOpenKeyExW (rootKey, name, 0, KEY_READ, &key) == ERROR_SUCCESS)
{
return key;
}
}
else
{
if (RegOpenKeyEx (rootKey, name, 0, KEY_READ, &key) == ERROR_SUCCESS)
{
return key;
}
}
#else
if (RegOpenKeyExW (rootKey, name, 0, KEY_READ, &key) == ERROR_SUCCESS)
return key;
#endif
}
}
@ -153,6 +159,7 @@ const String PlatformUtilities::getRegistryValue (const String& regValuePath,
if (k != 0)
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wRegQueryValueExW != 0)
{
WCHAR buffer [2048];
@ -175,6 +182,16 @@ const String PlatformUtilities::getRegistryValue (const String& regValuePath,
else
s = defaultValue;
}
#else
WCHAR buffer [2048];
unsigned long bufferSize = sizeof (buffer);
DWORD type = REG_SZ;
if (RegQueryValueExW (k, valueName, 0, &type, (LPBYTE) buffer, &bufferSize) == ERROR_SUCCESS)
s = buffer;
else
s = defaultValue;
#endif
RegCloseKey (k);
}
@ -190,6 +207,7 @@ void PlatformUtilities::setRegistryValue (const String& regValuePath,
if (k != 0)
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wRegSetValueExW != 0)
wRegSetValueExW (k, valueName, 0, REG_SZ,
(const BYTE*) (const WCHAR*) value,
@ -198,6 +216,11 @@ void PlatformUtilities::setRegistryValue (const String& regValuePath,
RegSetValueEx (k, valueName, 0, REG_SZ,
(const BYTE*) (const TCHAR*) value,
sizeof (TCHAR) * (value.length() + 1));
#else
RegSetValueExW (k, valueName, 0, REG_SZ,
(const BYTE*) (const WCHAR*) value,
sizeof (WCHAR) * (value.length() + 1));
#endif
RegCloseKey (k);
}
@ -215,6 +238,7 @@ bool PlatformUtilities::registryValueExists (const String& regValuePath)
unsigned long bufferSize = sizeof (buffer);
DWORD type = 0;
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wRegQueryValueExW != 0)
{
if (wRegQueryValueExW (k, valueName, 0, &type, buffer, &bufferSize) == ERROR_SUCCESS)
@ -225,6 +249,10 @@ bool PlatformUtilities::registryValueExists (const String& regValuePath)
if (RegQueryValueEx (k, valueName, 0, &type, buffer, &bufferSize) == ERROR_SUCCESS)
exists = true;
}
#else
if (RegQueryValueExW (k, valueName, 0, &type, buffer, &bufferSize) == ERROR_SUCCESS)
exists = true;
#endif
RegCloseKey (k);
}
@ -239,10 +267,14 @@ void PlatformUtilities::deleteRegistryValue (const String& regValuePath)
if (k != 0)
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wRegDeleteValueW != 0)
wRegDeleteValueW (k, valueName);
else
RegDeleteValue (k, valueName);
#else
RegDeleteValueW (k, valueName);
#endif
RegCloseKey (k);
}
@ -255,10 +287,14 @@ void PlatformUtilities::deleteRegistryKey (const String& regKeyPath)
if (k != 0)
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wRegDeleteKeyW != 0)
wRegDeleteKeyW (k, valueName);
else
RegDeleteKey (k, valueName);
#else
RegDeleteKeyW (k, valueName);
#endif
RegCloseKey (k);
}

View file

@ -306,7 +306,10 @@ static void initLogicalCpuInfo() throw()
//==============================================================================
void juce_initialiseThreadEvents() throw();
void juce_initialiseUnicodeFileFunctions() throw();
#if JUCE_ENABLE_WIN98_COMPATIBILITY
void juce_initialiseUnicodeFileFunctions() throw();
#endif
static struct JuceCpuProps
{
@ -335,7 +338,10 @@ bool SystemStats::has3DNow() throw()
void SystemStats::initialiseStats() throw()
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
juce_initialiseUnicodeFileFunctions();
#endif
juce_initialiseThreadEvents();
juce_CpuProps.hasMMX = IsProcessorFeaturePresent (PF_MMX_INSTRUCTIONS_AVAILABLE) != 0;

View file

@ -129,42 +129,46 @@ bool Desktop::canUseSemiTransparentWindows()
}
//==============================================================================
UNICODE_FUNCTION (SetWindowTextW, BOOL, (HWND, LPCWSTR))
UNICODE_FUNCTION (DragQueryFileW, UINT, (HDROP, UINT, LPWSTR, UINT))
UNICODE_FUNCTION (MapVirtualKeyW, UINT, (UINT, UINT))
UNICODE_FUNCTION (RegisterClassExW, ATOM, (CONST WNDCLASSEXW*))
UNICODE_FUNCTION (CreateWindowExW, HWND, (DWORD, LPCWSTR, LPCWSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID))
UNICODE_FUNCTION (DefWindowProcW, LRESULT, (HWND, UINT, WPARAM, LPARAM))
#if JUCE_ENABLE_WIN98_COMPATIBILITY
UNICODE_FUNCTION (SetWindowTextW, BOOL, (HWND, LPCWSTR))
UNICODE_FUNCTION (DragQueryFileW, UINT, (HDROP, UINT, LPWSTR, UINT))
UNICODE_FUNCTION (MapVirtualKeyW, UINT, (UINT, UINT))
UNICODE_FUNCTION (RegisterClassExW, ATOM, (CONST WNDCLASSEXW*))
UNICODE_FUNCTION (CreateWindowExW, HWND, (DWORD, LPCWSTR, LPCWSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID))
UNICODE_FUNCTION (DefWindowProcW, LRESULT, (HWND, UINT, WPARAM, LPARAM))
void juce_initialiseUnicodeWindowFunctions()
{
static bool initialised = false;
if (! initialised)
void juce_initialiseUnicodeWindowFunctions()
{
initialised = true;
static bool initialised = false;
if ((SystemStats::getOperatingSystemType() & SystemStats::WindowsNT) != 0)
if (! initialised)
{
HMODULE h = LoadLibraryA ("user32.dll");
UNICODE_FUNCTION_LOAD (SetWindowTextW)
UNICODE_FUNCTION_LOAD (MapVirtualKeyW)
UNICODE_FUNCTION_LOAD (RegisterClassExW)
UNICODE_FUNCTION_LOAD (CreateWindowExW)
UNICODE_FUNCTION_LOAD (DefWindowProcW)
initialised = true;
if (wDefWindowProcW == 0)
wDefWindowProcW = & DefWindowProcA;
if ((SystemStats::getOperatingSystemType() & SystemStats::WindowsNT) != 0)
{
HMODULE h = LoadLibraryA ("user32.dll");
UNICODE_FUNCTION_LOAD (SetWindowTextW)
UNICODE_FUNCTION_LOAD (MapVirtualKeyW)
UNICODE_FUNCTION_LOAD (RegisterClassExW)
UNICODE_FUNCTION_LOAD (CreateWindowExW)
UNICODE_FUNCTION_LOAD (DefWindowProcW)
h = LoadLibraryA ("shell32.dll");
UNICODE_FUNCTION_LOAD (DragQueryFileW)
if (wDefWindowProcW == 0)
wDefWindowProcW = & DefWindowProcA;
h = LoadLibraryA ("shell32.dll");
UNICODE_FUNCTION_LOAD (DragQueryFileW)
}
}
}
}
#undef DefWindowProc
#define DefWindowProc wDefWindowProcW
#undef DefWindowProc
#define DefWindowProc wDefWindowProcW
#else
#undef DefWindowProc
#define DefWindowProc DefWindowProcW
#endif
//==============================================================================
static const int extendedKeyModifier = 0x10000;
@ -520,7 +524,9 @@ public:
taskBarIcon (0),
currentWindowIcon (0)
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
juce_initialiseUnicodeWindowFunctions();
#endif
MessageManager::getInstance()
->callFunctionOnMessageThread (&createWindowCallback, (void*) this);
@ -575,10 +581,14 @@ public:
void setTitle (const String& title)
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wSetWindowTextW != 0)
wSetWindowTextW (hwnd, title);
else
SetWindowText (hwnd, title);
#else
SetWindowTextW (hwnd, title);
#endif
}
void setPosition (int x, int y)
@ -1007,6 +1017,7 @@ private:
GetModuleFileName (moduleHandle, moduleFile, 1024);
WORD iconNum = 0;
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wRegisterClassExW != 0)
{
WNDCLASSEXW wcex;
@ -1045,6 +1056,24 @@ private:
RegisterClassEx (&wcex);
}
#else
WNDCLASSEXW wcex;
wcex.cbSize = sizeof (wcex);
wcex.style = CS_OWNDC;
wcex.lpfnWndProc = (WNDPROC) windowProc;
wcex.lpszClassName = windowClassName;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 32;
wcex.hInstance = moduleHandle;
wcex.hIcon = ExtractAssociatedIcon (moduleHandle, moduleFile, &iconNum);
iconNum = 1;
wcex.hIconSm = ExtractAssociatedIcon (moduleHandle, moduleFile, &iconNum);
wcex.hCursor = 0;
wcex.hbrBackground = 0;
wcex.lpszMenuName = 0;
RegisterClassExW (&wcex);
#endif
}
~WindowClassHolder()
@ -1107,10 +1136,14 @@ private:
if (windowClassHolder == 0)
windowClassHolder = new WindowClassHolder();
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wCreateWindowExW != 0)
hwnd = wCreateWindowExW (exstyle, windowClassHolder->windowClassName, L"", type, 0, 0, 0, 0, 0, 0, 0, 0);
else
hwnd = CreateWindowEx (exstyle, windowClassHolder->windowClassName, _T(""), type, 0, 0, 0, 0, 0, 0, 0, 0);
#else
hwnd = CreateWindowExW (exstyle, windowClassHolder->windowClassName, L"", type, 0, 0, 0, 0, 0, 0, 0, 0);
#endif
if (hwnd != 0)
{
@ -1627,8 +1660,12 @@ private:
if ((currentModifiers & (ModifierKeys::ctrlModifier | ModifierKeys::altModifier)) != 0)
{
UINT keyChar = wMapVirtualKeyW != 0 ? wMapVirtualKeyW (key, 2)
: MapVirtualKey (key, 2);
#if JUCE_ENABLE_WIN98_COMPATIBILITY
const UINT keyChar = wMapVirtualKeyW != 0 ? wMapVirtualKeyW (key, 2)
: MapVirtualKey (key, 2);
#else
const UINT keyChar = MapVirtualKeyW (key, 2);
#endif
handleKeyPress ((int) LOWORD (keyChar), 0);
}
@ -1673,8 +1710,12 @@ private:
else
{
// convert the scan code to an unmodified character code..
#if JUCE_ENABLE_WIN98_COMPATIBILITY
UINT keyChar = wMapVirtualKeyW != 0 ? wMapVirtualKeyW (wMapVirtualKeyW (virtualScanCode, 1), 2)
: MapVirtualKey (MapVirtualKey (virtualScanCode, 1), 2);
#else
UINT keyChar = MapVirtualKeyW (MapVirtualKeyW (virtualScanCode, 1), 2);
#endif
keyChar = LOWORD (keyChar);
@ -1736,6 +1777,7 @@ private:
for (int i = 0; i < numFiles; ++i)
{
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wDragQueryFileW != 0)
{
wDragQueryFileW (hdrop, i, (LPWSTR) name, MAX_PATH);
@ -1746,6 +1788,10 @@ private:
DragQueryFile (hdrop, i, (LPSTR) name, MAX_PATH);
files.add ((LPSTR) name);
}
#else
DragQueryFileW (hdrop, i, (LPWSTR) name, MAX_PATH);
files.add ((LPWSTR) name);
#endif
}
juce_free (name);

View file

@ -62,15 +62,21 @@
#endif
//==============================================================================
#ifndef JUCE_ENABLE_WIN98_COMPATIBILITY
// #define JUCE_ENABLE_WIN98_COMPATIBILITY 1
#endif
// helpers for dynamically loading unicode functions..
#define UNICODE_FUNCTION(functionName, returnType, params) \
typedef returnType (WINAPI *type##functionName) params; \
static type##functionName w##functionName = 0;
#if JUCE_ENABLE_WIN98_COMPATIBILITY
#define UNICODE_FUNCTION(functionName, returnType, params) \
typedef returnType (WINAPI *type##functionName) params; \
static type##functionName w##functionName = 0;
#define UNICODE_FUNCTION_LOAD(functionName) \
w##functionName = (type##functionName) GetProcAddress (h, #functionName); \
jassert (w##functionName != 0); \
#define UNICODE_FUNCTION_LOAD(functionName) \
w##functionName = (type##functionName) GetProcAddress (h, #functionName); \
jassert (w##functionName != 0);
#endif
#endif // __WIN32_HEADERS_JUCEHEADER__