Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home/iano/public_html/tpforums-vb5/forum/includes/class_core.php on line 5842

PHP Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_BOTH - assumed 'MYSQL_BOTH' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 588

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 612

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6
SHGetFolderPath and SHGetKnownFolderPath
Results 1 to 4 of 4

Thread: SHGetFolderPath and SHGetKnownFolderPath

  1. #1
    Senior Member
    Join Date
    Apr 2007
    Posts
    314

    SHGetFolderPath and SHGetKnownFolderPath

    Evening,

    As I've never tried Vista and have no intention in doing so, I'm not really that familiar with the functions that is required to use when trying to make programs work for others than myself.

    So, to the problem. SHGetFolderPath works fine when trying to find 'Program Files' in Windows XP, but this function is deprecated in Vista, and you should use SHGetKnownFolderPath instead. And that is my problem.

    I wrote a small bit of code to determine which OS the user is using, but my compiler cannot find the needed function. It looks something like this:

    Code:
    		/* Determine OS version */
    		OSVERSIONINFO osvi = GetOSVersion();
    		char cBuffer[5];
    		sprintf(cBuffer, "%u%u%u%u", osvi.dwMajorVersion >> 16, osvi.dwMajorVersion & 0xFFFF, osvi.dwMinorVersion >> 16, osvi.dwMinorVersion & 0xFFFF);
    		int nVersion = atoi(cBuffer);
    		if (nVersion > 501) // Vista or higher
    		{
    			if (SHGetKnownFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, 0, szPath) != S_OK)
    			{
    				std::cout << "[ERROR]\n";
    				system("PAUSE");
    				return 0;
    			}
    		}
    		else // xp or lower
    		{
    			if (SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, 0, szPath) != S_OK)
    			{
    				std::cout << "[ERROR]\n";
    				system("PAUSE");
    				return 0;
    			}
    		}
    		/* End Determine OS version */
    The SHGetKnownFolderPath function is, I'm pretty sure, used wrong, but as the compiler cannot even find the function I haven't bothered trying to use it right. I've been told that I should download the Vista SDK, but my current Windows version won't allow me to do this, so I'm asking here if anyone have any ideas.

  2. #2
    Senior Member
    Join Date
    Mar 2007
    Posts
    1,323

    SHGetFolderPath and SHGetKnownFolderPath

    I think if you want to develope for Windows Vista you have to own one.

  3. #3
    Senior Member
    Join Date
    Apr 2007
    Posts
    314

    SHGetFolderPath and SHGetKnownFolderPath

    Are you sure that the Windows Vista SDK isn't available for Windows XP? If it is, the problem is getting a hand on it.

  4. #4
    Senior Member
    Join Date
    Mar 2007
    Posts
    1,323

    SHGetFolderPath and SHGetKnownFolderPath

    Seems like the answer isn't that simply. Check this out*http://social.msdn.microsoft.com/For...-356a9dd07dbc/

    I think that guy is having same kind of problems as you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •