1. william yau
  2. PowerBuilder
  3. Tuesday, 18 January 2022 08:57 AM UTC

hi 

after program export to excel. the program icon missing. it seem need fine tune some configure file .  would you have advise

before export excel

after export to excel , icon missing 

 

 

 

Miguel Leeuwe Accepted Answer Pending Moderation
  1. Tuesday, 18 January 2022 09:11 AM UTC
  2. PowerBuilder
  3. # 1

Hi William,

If your icons are NOT in a PBR file, that means they'd be assigned dynamically. Normally the icons would be distributed in the same folder as where the EXE file is. This will work fine, as long as you don't change Windows' internal directory. When you save an excel file into a different directory, the "current / internal " directory no longer points to where you EXE file is. So, most probably, I think that's what's happening. When you open you application, save the path to where you EXE is in a global variable. After saving the Excel file, make sure to use the ChangeDirectory() funtion to set the "current/internal" windows directory back to where your EXE is located.

Even better: include the images in a PBR file so you won't have this problem at all.

regards.

Comment
  1. Andreas Mykonios
  2. Thursday, 20 January 2022 08:53 AM UTC
But if the installation is installed to a folder like Program Files, a simple user may not have write access.

Andreas.
  1. Helpful 1
  1. Miguel Leeuwe
  2. Thursday, 20 January 2022 09:02 AM UTC
Adding to what Andreas said: Maybe the fileSave is "interactive" and the user is choosing where to save ... I wouldn't save in the folder where my executables are.
  1. Helpful
  1. Miguel Leeuwe
  2. Thursday, 20 January 2022 09:02 AM UTC
It probably is too, since the images are disappearing.
  1. Helpful
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Tuesday, 18 January 2022 09:08 AM UTC
  2. PowerBuilder
  3. # 2

Does the application reads the icons from file system? If the export changes the current working directory the application can't find the files anymore if you have specified a relative path. Try to change back the current directory after export (or if you use GetFileSaveName function specify the flag OFN_NOCHANGEDIR).

Comment
  1. Brad Mettee
  2. Wednesday, 19 January 2022 15:46 PM UTC
Miguel

FileRead/Write/Ex don't change the current working directory (nor does FileOpen). Allowing the user to navigate to a diff folder WILL change the current working directory though, even if they cancel out of the dialog.
  1. Helpful
  1. Brad Mettee
  2. Wednesday, 19 January 2022 15:52 PM UTC
Missed some text - add "IF you don't use OFN_NOCHANGEDIR" to the end of my prev comment



(gah, wish there was an "Edit" button for comments)
  1. Helpful 1
  1. Miguel Leeuwe
  2. Wednesday, 19 January 2022 16:49 PM UTC
Thanks Brad,

lol, what I do is copy my comment, then delete it and create a new one.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


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