 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Sean
Joined: 12 Feb 2007 Posts: 2462
|
Posted: Thu Feb 15, 2007 4:26 am Post subject: |
|
|
| Laszlo wrote: | | Especially in this case, when it is faster, simpler, safer to use explicit offsets, like *(ptr+1). |
Safer?, I agree. Faster?, I don't know. Simpler?, I disagree.
I chose ++ptr not because I didn't know *(ptr+1) is safer. I did it just because ++ptr looked simpler and elegant, at least symbolically. So, I won't change it unless it's broken. Of course you can change it as whatever you like. |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 2462
|
Posted: Thu Feb 15, 2007 10:59 am Post subject: |
|
|
| foom wrote: | | I like it that you create wrappers around the dll calls but please name the functions the same as the wrapped functions. Having to remember 2 different names for 1 function is a PITA. It would be much better if you could read on msdn and start typing the functions names out as they apear on msdn rather than have to look what the wrapper function is called in your lib. |
I understand. But I'm doubtful how many users would take the trouble to go to MSDN before using the helper functions.
They may ask: what kind of name are these, MultiByteToWideChar and WideCharToMultiByte? They really don't mean much. So, I chose Ansi2Unicode etc, even if they are ambiguous: Ansi, it's not only ANSI, it can be OEM, or even MAC codepages or UTF-7 or UTF-8. And UTF-16 is not the only Unicode encoding. However, it would convey the actual purpose of the function more clearly. (As you probably guessed already, 2 for To, 4 for From here) BTW, I was tempted to use Ansi2Wide etc, but I decided not.
Regarding CreateObject and GetObject, as a matter of fact, I hesitated a little between them and CoCreateObject (:not CoCreateInstance) and CoGetObject. The reason was that I was afraid of that it could lead name collisions when AHK implements COM fully. AHK would want to use the names after VB like I did. But, after surveying the naming conventions of AHK, I concluded it's rather unlikely. It's likely to use the names like ObjCreate and ObjGet as AutoIt did. So, I took the names from VBS.
Anyway, if you have better names, please let me know. |
|
| Back to top |
|
 |
foom
Joined: 19 Apr 2006 Posts: 386
|
Posted: Thu Feb 15, 2007 6:15 pm Post subject: |
|
|
| If you are afraid of nameclashes use a decent prefix. COM_ ? |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Fri Feb 16, 2007 12:26 am Post subject: |
|
|
| Laszlo wrote: | | If you say that the current evaluation order should be the rule, try to convince Chris to document it and promise that it will not change (very often). | There is an item in the pre-release test battery to prevent evaluation order from changing. If it ever does change, I intend to log it in the changelog.
I think I mentioned this in some other topic, but maybe it got lost in the shuffle. |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4710 Location: Boulder, CO
|
Posted: Fri Feb 16, 2007 1:24 am Post subject: |
|
|
| Chris wrote: | | There is an item in the pre-release test battery to prevent evaluation order from changing | Why not add a sentence to the Help, saying that all operands are evaluated, except in short-circuit logic expressions, and in left-to-right order (next to "Operators of equal precedence such as multiply (*) and divide (/) are evaluated in left-to-right order unless otherwise specified"). It looks like many scripts posted to the Forum rely on it. (People don't seem to be taught any more about good programming styles.) This little change in the documentation would make those scripts valid (but still of bad style). |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 2462
|
Posted: Fri Feb 16, 2007 2:19 am Post subject: |
|
|
| foom wrote: | | If you are afraid of nameclashes use a decent prefix. COM_ ? |
I'd like to do it, that's also majkinetor suggested to do. But, there is a problem. What about Ansi2Unicode or Unicode2Ansi? Should they be prefixed with either COM_ or API_?
Actually Unicode2Ansi in CoHelper.ahk used to be secialized to be used in COM only: it was designed to receive only a pointer to the unicode string, not a variable for a string. So, it should be prefixed by COM_.
But, now I've changed it to receive both a pointer and a variable as ByRef (:there is still a chance to go wrong, for example, if the unicode string starts with U+3939 U+3939 U+0030...). So, should it be now prefixed with API_?
What about DecodeInteger and EncodeInteger?
Any suggestion? |
|
| Back to top |
|
 |
AHKnow* Guest
|
Posted: Wed Feb 28, 2007 5:32 am Post subject: |
|
|
So what's the deal on the COM naming conventions?
Will these names hold, when COM is introduced into AHK?
Speaking of which, this whole AHK and COM is smoking hot, so when/what release will AHK offically go COM???
Also, if I had a vote, I would go with the JScript naming conventions for COM/OLE. This way, you do not copy AutoIt, but have naming conventions that are recognized.
AutoHotkey is not "in line" with Visual Basic and VBScript programming style. So JScript type names may be better for AutoHotkey. AutoHotkey and JScript, are more in line with C "programming style". |
|
| Back to top |
|
 |
AHKnow* Guest
|
|
| Back to top |
|
 |
Guest
|
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Thu Apr 26, 2007 6:12 pm Post subject: |
|
|
So that more people find out about this topic, I've linked to it from the DllCall page. Its "related" section now reads: "Component Object Model (COM): It is possible to use COM via DllCall. There is a series of helper functions at http://www.autohotkey.com/forum/topic16631.html."
Sean, I hope you don't mind, but I also added a link in the topmost post here that points to one of your topics that uses COM Helper. Feel free to revise it as you see fit.
Thanks. |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 2462
|
Posted: Thu Apr 26, 2007 10:49 pm Post subject: |
|
|
| Chris wrote: | | Sean, I hope you don't mind, but I also added a link in the topmost post here that points to one of your topics that uses COM Helper. Feel free to revise it as you see fit. |
Of course not. Thanks for adding the link. |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 4511 Location: Belgrade
|
Posted: Fri Apr 27, 2007 7:07 am Post subject: |
|
|
2 Chris
I beleive that it is much better to add wiki section where I collected almost all important things done with COM including this one, in a much more organised way, including examples where appropriate. On the wiki are also references to the forum
http://www.autohotkey.com/wiki/index.php?title=COM_Wrappers _________________
 |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Fri Apr 27, 2007 11:47 am Post subject: |
|
|
| Thanks; I've updated the DllCall page to use that link. |
|
| Back to top |
|
 |
Tekl
Joined: 24 Sep 2004 Posts: 814 Location: Germany
|
Posted: Wed May 02, 2007 2:00 pm Post subject: |
|
|
How can I translate this JS-Code to AHK?
| Code: | var iTunesApp = WScript.CreateObject("iTunes.Application");
iTunesApp.Play();
iTunesApp.NextTrack(); |
_________________ Tekl |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 2462
|
Posted: Wed May 02, 2007 2:42 pm Post subject: |
|
|
| I don't have a iTunes. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|