1. win32Lib request for RemoveDirectoryA
- Posted by Bob Thompson <rthompson at rthompson.karoo.co.uk> Jul 02, 2006
- 688 views
Derek, I'm looking for a deltree/y or RMDIR/S/y equivalent. Can you add a wrapper for RemoveDirectoryA to win32lib along with an example please. I added the following to my copy of win32Kernel.ew and win32file.ew. global constant xRemoveDirectory = registerw32Function kernel32, "RemoveDirectoryA",{C_POINTER},C_LONG) global function removeDirectory(sequence name) atom a atom r a = w32acquire_mem(0, name) r = w32Func(xRemoveDirectory,{a}) w32release_mem(a) return r end function I recognise that the directory has to be empty but it fails to delete a directory outside my BIN folder. How do I give my programme delete access? Do I have to write the following to get it to work? ?moveFile("C:\\new_folder_xyz", "C:\\euphoria\\bin\\new_folder_xyz") ?removeDirectory("new_folder_xyz") Regards, Bob
2. Re: win32Lib request for RemoveDirectoryA
- Posted by Bob Thompson <rthompson at rthompson.karoo.co.uk> Jul 02, 2006
- 634 views
Bob Thompson wrote: > I recognise that the directory has to be empty but it fails to delete > a directory outside my BIN folder. How do I give my programme delete access? > > Do I have to write the following to get it to work? > > ?moveFile("C:\\new_folder_xyz", "C:\\euphoria\\bin\\new_folder_xyz") > > ?removeDirectory("new_folder_xyz") Whoops! Only consider the request and forget about the silly question. It helps if you learn to consistently put a colon between C and \\ Regards, Bob
3. Re: win32Lib request for RemoveDirectoryA
- Posted by don cole <doncole at pacbell.net> Jul 02, 2006
- 618 views
Bob Thompson wrote: > > > Derek, > > I'm looking for a deltree/y or RMDIR/S/y equivalent. > > Can you add a wrapper for RemoveDirectoryA to win32lib along with an > example please. > > I added the following to my copy of win32Kernel.ew and win32file.ew. > > global constant > xRemoveDirectory = registerw32Function > kernel32, "RemoveDirectoryA",{C_POINTER},C_LONG) > > global function removeDirectory(sequence name) > atom a > atom r > > a = w32acquire_mem(0, name) > > r = w32Func(xRemoveDirectory,{a}) > > w32release_mem(a) > > return r > end function > > I recognise that the directory has to be empty but it fails to delete > a directory outside my BIN folder. How do I give my programme delete access? > > Do I have to write the following to get it to work? > > ?moveFile("C:\\new_folder_xyz", "C:\\euphoria\\bin\\new_folder_xyz") > > ?removeDirectory("new_folder_xyz") > > Regards, > > Bob This might be stupid but did you try: removeDirectory("C:\\new_folder_xyz") Don Cole
4. Re: win32Lib request for RemoveDirectoryA
- Posted by Bob Thompson <rthompson at rthompson.karoo.co.uk> Jul 03, 2006
- 634 views
don cole wrote: > This might be stupid but did you try: removeDirectory("C:\\new_folder_xyz") > > Don Cole I did eventually, Don. Hence my second post. It's amazing how embarrassing it can be to continually overlook a simple typographical error and delve into information gathering in preference to logic. I've become too accustomed to Euphoria's error catching. Perhaps I'm not really cut out for this. I should take up electronics - low voltage stuff :) I'm still recovering from repairing my motherboard. The computer was crashing quite often after initial startup even after reloading XP. There were two slightly swollen tiny capacitors with a huge 1500 micro farad / 6 volts rating in what looked like a low pass series LC PI filter next to the CPU. I robbed a couple out of an old video recorder and it works fine now. Bit of a tricky soldering job on a double sided board! I'm composed now. Derek, If you don't think the wrapper sits well in win32Lib, no problem - Akusaya's Standard Library code looks good. Regards, Bob
5. Re: win32Lib request for RemoveDirectoryA
- Posted by Derek Parnell <ddparnell at bigpond.com> Jul 03, 2006
- 631 views
> Derek, > > If you don't think the wrapper sits well in win32Lib, no problem - Akusaya's > Standard Library code looks good. It is worth inclusion. But it won't be done this week as I've got some deadlines looming -- Derek Parnell Melbourne, Australia Skype name: derek.j.parnell
6. Re: win32Lib request for RemoveDirectoryA
- Posted by don cole <doncole at pacbell.net> Jul 03, 2006
- 635 views
Bob Thompson wrote: > > don cole wrote: > > This might be stupid but did you try: removeDirectory("C:\\new_folder_xyz") > > > > Don Cole > > I did eventually, Don. Hence my second post. It's amazing how embarrassing it > can be to continually overlook a simple typographical error and delve into > information gathering in preference to logic. I've become too accustomed to > Euphoria's error catching. Perhaps I'm not really cut out for this. > I should take up electronics - low voltage stuff :) > > I'm still recovering from repairing my motherboard. The computer > was crashing quite often after initial startup even after reloading XP. > There were two slightly swollen tiny capacitors with a huge 1500 micro > farad / 6 volts rating in what looked like a low pass series LC PI filter > next to the CPU. I robbed a couple out of an old video recorder and it works > fine now. Bit of a tricky soldering job on a double sided board! > > I'm composed now. > > Derek, > > If you don't think the wrapper sits well in win32Lib, no problem - Akusaya's > Standard Library code looks good. > > Regards, > > Bob Yes Bob, I'm glad you got your computer working. I'm a TV,VCR,DVD tech. Often in Electronics as well a computers it's overlooking the little things that cause the problem. On my computer I had the +5V supply (you can read it in the BIOS until it crashes) keep dropping until it crashed. I relaced the Power Supply Fan (which has never worked since I had the computer).Thinking that the heat was causing the problem. Still crashed after several days. Then I found that wiggling the plug that goes from the Power Supply to the motherboard the voltage would change. So I took the motherboard out and resoldered all the connections on the back of the plug. Still problem. Finally I changed the plug going to the top of the motherboard. I took one from an old computer. This required cutting and splicing 20 wires and took me all day. But now I'm back in business. BTW with capactors (unlike any other electronic components I know of) it's best to replace with NEW ones. The micro farads should be the same but voltage can be higher. Of course if it's too high you may have trouble fitting them in there. If you got them in there and your computer works then apply the "If it ain't broke don't fix it" rule. I just mean in the future. Your code looks fine to me. How did you know to make changes in win32Kernel.ew and win32file.ew? Don Cole
7. Re: win32Lib request for RemoveDirectoryA
- Posted by Bob Thompson <rthompson at rthompson.karoo.co.uk> Jul 03, 2006
- 633 views
- Last edited Jul 04, 2006
don cole wrote: > BTW with capactors (unlike any other electronic components I know of) it's > best to replace with NEW ones. You're right, Don, but I needed a quick repair. I designed and built a couple of Hi-Fi amps for myself several years ago. The best is a triode input with a transformer coupling (2x step up) to a power MOSFET feeding through a 2x step down output transformer (to make better followers and lower the current demand from the caps). Pure class A, no feedback! > > Your code looks fine to me. How did you know to make changes in win32Kernel.ew > and win32file.ew? > > Don Cole I used reverse engineering. I don’t particularly have enough spare time to learn the basics from scratch. C code is pretty ugly to me and there are very good win32 libraries out there. My interest is in Euphoria programming, and a Windows interface is just an added, and visually attractive, bonus at this moment made easily available by the generosity of the community of (usually) professional programmers. I guessed everyone was essentially using the same code to use a routine from the three common Windows DLLs, e.g. from Akusaya's code; xDeleteFile = define_c_func(open_dll("kernel32"), "DeleteFileA", {C_POINTER}, C_LONG) global function delete_file(sequence filename) atom pfilename, ret pfilename = allocate_string(filename) ret = c_func(xDeleteFile, {pfilename}) free(pfilename) return ret end function It’s just that everyone’s style is different, as it should be, e.g. from w32Kernel.ew and from w32file.ew xDeleteFile = registerw32Function(kernel32, "DeleteFileA",{C_POINTER}, C_LONG) global function deleteFile(sequence name) atom a atom r a = w32acquire_mem(0, name) r = w32Func(xDeleteFile,{a}) w32release_mem(a) return r end function Some may use machine_func(50, file_name) as in memshare .ew instead of open_dll(file_name) as defined in dll.e. Similar arguments apply to allocate_string(file_name) versus w32acquire_mem(0, name) preferred by Derek with its 2 arguments, versus something like lpszHandle = machine_func(16, length(strHandle)+1) poke(lpszHandle,strHandle) poke(lpszHandle+length(strHandle),0) from memshare.ew I’m not suggesting that these are exact code equivalents, most are actually functions, but my point is that they all ultimately boil down to the same code, but they are defined and written differently. I found this very confusing to start with but it's pretty obvious really. As if that wasn’t confusing enough, I found myself having to decipher Bernard’s W32ENGIN.EW to get access to his comprehensive listing of basic window types, type definitions etc. His program automatically generates the same code. You can get a quick tour by following Def (exact match) etc. using a good editor. I used to start with Win32 programmer’s reference for an overview and delve into Bernard’s code if need be. There is probably something already written in the forum or archives though, as was the case with Akusaya's code and it’s then often a simple task of substituting the format style, e.g. from Bernard’s and Akusaya's code it is evident that the code for deleteFile is similar to removeDirectory. I know it gets a lot more complicated (and interesting) than this the more you dig. Perhaps it might be possible to write a program to reverse engineer Bernard’s code and present it in dll.e format like Akusaya's code :) Perhaps its a little unorthodox, but I dislike reading manuals. If you know of an easier way, please advise. Regards, Bob
8. Re: win32Lib request for RemoveDirectoryA
- Posted by Bob Thompson <rthompson at rthompson.karoo.co.uk> Jul 03, 2006
- 617 views
- Last edited Jul 04, 2006
Derek Parnell wrote: > > > Derek, > > > > If you don't think the wrapper sits well in win32Lib, no problem - Akusaya's > > Standard Library code looks good. > > It is worth inclusion. But it won't be done this week as I've got some > deadlines > looming > > -- > Derek Parnell > Melbourne, Australia > Skype name: derek.j.parnell Appreciated, Derek. No rush - deadlines take priority. Regards, Bob
9. Re: win32Lib request for RemoveDirectoryA
- Posted by Bernie Ryan <xotron at bluefrog.com> Jul 03, 2006
- 631 views
- Last edited Jul 04, 2006
Bob Thompson wrote: > > xDeleteFile = define_c_func(open_dll("kernel32"), "DeleteFileA", > {C_POINTER}, C_LONG) > > global function delete_file(sequence filename) > atom pfilename, ret > pfilename = allocate_string(filename) > ret = c_func(xDeleteFile, {pfilename}) > free(pfilename) > return ret > end function > I know it gets a lot more complicated (and interesting) than this the > more you dig. Perhaps it might be possible to write a program to reverse > engineer Bernard’s code and present it in dll.e format like Akusaya's Bob: Or you can use WMOTOR.
include motor.eu library("kernel32") declare("DeleteFile",1,s) global function delete_file(sequence filename) atom ret ret = c_func("DeleteFile", {sz(pfilename)}) szfree() return ret end function
Bernie My files in archive: WMOTOR, XMOTOR, W32ENGIN, MIXEDLIB, EU_ENGIN, WIN32ERU, WIN32API Can be downloaded here: http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan
10. Re: win32Lib request for RemoveDirectoryA
- Posted by Bernie Ryan <xotron at bluefrog.com> Jul 03, 2006
- 631 views
- Last edited Jul 04, 2006
Bernie Ryan wrote: > > Bob Thompson wrote: > > > > xDeleteFile = define_c_func(open_dll("kernel32"), "DeleteFileA", > > {C_POINTER}, C_LONG) > > > > global function delete_file(sequence filename) > > atom pfilename, ret > > pfilename = allocate_string(filename) > > ret = c_func(xDeleteFile, {pfilename}) > > free(pfilename) > > return ret > > end function > > > I know it gets a lot more complicated (and interesting) than this the > > more you dig. Perhaps it might be possible to write a program to reverse > > engineer Bernard’s code and present it in dll.e format like Akusaya's > > Bob: > > Or you can use WMOTOR. > > }}} <eucode> > > include motor.eu > > library("kernel32") > declare("DeleteFile",1,s) > > global function delete_file(sequence filename) > atom ret CORRECTION: > ret = c_func("DeleteFile", {sz(pfilename)}) SHOULD BE: ret = f("DeleteFile", {sz(pfilename)}) > szfree() > return ret > end function > > </eucode> {{{ > > > Bernie > > My files in archive: > WMOTOR, XMOTOR, W32ENGIN, MIXEDLIB, EU_ENGIN, WIN32ERU, WIN32API > > Can be downloaded here: > <a > href="http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan">http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan</a> Bernie My files in archive: WMOTOR, XMOTOR, W32ENGIN, MIXEDLIB, EU_ENGIN, WIN32ERU, WIN32API Can be downloaded here: http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan
11. Re: win32Lib request for RemoveDirectoryA
- Posted by Bob Thompson <rthompson at rthompson.karoo.co.uk> Jul 03, 2006
- 648 views
- Last edited Jul 04, 2006
Thanks, Bernie. I'll take a good look at it. Regards, Bob
12. Re: win32Lib request for RemoveDirectoryA
- Posted by don cole <doncole at pacbell.net> Jul 04, 2006
- 631 views
Bob Thompson wrote: > > don cole wrote: > > > BTW with capactors (unlike any other electronic components I know of) it's > > best to replace with NEW ones. > > You're right, Don, but I needed a quick repair. I designed and built a > couple of Hi-Fi amps for myself several years ago. The best is a triode > input with a transformer coupling (2x step up) to a power MOSFET feeding > through a 2x step down output transformer (to make better followers > and lower the current demand from the caps). Pure class A, no feedback! > > > > Your code looks fine to me. How did you know to make changes in > > win32Kernel.ew > > and win32file.ew? > > > > Don Cole > > I used reverse engineering. I don’t particularly have enough spare time > to learn the basics from scratch. C code is pretty ugly to me and there > are very good win32 libraries out there. My interest is in Euphoria > programming, and a Windows interface is just an added, and visually > attractive, bonus at this moment made easily available by the generosity > of the community of (usually) professional programmers. > > I guessed everyone was essentially using the same code to use a routine > from the three common Windows DLLs, e.g. from Akusaya's code; > > xDeleteFile = define_c_func(open_dll("kernel32"), "DeleteFileA", > {C_POINTER}, C_LONG) > > global function delete_file(sequence filename) > atom pfilename, ret > pfilename = allocate_string(filename) > ret = c_func(xDeleteFile, {pfilename}) > free(pfilename) > return ret > end function > > It’s just that everyone’s style is different, as it should be, e.g. from > w32Kernel.ew and from w32file.ew > > xDeleteFile = registerw32Function(kernel32, "DeleteFileA",{C_POINTER}, > C_LONG) > > global function deleteFile(sequence name) > atom a > atom r > a = w32acquire_mem(0, name) > r = w32Func(xDeleteFile,{a}) > w32release_mem(a) > return r > end function > > Some may use machine_func(50, file_name) as in memshare .ew instead > of open_dll(file_name) as defined in dll.e. Similar arguments apply to > allocate_string(file_name) versus w32acquire_mem(0, name) preferred by > Derek with its 2 arguments, versus something like > > lpszHandle = machine_func(16, length(strHandle)+1) > poke(lpszHandle,strHandle) > poke(lpszHandle+length(strHandle),0) from memshare.ew > > I’m not suggesting that these are exact code equivalents, most are > actually functions, but my point is that they all ultimately boil down > to the same code, but they are defined and written differently. I found > this very confusing to start with but it's pretty obvious really. > > As if that wasn’t confusing enough, I found myself having to decipher > Bernard’s W32ENGIN.EW to get access to his comprehensive listing of basic > window types, type definitions etc. His program automatically generates > the same code. You can get a quick tour by following Def (exact match) etc. > using a good editor. > > I used to start with Win32 programmer’s reference for an overview and > delve into Bernard’s code if need be. There is probably something already > written in the forum or archives though, as was the case with Akusaya's > code and it’s then often a simple task of substituting the format style, > e.g. from Bernard’s and Akusaya's code it is evident that the code for > deleteFile is similar to removeDirectory. > > I know it gets a lot more complicated (and interesting) than this the > more you dig. Perhaps it might be possible to write a program to reverse > engineer Bernard’s code and present it in dll.e format like Akusaya's > code :) > > Perhaps its a little unorthodox, but I dislike reading manuals. If you > know of an easier way, please advise. > > Regards, > > Bob Hello Bob; What's the name of Akusaya's code and Derek's code and Bernard's code that you speak of ? They are not listed by author in the archives. Don Cole
13. Re: win32Lib request for RemoveDirectoryA
- Posted by Bob Thompson <rthompson at rthompson.karoo.co.uk> Jul 04, 2006
- 651 views
don cole wrote: > What's the name of Akusaya's code and Derek's code and Bernard's code that you > speak of ? > > They are not listed by author in the archives. > > Don Cole Hi, Don, Look at Platform.htm for the WIN32.HLP file and other references. Akusaya's code can be found by searching the forum using his name and xRemoveDirectory. Derek's code is in win32Lib.ew. Use GURU.BAT entering deleteFile and, afterwards, DeleteFileA. Bernie's code can be found in the archives under Win32Engine. Memshare can be found in the archives. Regards, Bob