digitalmars.D.learn - interface idispatch
- Miguel Ferreira Simões (9/9) Apr 12 2005 I am trying to call D classes from jscript.
- jicman (9/18) Apr 12 2005 Miguel,
- Miguel F. Simões (3/3) Apr 12 2005 I will take a look.
- J C Calvarese (10/38) Apr 16 2005 Yeah, it looked like Carlos was making progress getting generic ActiveX
- jicman (5/43) Apr 16 2005 Me too, JCC. I tried to compile that piece of code and got into missing...
- Carlos Santander B. (9/17) Apr 17 2005 A bit of both, actually. It needed a bit more of the time I could give
- Miguel F. Simoes (5/10) Apr 17 2005 Can you send me, please.
- J C Calvarese (7/23) Apr 17 2005 If you don't mind, I'd like a copy. I don't recall exactly what
- Carlos Santander B. (11/17) Apr 17 2005 I'm sending this to Justin, but I'd like to point something: I already
- J C Calvarese (9/25) Apr 17 2005 A new project separate from Walnut? It's not that big of a project, is i...
- Carlos Santander B. (8/15) Apr 17 2005 Well, I thought it could be used for more than Walnut. I assume many
- jicman (5/17) Apr 17 2005 I agree. Walnut is a different project. This IDispatch startup would b...
- J C Calvarese (29/44) Apr 17 2005 I'm just doubtful that I can really add anything to this project (I
- Derek Parnell (7/53) Apr 17 2005 What is a "VARIANTARG"? Is it a class, struct, dynamic array, or what?
- J C Calvarese (6/60) Apr 17 2005 Yes, I just double checked. As I expected, there is one argument.
- Derek Parnell (11/69) Apr 17 2005 Can you post the definition of VARIANTARG?
- J C Calvarese (33/104) Apr 17 2005 alias VARIANT VARIANTARG;
- Derek Parnell (16/37) Apr 17 2005 Yuck! What a mess ;-)
- J C Calvarese (5/37) Apr 18 2005 Oops. I'm sure you're right. I think I'm trying to mess up everything th...
- Carlos Santander B. (6/15) Apr 18 2005 I uploaded it to dsource. It's in
- Miguel F. Simoes (2/4) Apr 19 2005 That's a good idea.
I am trying to call D classes from jscript. The problem is that my knowledge in COM programming is null. I have read some information and I guess that I have to implement the interface IDispatch. Where can I get more information? Can anyone give me a clue of how to do it... Thanks. -- Miguel Ferreira Simões
Apr 12 2005
Miguel, Here is a post from a few months back... "http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/19426" I don't know what happened to it. But, if you get any where with this, I would love to see your work. I have a few JSCript that I would love to transfer to D. I could provide you with some of those, but again, they are JSCript programs. buena suerte! josé Miguel Ferreira Simões says...I am trying to call D classes from jscript. The problem is that my knowledge in COM programming is null. I have read some information and I guess that I have to implement the interface IDispatch. Where can I get more information? Can anyone give me a clue of how to do it... Thanks. -- Miguel Ferreira Simões
Apr 12 2005
jicman wrote:Miguel, Here is a post from a few months back... "http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/19426" I don't know what happened to it. But, if you get any where with this, I would love to see your work. I have a few JSCript that I would love to transfer to D. I could provide you with some of those, but again, they are JSCript programs.Yeah, it looked like Carlos was making progress getting generic ActiveX and/or COM to work. I suspect he either ran into an obstacle or just got side-tracked into another project. It also looked like John C understood the method Carlos was using. I was looking into getting it to work for myself, but I started running into missing Windows headers and I wasn't in the mood to hunt for them or recreate them.buena suerte! josé Miguel Ferreira Simões says...-- jcc7 http://jcc_7.tripod.com/d/I am trying to call D classes from jscript. The problem is that my knowledge in COM programming is null. I have read some information and I guess that I have to implement the interface IDispatch. Where can I get more information? Can anyone give me a clue of how to do it... Thanks. -- Miguel Ferreira Simões
Apr 16 2005
Me too, JCC. I tried to compile that piece of code and got into missing headers and other things. I would love to get a COM library that works with D. Love to! jic J C Calvarese says...jicman wrote:Miguel, Here is a post from a few months back... "http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/19426" I don't know what happened to it. But, if you get any where with this, I would love to see your work. I have a few JSCript that I would love to transfer to D. I could provide you with some of those, but again, they are JSCript programs.Yeah, it looked like Carlos was making progress getting generic ActiveX and/or COM to work. I suspect he either ran into an obstacle or just got side-tracked into another project. It also looked like John C understood the method Carlos was using. I was looking into getting it to work for myself, but I started running into missing Windows headers and I wasn't in the mood to hunt for them or recreate them.buena suerte! josé Miguel Ferreira Simões says...-- jcc7 http://jcc_7.tripod.com/d/I am trying to call D classes from jscript. The problem is that my knowledge in COM programming is null. I have read some information and I guess that I have to implement the interface IDispatch. Where can I get more information? Can anyone give me a clue of how to do it... Thanks. -- Miguel Ferreira Simões
Apr 16 2005
J C Calvarese wrote:Yeah, it looked like Carlos was making progress getting generic ActiveX and/or COM to work. I suspect he either ran into an obstacle or just got side-tracked into another project. It also looked like John C understood the method Carlos was using. I was looking into getting it to work for myself, but I started running into missing Windows headers and I wasn't in the mood to hunt for them or recreate them.A bit of both, actually. It needed a bit more of the time I could give it, at the moment. There were two parts I feel should be addressed: type checking, and getting rid of VARIANTARGs in client code. If anyone wants to do it, let me know and I'll send him what I have. If it works ok, I could use it for Walnut too. -- Carlos Santander Bernal JP2, you'll always live in our minds
Apr 17 2005
A bit of both, actually. It needed a bit more of the time I could give it, at the moment. There were two parts I feel should be addressed: type checking, and getting rid of VARIANTARGs in client code. If anyone wants to do it, let me know and I'll send him what I have. If it works ok, I could use it for Walnut too.Can you send me, please. It would be great to have ActiveX and COM working! I know very little of COM interfaces and I doubt that I can make any progress with it... but I can try. Miguel.
Apr 17 2005
Carlos Santander B. wrote:J C Calvarese wrote:If you don't mind, I'd like a copy. I don't recall exactly what VARIANTARG's are, but maybe I can figure out how to remove them. I'd like to try to help. -- jcc7 http://jcc_7.tripod.com/d/Yeah, it looked like Carlos was making progress getting generic ActiveX and/or COM to work. I suspect he either ran into an obstacle or just got side-tracked into another project. It also looked like John C understood the method Carlos was using. I was looking into getting it to work for myself, but I started running into missing Windows headers and I wasn't in the mood to hunt for them or recreate them.A bit of both, actually. It needed a bit more of the time I could give it, at the moment. There were two parts I feel should be addressed: type checking, and getting rid of VARIANTARGs in client code. If anyone wants to do it, let me know and I'll send him what I have. If it works ok, I could use it for Walnut too.
Apr 17 2005
J C Calvarese wrote:If you don't mind, I'd like a copy. I don't recall exactly what VARIANTARG's are, but maybe I can figure out how to remove them. I'd like to try to help.I'm sending this to Justin, but I'd like to point something: I already sent the same to Miguel and previously to Robert Münch. John Chapman was also working on something similar. My proposal is, if all of you guys (and maybe even I when I have the time) are going to try to make some progress with this, how about setting up a small project in dsource just for this. All of you/us would be admins/moderators. This way, we'd avoid duplicate efforts. What do you guys think? -- Carlos Santander Bernal JP2, you'll always live in our minds
Apr 17 2005
Carlos Santander B. wrote:J C Calvarese wrote:I've got it. Thanks.If you don't mind, I'd like a copy. I don't recall exactly what VARIANTARG's are, but maybe I can figure out how to remove them. I'd like to try to help.I'm sending this to Justin, but I'd like to point something: I alreadysent the same to Miguel and previously to Robert Münch. John Chapman was also working on something similar. My proposal is, if all of you guys (and maybe even I when I have the time) are going to try to make some progress with this, how about setting up a small project in dsource just for this. All of you/us would be admins/moderators. This way, we'd avoid duplicate efforts. What do you guys think?A new project separate from Walnut? It's not that big of a project, is it? Maybe we should just post our future developments in the Walnut forum (so it doesn't get overlooked in the expansive Digital Mars newsgroups): http://www.dsource.org/forums/viewforum.php?f=51 -- jcc7 http://jcc_7.tripod.com/d/
Apr 17 2005
J C Calvarese wrote:A new project separate from Walnut? It's not that big of a project, is it? Maybe we should just post our future developments in the Walnut forum (so it doesn't get overlooked in the expansive Digital Mars newsgroups): http://www.dsource.org/forums/viewforum.php?f=51Well, I thought it could be used for more than Walnut. I assume many will be needing it in the future. And there's also the issue about duplicated efforts. But I agree it wouldn't big enough, so I don't know. Whatever you (all of you) prefer. -- Carlos Santander Bernal JP2, you'll always live in our minds
Apr 17 2005
Carlos Santander B. says...J C Calvarese wrote:I agree. Walnut is a different project. This IDispatch startup would be a different project altogher, though, Walnut could use it. Just a thought... jicA new project separate from Walnut? It's not that big of a project, is it? Maybe we should just post our future developments in the Walnut forum (so it doesn't get overlooked in the expansive Digital Mars newsgroups): http://www.dsource.org/forums/viewforum.php?f=51Well, I thought it could be used for more than Walnut. I assume many will be needing it in the future. And there's also the issue about duplicated efforts. But I agree it wouldn't big enough, so I don't know. Whatever you (all of you) prefer.
Apr 17 2005
Carlos Santander B. wrote:J C Calvarese wrote:I'm just doubtful that I can really add anything to this project (I think ActiveX is my personal kryptonite). And I'm already listed as member of at least three inactive projects at dsource: Core32, L8night, UnDig. I know there's no quota or anything, but I feel a little guilty about it. I'll try to help you and jic wherever you try to work on this (and I'll be more than a little interested in your progress), but this ActiveX/COM stuff just stymies me at every turn. For example, I thought this code might make it a little easier to use VARIANTARGs: VARIANTARG toVariant(...) { VARIANTARG myArg; if (_arguments[0] == typeid(char[])) { myArg.n1.n2.vt = VT_BSTR; myArg.n1.n2.n3.bstrVal = SysAllocString(va_arg!(wchar*)(_argptr)); } else throw new Exception("toVariant doesn't know what to do with it."); return myArg; } It compiles, but it generates an "Access Error" whenever I try to use it. I don't know what's wrong with it. It's probably something simple, but it just doesn't work. -- jcc7 http://jcc_7.tripod.com/d/A new project separate from Walnut? It's not that big of a project, is it? Maybe we should just post our future developments in the Walnut forum (so it doesn't get overlooked in the expansive Digital Mars newsgroups): http://www.dsource.org/forums/viewforum.php?f=51Well, I thought it could be used for more than Walnut. I assume many will be needing it in the future. And there's also the issue about duplicated efforts. But I agree it wouldn't big enough, so I don't know. Whatever you (all of you) prefer.
Apr 17 2005
On Sun, 17 Apr 2005 22:12:48 -0500, J C Calvarese wrote:Carlos Santander B. wrote:What is a "VARIANTARG"? Is it a class, struct, dynamic array, or what? Are you sure that "_arguments.length" is > 0 ? -- Derek Melbourne, Australia 18/04/2005 1:37:08 PMJ C Calvarese wrote:I'm just doubtful that I can really add anything to this project (I think ActiveX is my personal kryptonite). And I'm already listed as member of at least three inactive projects at dsource: Core32, L8night, UnDig. I know there's no quota or anything, but I feel a little guilty about it. I'll try to help you and jic wherever you try to work on this (and I'll be more than a little interested in your progress), but this ActiveX/COM stuff just stymies me at every turn. For example, I thought this code might make it a little easier to use VARIANTARGs: VARIANTARG toVariant(...) { VARIANTARG myArg; if (_arguments[0] == typeid(char[])) { myArg.n1.n2.vt = VT_BSTR; myArg.n1.n2.n3.bstrVal = SysAllocString(va_arg!(wchar*)(_argptr)); } else throw new Exception("toVariant doesn't know what to do with it."); return myArg; } It compiles, but it generates an "Access Error" whenever I try to use it. I don't know what's wrong with it. It's probably something simple, but it just doesn't work.A new project separate from Walnut? It's not that big of a project, is it? Maybe we should just post our future developments in the Walnut forum (so it doesn't get overlooked in the expansive Digital Mars newsgroups): http://www.dsource.org/forums/viewforum.php?f=51Well, I thought it could be used for more than Walnut. I assume many will be needing it in the future. And there's also the issue about duplicated efforts. But I agree it wouldn't big enough, so I don't know. Whatever you (all of you) prefer.
Apr 17 2005
Derek Parnell wrote:On Sun, 17 Apr 2005 22:12:48 -0500, J C Calvarese wrote:It's a struct. (It's more frequently called "VARIANT".) Is that the problem?Carlos Santander B. wrote:What is a "VARIANTARG"? Is it a class, struct, dynamic array, or what?J C Calvarese wrote:I'm just doubtful that I can really add anything to this project (I think ActiveX is my personal kryptonite). And I'm already listed as member of at least three inactive projects at dsource: Core32, L8night, UnDig. I know there's no quota or anything, but I feel a little guilty about it. I'll try to help you and jic wherever you try to work on this (and I'll be more than a little interested in your progress), but this ActiveX/COM stuff just stymies me at every turn. For example, I thought this code might make it a little easier to use VARIANTARGs: VARIANTARG toVariant(...) { VARIANTARG myArg; if (_arguments[0] == typeid(char[])) { myArg.n1.n2.vt = VT_BSTR; myArg.n1.n2.n3.bstrVal = SysAllocString(va_arg!(wchar*)(_argptr)); } else throw new Exception("toVariant doesn't know what to do with it."); return myArg; } It compiles, but it generates an "Access Error" whenever I try to use it. I don't know what's wrong with it. It's probably something simple, but it just doesn't work.A new project separate from Walnut? It's not that big of a project, is it? Maybe we should just post our future developments in the Walnut forum (so it doesn't get overlooked in the expansive Digital Mars newsgroups): http://www.dsource.org/forums/viewforum.php?f=51Well, I thought it could be used for more than Walnut. I assume many will be needing it in the future. And there's also the issue about duplicated efforts. But I agree it wouldn't big enough, so I don't know. Whatever you (all of you) prefer.Are you sure that "_arguments.length" is > 0 ?Yes, I just double checked. As I expected, there is one argument. -- jcc7 http://jcc_7.tripod.com/d/
Apr 17 2005
On Mon, 18 Apr 2005 00:23:00 -0500, J C Calvarese wrote:Derek Parnell wrote:Can you post the definition of VARIANTARG? Also, if you are looking for typeid(char[]), why are you casting it as (wchar*) ? I have some similar code in one of my modules, but I code it as ... if (_arguments[0] is typeid(char[])) So maybe the problem is that you use "==" rather than "===" or "is" . -- Derek Melbourne, Australia 18/04/2005 3:29:56 PMOn Sun, 17 Apr 2005 22:12:48 -0500, J C Calvarese wrote:It's a struct. (It's more frequently called "VARIANT".) Is that the problem?Carlos Santander B. wrote:What is a "VARIANTARG"? Is it a class, struct, dynamic array, or what?J C Calvarese wrote:I'm just doubtful that I can really add anything to this project (I think ActiveX is my personal kryptonite). And I'm already listed as member of at least three inactive projects at dsource: Core32, L8night, UnDig. I know there's no quota or anything, but I feel a little guilty about it. I'll try to help you and jic wherever you try to work on this (and I'll be more than a little interested in your progress), but this ActiveX/COM stuff just stymies me at every turn. For example, I thought this code might make it a little easier to use VARIANTARGs: VARIANTARG toVariant(...) { VARIANTARG myArg; if (_arguments[0] == typeid(char[])) { myArg.n1.n2.vt = VT_BSTR; myArg.n1.n2.n3.bstrVal = SysAllocString(va_arg!(wchar*)(_argptr)); } else throw new Exception("toVariant doesn't know what to do with it."); return myArg; } It compiles, but it generates an "Access Error" whenever I try to use it. I don't know what's wrong with it. It's probably something simple, but it just doesn't work.A new project separate from Walnut? It's not that big of a project, is it? Maybe we should just post our future developments in the Walnut forum (so it doesn't get overlooked in the expansive Digital Mars newsgroups): http://www.dsource.org/forums/viewforum.php?f=51Well, I thought it could be used for more than Walnut. I assume many will be needing it in the future. And there's also the issue about duplicated efforts. But I agree it wouldn't big enough, so I don't know. Whatever you (all of you) prefer.Are you sure that "_arguments.length" is > 0 ?Yes, I just double checked. As I expected, there is one argument.
Apr 17 2005
Derek Parnell wrote:On Mon, 18 Apr 2005 00:23:00 -0500, J C Calvarese wrote:alias VARIANT VARIANTARG; Then you ask, "What's a VARIANT?" struct VARIANT { n1_t n1; }; Then you might ask, "What's a n1_t?" It gets kind of complicated. All of the details are in Core32. Here's file with the VARIANT definition: http://svn.dsource.org/svn/projects/core32/trunk/core32/win32/com/OAIDL.dDerek Parnell wrote:Can you post the definition of VARIANTARG?On Sun, 17 Apr 2005 22:12:48 -0500, J C Calvarese wrote:It's a struct. (It's more frequently called "VARIANT".) Is that the problem?Carlos Santander B. wrote:What is a "VARIANTARG"? Is it a class, struct, dynamic array, or what?J C Calvarese wrote:I'm just doubtful that I can really add anything to this project (I think ActiveX is my personal kryptonite). And I'm already listed as member of at least three inactive projects at dsource: Core32, L8night, UnDig. I know there's no quota or anything, but I feel a little guilty about it. I'll try to help you and jic wherever you try to work on this (and I'll be more than a little interested in your progress), but this ActiveX/COM stuff just stymies me at every turn. For example, I thought this code might make it a little easier to use VARIANTARGs: VARIANTARG toVariant(...) { VARIANTARG myArg; if (_arguments[0] == typeid(char[])) { myArg.n1.n2.vt = VT_BSTR; myArg.n1.n2.n3.bstrVal = SysAllocString(va_arg!(wchar*)(_argptr)); } else throw new Exception("toVariant doesn't know what to do with it."); return myArg; } It compiles, but it generates an "Access Error" whenever I try to use it. I don't know what's wrong with it. It's probably something simple, but it just doesn't work.A new project separate from Walnut? It's not that big of a project, is it? Maybe we should just post our future developments in the Walnut forum (so it doesn't get overlooked in the expansive Digital Mars newsgroups): http://www.dsource.org/forums/viewforum.php?f=51Well, I thought it could be used for more than Walnut. I assume many will be needing it in the future. And there's also the issue about duplicated efforts. But I agree it wouldn't big enough, so I don't know. Whatever you (all of you) prefer.Are you sure that "_arguments.length" is > 0 ?Yes, I just double checked. As I expected, there is one argument.Also, if you are looking for typeid(char[]), why are you casting it as (wchar*) ?That's a good question. I think I need to cast it to a wchar* to satisfy SysAllocString, but I guess I should put in into a char[] first. Thanks to your incisive questioning, I came up with some code that doesn't produce an Access Error. Whether it's helpful to the ActiveX cause is something I'll have to wait to tommorrow to discover (it's now time for me to go to sleep). Thank you again for your help. VARIANTARG toVariant(...) { VARIANTARG myArg; writefln("%s", _arguments.length); if (_arguments[0] == typeid(char[])) { wchar* w = cast(wchar*) (va_arg!(char[])(_argptr) ~ "\0"); myArg.n1.n2.vt = VT_BSTR; myArg.n1.n2.n3.bstrVal = SysAllocString(w); } else throw new Exception("toVariant doesn't know what to do with it."); return myArg; } -- jcc7 http://jcc_7.tripod.com/d/
Apr 17 2005
On Mon, 18 Apr 2005 00:54:18 -0500, J C Calvarese wrote:Derek Parnell wrote:[snip]Yuck! What a mess ;-)Can you post the definition of VARIANTARG?alias VARIANT VARIANTARG; Then you ask, "What's a VARIANT?" struct VARIANT { n1_t n1; }; Then you might ask, "What's a n1_t?" It gets kind of complicated. All of the details are in Core32. Here's file with the VARIANT definition: http://svn.dsource.org/svn/projects/core32/trunk/core32/win32/com/OAIDL.dIf I recall correctly, casting a char[] to a wchar* does *not* convert the UTF8 string to a UTF16 string. So I think you might really need to do ... if (_arguments[0] is typeid(char[])) { wchar[] w = std.utf.toUTF16( (va_arg!(char[])(_argptr) ~ "\0"); myArg.n1.n2.vt = VT_BSTR; myArg.n1.n2.n3.bstrVal = SysAllocString(w.ptr); } -- Derek Melbourne, Australia 18/04/2005 4:35:52 PMAlso, if you are looking for typeid(char[]), why are you casting it as (wchar*) ?That's a good question. I think I need to cast it to a wchar* to satisfy SysAllocString, but I guess I should put in into a char[] first.
Apr 17 2005
In article <2bq10pgk5lks$.pjqtmq8tvk41.dlg 40tude.net>, Derek Parnell says...On Mon, 18 Apr 2005 00:54:18 -0500, J C Calvarese wrote:I agree. Isn't Windows well-designed?Derek Parnell wrote:[snip]Yuck! What a mess ;-)Can you post the definition of VARIANTARG?alias VARIANT VARIANTARG; Then you ask, "What's a VARIANT?" struct VARIANT { n1_t n1; }; Then you might ask, "What's a n1_t?" It gets kind of complicated. All of the details are in Core32. Here's file with the VARIANT definition: http://svn.dsource.org/svn/projects/core32/trunk/core32/win32/com/OAIDL.dOops. I'm sure you're right. I think I'm trying to mess up everything that can be messed up. jcc7If I recall correctly, casting a char[] to a wchar* does *not* convert the UTF8 string to a UTF16 string. So I think you might really need to do ... if (_arguments[0] is typeid(char[])) { wchar[] w = std.utf.toUTF16( (va_arg!(char[])(_argptr) ~ "\0"); myArg.n1.n2.vt = VT_BSTR; myArg.n1.n2.n3.bstrVal = SysAllocString(w.ptr); }Also, if you are looking for typeid(char[]), why are you casting it as (wchar*) ?That's a good question. I think I need to cast it to a wchar* to satisfy SysAllocString, but I guess I should put in into a char[] first.
Apr 18 2005
Carlos Santander B. wrote:I'm sending this to Justin, but I'd like to point something: I already sent the same to Miguel and previously to Robert Münch. John Chapman was also working on something similar. My proposal is, if all of you guys (and maybe even I when I have the time) are going to try to make some progress with this, how about setting up a small project in dsource just for this. All of you/us would be admins/moderators. This way, we'd avoid duplicate efforts. What do you guys think?I uploaded it to dsource. It's in http://svn.dsource.org/svn/projects/walnut/downloads/some_other_things/ -- Carlos Santander Bernal JP2, you'll always live in our minds
Apr 18 2005
I uploaded it to dsource. It's in http://svn.dsource.org/svn/projects/walnut/downloads/some_other_things/That's a good idea. If more people have access to the code... the result will probably better.
Apr 19 2005