April 18, 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=51
> 

Well, 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
April 18, 2005
Carlos Santander B. says...
>
>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=51
>> 
>
>Well, 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.

I agree.  Walnut is a different project.  This IDispatch startup would be a different project altogher, though, Walnut could use it.

Just a thought...

jic


April 18, 2005
Carlos Santander B. wrote:
> 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=51
>>
> 
> Well, 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.

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/
April 18, 2005
On Sun, 17 Apr 2005 22:12:48 -0500, J C Calvarese wrote:

> Carlos Santander B. wrote:
>> 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=51
>>>
>> 
>> Well, 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.
> 
> 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.

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 PM
April 18, 2005
Derek Parnell wrote:
> On Sun, 17 Apr 2005 22:12:48 -0500, J C Calvarese wrote:
> 
> 
>>Carlos Santander B. wrote:
>>
>>>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=51
>>>>
>>>
>>>Well, 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.
>>
>>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.
> 
> 
> What is a "VARIANTARG"? Is it a class, struct, dynamic array, or what?

It's a struct. (It's more frequently called "VARIANT".) Is that the problem?

> 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/
April 18, 2005
On Mon, 18 Apr 2005 00:23:00 -0500, J C Calvarese wrote:

> Derek Parnell wrote:
>> On Sun, 17 Apr 2005 22:12:48 -0500, J C Calvarese wrote:
>> 
>>>Carlos Santander B. wrote:
>>>
>>>>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=51
>>>>>
>>>>
>>>>Well, 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.
>>>
>>>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.
>> 
>> What is a "VARIANTARG"? Is it a class, struct, dynamic array, or what?
> 
> It's a struct. (It's more frequently called "VARIANT".) Is that the problem?
> 
>> Are you sure that "_arguments.length" is > 0 ?
> 
> Yes, I just double checked. As I expected, there is one argument.

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 PM
April 18, 2005
Derek Parnell wrote:
> On Mon, 18 Apr 2005 00:23:00 -0500, J C Calvarese wrote:
> 
> 
>>Derek Parnell wrote:
>>
>>>On Sun, 17 Apr 2005 22:12:48 -0500, J C Calvarese wrote:
>>>
>>>
>>>>Carlos Santander B. wrote:
>>>>
>>>>
>>>>>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=51
>>>>>>
>>>>>
>>>>>Well, 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.
>>>>
>>>>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.
>>>
>>>What is a "VARIANTARG"? Is it a class, struct, dynamic array, or what?
>>
>>It's a struct. (It's more frequently called "VARIANT".) Is that the problem?
>>
>>
>>>Are you sure that "_arguments.length" is > 0 ?
>>
>>Yes, I just double checked. As I expected, there is one argument.
> 
> 
> 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.d

> 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/
April 18, 2005
On Mon, 18 Apr 2005 00:54:18 -0500, J C Calvarese wrote:

> Derek Parnell wrote:

[snip]
>> 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.d

Yuck! What a mess ;-)

>> 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.

If 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 PM
April 18, 2005
In article <2bq10pgk5lks$.pjqtmq8tvk41.dlg@40tude.net>, Derek Parnell says...
>
>On Mon, 18 Apr 2005 00:54:18 -0500, J C Calvarese wrote:
>
>> Derek Parnell wrote:
>
>[snip]
>>> 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.d
>
>Yuck! What a mess ;-)

I agree. Isn't Windows well-designed?

>>> 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.
>
>If 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);
>      }

Oops. I'm sure you're right. I think I'm trying to mess up everything that can be messed up.

jcc7
April 19, 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