This App is No Longer Maintained. Visit the Replacement at StrokesPlus.net

StrokesPlus Forum
                       
StrokesPlus Forum
Home | Profile | Active Topics
Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Bug and Issues
 Resolved Bugs and Issues
 use the win api in gesture have a error
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

zqxathz

4 Posts

Posted - 08/23/2015 :  07:26:05  Show Profile
i'm used scrpit in Global Lua

alien = alien.core
shell = alien.load("shell32.dll")
gEmpRecycleBin = shell1.SHEmptyRecycleBinA
gEmpRecycleBin:types{ ret = 'long', abi = 'stdcall', 'long', 'string', 'ulong' }

function aEmpRecycleBin(hWnd, rootPath, dwFlags)
	return  gEmpRecycleBin(hWnd,rootPath, 0)
end

and use a scrpit in the action
aEmpRecycleBin(nil,nil,0)


when i execute this action,the windows give me a error,but use the script in Hotkeys is successful...

the windows is windows 10 64bit and windows 8.1 64bit,i find this error in shcore.dll,error code is 0xc0000005

Rob

USA
2615 Posts

Posted - 08/23/2015 :  19:26:46  Show Profile  Visit Rob's Homepage
That function is very weird...multiple searches return a LOT of people having odd/inconsistent behaviors when trying to call it.

From what I can ascertain, it's due to the Lua script running in a thread which has not interacted with the user. I get it makes sense to have this type of destructive function secured, but makes using it in S+ not very ideal. However, the fact that it works for you in a hotkey script boggles my mind since it doesn't work for me that way.

The closest I could get is (using your existing DLL binding declaration):
--Make the user interact with the action thread
acMessageBox("Click OK to empty the Recycle Bin.", "Pointless Interaction") 
--Used the foreground window handle here, to avoid crashing
aEmpRecycleBin(acGetForegroundWindow(),nil,0)
Of course, it's annoying...I may add a new action in S+ which posts a message to the main thread, which then calls SHEmptyRecycleBinA directly; that should eliminate the message box, but I haven't tested it.
Go to Top of Page

Rob

USA
2615 Posts

Posted - 08/28/2015 :  03:17:39  Show Profile  Visit Rob's Homepage
Added acEmptyRecycleBins() in version 2.8.5.31
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
StrokesPlus Forum © 2011-2018 Rob Yapchanyk Go To Top Of Page
Snitz Forums 2000