1. Kwadwo Boahene
  2. PowerBuilder
  3. Thursday, 07 September 2017

 

I added the Windows API  code below to my production PB 12.1 and Powerbuilder 2017 test applications (same exe)  and this is crashing my app. The crash happens on Windows Server 2012 R2 but fine on my desktop- (Windows 7). Does anyone have an API or anything else that will work in both areas to pull the users person folder information. I using that folder to temporary write some files. PB 2017 trial had more problems because I could never debug with out randomly optimizing some pbls.

 ///////

API

///global external function

Function long SHGetFolderPath ( long hwndOwner, long nFolder, long hToken, long dwFlags, Ref string pszPath ) Library "shell32.dll" alias For "SHGetFolderPathW"

//// local area

Constant Long CSIDL_PERSONAL = 5 // current user My Documents  
Constant Long CSIDL_APPDATA = 26 // current user Application Data  
Constant Long CSIDL_LOCAL_APPDATA = 28 // local settings Application Data  
Constant Long CSIDL_COMMON_DOCUMENTS = 46 // all users My Documents  
Constant Long CSIDL_COMMON_APPDATA = 35 // all users Application Data  
string ls_path  
ulong lul_handle, lul_rc, lul_hToken  
//  
ls_path = Space(256)  
lul_handle = Handle(This)  
SetNull(lul_hToken)  
lul_rc = SHGetFolderPath(lul_handle,  CSIDL_PERSONAL, lul_hToken, 0, gs_personal_folder)  
//  

  gs_personal_folder = gs_personal_folder+"\"
//  

KB

Who is viewing this page
Chris Pollach Accepted Answer Pending Moderation
0
Votes
Undo

Hi Kwadwo;

  FWIW: Your declarations look correct to me.

 

Can you try instead ....

lul_rc = SHGetFolderPath ( 0,  CSIDL_PERSONAL, 0, 0, gs_personal_folder)  

 

HTH

Regards ... Chris

Comment
Finally, got it working by making the function a local external function instead of global. I don't know why but it works fine.



Thanks,



Kwadwo Boahene



 

  1. Kwadwo Boahene
  2. Thursday, 7 September 2017
There are no comments made yet.
  1. Thursday, 7 September 2017
  2. PowerBuilder
  3. # 1
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.