Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with Qm
Dear Gintaras,

This code aborts when in QM - not in all previous versions - at statement :

Function MyBrowseForFolder
Copy      Help
,b.lpfn=&BFF_Callback; b.lParam=&p

with message :
Error in <open ":894: /2158">MyBrowseForFolder: unknown identifier

No such problem in all previous versions.

Please advise.

Best regards

Function MyBrowseForFolder
Copy      Help
function# str&s [$sinitdir] [flags] [$text] ;;flags: 1 include files, 2 include non-file objects (Control Panel, etc), 4 new style

;080818 CallBack + Edit Window on flag 0

;Displays "Browse For Folder" dialog and stores full path of selected folder into s.
;Returns a nonzero value on OK, 0 on Cancel.

;flags may also include one or more of BIF_x flags (declared in WINAPI), lshifted by 8 bits. For example, to browse for computer, use 2|(0x1000<<8). For more info, search for SHBrowseForFolder in the MSDN Library.

;str s
;if(BrowseForFolder(s "$windows$")) out s

;Η παρούσα έκδοση καλύπτει όλα τα προβλήματα inidir + PSHot=4 και
;συνεργάζεται με την Browse_Folder_in_Reg με ένα "έξυπνπο" call-back στο τέλος.
;Απαραίτητο στην PS Hot Folders - Configure - Applications να εξαιρείται η QM.

str si.getmacro(getopt(itemid) 1)
if ideb; min 0; err out "<>%s : <open ''%s /%i''>%s</open>" NowT si si
int hwndowner w
,;Gintaras solution

;,My 1st solution 120924182130

;,My final solution 120924205753

;_s.format("Handowner : %i" hwndowner)
;min 0; err out "<>%s : <open ''%s /%i''>%s</open> - %s" NowT si si _s
str sc.getwinclass(hwndowner)
if StrCompare(sc "QM_toolbar")=0
,int parentW=GetToolbarOwner(hwndowner)
,;_s.format("Parent : %i" parentW)
,;min 0; err out "<>%s : <open ''%s /%i''>%s</open> - %s" NowT si si _s
;_s.format("Reference window : %i" w)
;min 0; err out "<>%s : <open ''%s /%i''>%s</open> - %s" NowT si si _s

int hwinit=w

if(flags&1) b.ulFlags|BIF_BROWSEINCLUDEFILES
if(flags&2=0) b.ulFlags|BIF_RETURNONLYFSDIRS
if(flags&4) b.ulFlags|BIF_USENEWUI

,STRINT p.i=flags; p.s.searchpath(PSinitdir)
,b.lpfn=&BFF_Callback; b.lParam=&p
;Αν PSHot=0 προσθέτει ένα edit window
,if(len(PSinitdir)) b.pidlRoot=PidlFromStr(PSinitdir)

ITEMIDLIST* pidl=SHBrowseForFolderW(&b)

if(pidl) PidlToStr(pidl &s flags&2=0); CoTaskMemFree pidl; else s.all
if(b.pidlRoot) CoTaskMemFree b.pidlRoot

;Task_Message "Pause"
wait 120 -V MyBFF_Sema
,out "<>%s : <open ''%s /%i''>%s</open> - %s" NowT si si _s
,mac "Warning_QM" si
;Task_Message "Resume"


_s.from("Folders : " s " - " PSHotF)
min 0; err out "<>%s : <open ''%s /%i''>%s</open> - %s" NowT si si _s
if empty(s) and empty(PSHotF)
,_s="Action probably cancelled"
,out "<>%s : <open ''%s /%i''>%s</open> - %s" NowT si si _s
,mac "Warning_QM" si
if !empty(PSHotF) ;; Εδώ πάει όταν PSHot=2
,;out PSHotF
,int hwex=win("" "ExploreWClass")
,ifi hwex; min hwex
,min 0; err out "<>%s : <open ''%s /%i''>%s</open> - %s" NowT si si "Looping ..."
,goto g1

ret s.len
It was a private function, now replaced with sub-function Callback in BrowseForFolder.
Replace word 'BFF_Callback' to 'sub.Callback', and add this code at the bottom:
Function MyBrowseForFolder
Copy      Help
#sub Callback
function# hwnd uMsg lParam STRINT&lpData

sel uMsg
,if(lpData.s.len) SendMessage hwnd BFFM_SETEXPANDED 1 @lpData.s ;;does not work on w2000
,if(lpData.i&6=4 and _winnt<6) SendMessage hwnd BFFM_ENABLEOK 0 PidlToStr(+lParam &_s 1) ;;w2000/xp bug fix
(this code is from BrowseForFolder)
In this QM version many System private functions replaced to sub-functions. To quickly find your broken functions using the removed System private functions:
Macro Compile All
Copy      Help
CompileAllItems "\QM folder containing my functions"
Dear Gintaras,

Thank you very much for such a prompt reply. I am sorry, it was my mistake that I have not noticed these changes in the original form in BrowseForFolder. I sould have been more careful before writing this post.

Best regards
It was my mistake that QM does not show a warning when user code uses System private functions.

Forum Jump:

Users browsing this thread: 1 Guest(s)