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