Windows TreeView bug

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Windows TreeView bug

Steve Waring-2
Hi,
I am Using V4PL1 on win2000;

If I create a new view resource for TreePresenter with the #isMonoExpandable
aspect set to true,

and then for example evaluate;

TreePresenter show: 'Mono view' on: SmalltalkSystem current systemFolder

make a selection, and then try to close the view, I get a Not Found error.
Looking through one of the call stacks I got it, seems that the TreeView is
receiving a TVN_ITEMEXPANDING message after the WM_DESTROY message.

Any suggestions on the best place to guard for this?

Thanks,
Steve


Reply | Threaded
Open this post in threaded view
|

data type problem - COM beginner's question

miguel_barcos
Hi,

I need to invoke an MSAccess function that sends a Report Object by
email. I have tested this function manually in access and it works. All
I need to do now is to invoke the COM function from Dolphin to
perform this same task , right? Well, I am frustratingly close, but not
close enough...


I have the following code in a workspace:
----------------------

| AccessApplication IDoCmd |

"create the AccessApplication - this works"
AccessApplication := MSAccess_Application createObject: '{8CC49940-3146-
11CF-97A1-00AA00424A9F}'.

"open the database - this works"
AccessApplication
      openCurrentDatabase: 'C:\MyDatabase.mdb'
      exclusive: false.

"get the wrapper for the Access.IDoCmd interface - this works"
IDoCmd := AccessApplication doCmd.

"call the send object function - this does not work"
IDoCmd sendObject: 3
        objectName:  'MyReport'  asVariant
        outputFormat: 'HTML' asVariant
        to: '[hidden email]' asVariant
        cc: '[hidden email]' asVariant
        bcc: '[hidden email]' asVariant
        subject: 'This is the subject of the email' asVariant
        messageText: ' This is the message text' asVariant
        editMessage: 'No' asVariant
        templateFile: 'C:\sample.html' asVariant.

----------------------

I get the following exception;

"a HRESULTError('HRESULT Error: An expression you entered is the wrong
data type for one of the arguments.@You tried to run a macro or use a
method to carry out an action, but an expression evaluated to the wrong
data type.
For example, for the Close method you specified a string for the Object
Type argument, but this argument can be set only to certain intrinsic
constants or their numeric equivalents.@@1@@1 (FACILITY_CONTROL)')"

I'm guessing that the exception refers to the first argument
(smallinteger 3). I think I need a 3 because I have determined that in
MSAccess a value of 3 maps to an object type of REPORT.


Below is the invoked method's code:
-----------
SendObject: objectType ObjectName: objectName OutputFormat:
outputFormat To: to Cc: cc Bcc: bcc Subject: subject MessageText:
messageText EditMessage: editMessage TemplateFile: templateFile

        "Private - Invoke the SendObject() method of the COM object
wrapped by the receiver.

     HRESULT __stdcall SendObject(
        [in, optional, defaultvalue(-1)] AcSendObjectType ObjectType,
        [in, optional] VARIANT ObjectName,
        [in, optional] VARIANT OutputFormat,
        [in, optional] VARIANT To,
        [in, optional] VARIANT Cc,
        [in, optional] VARIANT Bcc,
        [in, optional] VARIANT Subject,
        [in, optional] VARIANT MessageText,
        [in, optional] VARIANT EditMessage,
        [in, optional] VARIANT TemplateFile);
        "

        <virtual stdcall: hresult 46 sdword variant variant variant
variant variant variant variant variant variant>
        ^self invalidCall

-----------
I can see from the above comment that it's expecting
an "AcSendObjectType" data type, but it also looks like that it
ultimately gets mapped to an 'sdword' when making the native call. I
thought that a smallinteger could always be coerced to an sdword -
(other examples in the code show exactly that .. )

Am I not interpreting the exception message correctly? Do I need to
create an AcSendObjectType instance? (I don't see such class in the
image)

Any help is greatly appreciated. Thank you.

Miguel Barcos


Sent via Deja.com
http://www.deja.com/


Reply | Threaded
Open this post in threaded view
|

Re: data type problem - COM beginner's question

Blair McGlashan
Miguel

You wrote in message news:93koa1$b3a$[hidden email]...
>
> I need to invoke an MSAccess function that sends a Report Object by
> email. I have tested this function manually in access and it works. All
> I need to do now is to invoke the COM function from Dolphin to
> perform this same task , right? Well, I am frustratingly close, but not
> close enough...

Well you've got quite far.

> I have the following code in a workspace:
> ----------------------
>
> | AccessApplication IDoCmd |

As an aside, by convention one normally reserves upper cased names for
global variables. Also as these variables are being used in a workspace, you
don't need to declare them unless you are trying to build a script to run.

> "create the AccessApplication - this works"
> AccessApplication := MSAccess_Application createObject: '{8CC49940-3146-
> 11CF-97A1-00AA00424A9F}'.

True, but it would be easier to say:

accessApplication := MSAccess_Application new.

>...
>
> "call the send object function - this does not work"
> IDoCmd sendObject: 3
> objectName:  'MyReport'  asVariant
>...
> editMessage: 'No' asVariant
> templateFile: 'C:\sample.html' asVariant.
>
> ----------------------
>
> I get the following exception;
>
> "a HRESULTError('HRESULT Error: An expression you entered is the wrong
> data type ...
> ...
> I'm guessing that the exception refers to the first argument
> (smallinteger 3). I think I need a 3 because I have determined that in
> MSAccess a value of 3 maps to an object type of REPORT.
>...

Actually it is far more likely to be one of the VARIANT arguments since
these are effectively untyped and so it is not clear from the function
prototype alone what one is expected to pass. Unfortunately VARIANT
arguments are massively over-used in the MS Office object model, appearing
frequently in places where a stricter type should have been used. The
particular problem here is the editMessage argument, which is really
expecting a boolean value.

My revised code is below. You'll note I generated the interfaces with the
prefix, Access, which was the default I got offered for Access 2000, rather
than MSAccess. Also I have used undeclared workspace variables. I have also
added the generated constants pool, AccessConstants, to the workspace, and
I've removed the #asVariant conversions since these are not needed (the
wrapper method will do it):

accessApplication := Access_Application new.
accessApplication openCurrentDatabase: '<db path here>' exclusive: false.
iDoCmd := accessApplication doCmd.
iDoCmd sendObject: acSendReport
 objectName: 'MyReport'
 outputFormat: 'HTML'
 to: '[hidden email]'
 cc: '[hidden email]'
 bcc: '[hidden email]'
 subject: 'This is the subject of the email'
 messageText: ' This is the message text'
 editMessage: true
 templateFile: 'C:\sample.html'.

I passed true instead of 'No' asVariant.

Regards

Blair


Reply | Threaded
Open this post in threaded view
|

Re: data type problem - COM beginner's question

miguel_barcos
Thank you very much Blair. That worked just fine!

It did seem quite silly to do what I was doing. I guess there is a
reason why Smalltalk has a boolean type... (duh!) I was just thinking
in terms of external data types and thought that Access needed
a "String asVariant".

Lesson learned. Thanks again.

Miguel


Sent via Deja.com
http://www.deja.com/