Angus Leeming wrote:
LyX/Win won't start on Win98 and earlier because SHGetFolderPath isn't
found in shell32.dll. Instead, these early versions of Windows (back
to Win95) provide the function in SHFolder.dll.

See
http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/functions/shgetfolderpath.asp
Equivalent URL: http://tinyurl.com/2peoy
for further details.

The suggested fix is to link against SHFolder.dll before linking
against shell32.dll. Now, I'm compiling on a WinXP box. Is it safe to
introduce this work around by just adding the extra .dll at link time
or does the code need to have some magic added to dynamically load
SHFolder.dll if shell32.dll is found to be too old? (We would need
version 5.0 of shell32.dll.)

It should be fine to just link against SHFolder first. However, I think that the users should be able to get this working by installing IE5 or later on their Windows 95 or 98 system.

If not, something like this should work:

char buffer[ MAX_PATH ];
buffer[ 0 ] = 0;

// SHGetFolderPath can work everywhere SHFOLDER is installed.
HMODULE shFolderModule = LoadLibrary( _T("shfolder.dll") );
if ( shFolderModule != 0 ) {
typedef HRESULT ( __stdcall * SHGetFolderPath )( HWND, int, HANDLE, DWORD, LPCSTR ); SHGetFolderPath shGetFolderPath = ( SHGetFolderPath ) ::GetProcAddress( shFolderModule, "SHGetFolderPathA" );
        if ( shGetFolderPath != 0 ) {
                // defined in shlobj.h
                enum { CSIDL_DESKTOP = 0 };
                shGetFolderPath( 0, CSIDL_DESKTOP, 0, 0, buffer );
        }
}

Adjust as needed.

Regards,
Asger

Reply via email to