c++ - SHGetFolderPath Deprecated: What is alternative to retrieve path for Windows folders? -


the shgetfolderpath() function deprecated beginning windows vista: http://msdn.microsoft.com/en-us/library/bb762181%28v=vs.85%29.aspx

what alternative way retrieve path application folder in windows?

shgetfolderpath(null, csidl_common_appdata, null, 0, szpath) 

aside that, why errors when using function:

error   1   error c2065: 'csidl_common_appdata' : undeclared identifier   error   2   error c3861: 'shgetfolderpath': identifier not found 

the alternative described in documentation link. namely shgetknownfolderpath.

however, shgetknownfolderpath available on vista or later. if use load time linking, , run program calls shgetknownfolderpath on xp, program fail start. problem if wish support xp.

now, switch run time linking of shgetknownfolderpath. carry out version check before call it, , if function not available, fall shgetfolderpath.

personally, not let deprecation worry excessively. microsoft renowned maintaining backwards compatibility. don't expect shgetfolderpath disappear time soon. find shgetfolderpath exists in windows 8 , expect still present in whatever windows current 10 years now. advice stick load time linking, , switch shgetknownfolderpath when give supporting xp.

your other question, ask in edit, how call shgetfolderpath. need respect requirements laid out @ bottom of msdn documentation topic linked in question. specifically, include shlobj.h , pass shlobj.lib linker.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -