AutoHotkey Community

It is currently May 27th, 2012, 12:57 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 26 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: September 29th, 2011, 9:25 am 
Offline

Joined: March 18th, 2008, 4:04 am
Posts: 193
getting value of COM Object method argument (byref)
I asked this question in other thread, but didn't get a solution.

I tried with few COM objects , including, simple VBA class method
to get return value of a method argument(simple string), means:

myCOMObject.myMethod(returnValue)
the returnValue equals "" always.

when I use a return value with Property(function)
it works correctly, means

returnValue := myCOMObject.myProperty()
I get returnValue , correctly equal's "myValue"

is there a special syntax in AHK_L to get correctly the value of
method argument ? or there are some limitations about ?

any help will be appreciated.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 29th, 2011, 1:47 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8667
Location: Salem, MA
Split from http://www.autohotkey.com/forum/viewtopic.php?t=77068 because this may not be a bug.

can you post some example code for me to try?

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 29th, 2011, 3:47 pm 
Offline

Joined: March 18th, 2008, 4:04 am
Posts: 193
engunneer wrote:
Split from http://www.autohotkey.com/forum/viewtopic.php?t=77068 because this may not be a bug.

can you post some example code for me to try?


the code link you gave is from local hotkey function, if I understand.
I pointed on COM object instance and getting
a return Value from it's method.

the most simple example I made with VB(6) I made, something like:
in VB in DLL: myDLL.DLL
Code:
Class myCOMclass

public sub myMethod(byRef arg1)
 arg1="myValue"
end sub
 

and in AHK_L:

Code:
 myComObject := ComObjCreate("myDLL.myCOMclass")
 myComObject.myMethod(returnValue)

I get, the returnValue always equal "". should be "myValue"

I made the above VB sample code, because I didn't succeed to get the return value from some external COM objects.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 29th, 2011, 5:28 pm 
Offline
User avatar

Joined: February 28th, 2011, 7:28 pm
Posts: 625
Location: Germany
I also didn't manage that yet (see here).

One thing I thought of but haven't yet tested is using some attributes (MarshalAs etc.) in the C# code. Maybe that helps you.

But if you also get this with other COM objects, this may be a bug.

_________________
RECOMMENDED: AutoHotkey_L
Image
github - ImportTypeLib
Win7 HP SP1 32bit | AHK_L U 32bit


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 29th, 2011, 9:07 pm 
Offline
User avatar

Joined: May 24th, 2009, 5:35 am
Posts: 2099
Location: Iowa, USA
Does this help: Com Events - Using ByRef Parms

Also, you never provided a link to the documentation for this Com Object (API Reference), or a working VBScript or JScript example that we can all try.

_________________
Image
Recommended: AutoHotkey_L
Basic Webpage Controls


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 30th, 2011, 6:21 am 
Offline

Joined: March 18th, 2008, 4:04 am
Posts: 193
jethrow wrote:


jethrow,

VB6 method
I gave above a simple VB method, initiated by class
do you need more info about ?

with JScript
I wrote you, that I didn't succeed to get byRef value from COM object.
with VBscript I got error mismatch, that only Variant values can be passed

so it means, that with AHK_L I cannot pass byref from COM object ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 30th, 2011, 2:23 pm 
Offline
User avatar

Joined: May 24th, 2009, 5:35 am
Posts: 2099
Location: Iowa, USA
I wrote:
... VBScript or JScript example that we can all try.
rani wrote:
I gave above a simple VB method, initiated by class
do you need more info about ?
Quote:
Error: 0x800401F3 - Invalid class string

Line#
---> 001: myComObject := ComObjCreate("myDLL.myCOMclass")
002: myComObject.myMethod(returnValue)
003: Exit
004: Exit
004: Exit

_________________
Image
Recommended: AutoHotkey_L
Basic Webpage Controls


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 30th, 2011, 2:26 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8667
Location: Salem, MA
perhaps the dll needs to be registered?

rani, can you post your dll? then we don't have to try to compile it. Use autohotkey.net to host it.

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 30th, 2011, 4:09 pm 
Offline

Joined: March 18th, 2008, 4:04 am
Posts: 193
engunneer wrote:
rani, can you post your dll? then we don't have to try to compile it. Use autohotkey.net to host it.


is is after registry of course.
I can send you the whole VB project (saved as activex dll) (very small) with it's dll and the .ahk that runs it
how I send you , by mail ? to what address
what is autohotkey.net host ?

I think better to send the .dll then just the source.
I can also send screenshot's


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 30th, 2011, 4:56 pm 
Offline

Joined: March 18th, 2008, 4:04 am
Posts: 193
Quote:
Error: 0x800401F3 - Invalid class string

Line#
---> 001: myComObject := ComObjCreate("myDLL.myCOMclass")
002: myComObject.myMethod(returnValue)
003: Exit
004: Exit
004: Exit


I also got it after first compile, but after I made that VB project has same name as the .dll (I think this was the reason)
I got correct ComObjCreate


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 4th, 2011, 6:33 pm 
Offline

Joined: March 18th, 2008, 4:04 am
Posts: 193
engunneer wrote:
rani, can you post your dll? then we don't have to try to compile it. Use autohotkey.net to host it.


hi engunneer,
have you some advance ?

or you wait for me ?
if yes, can you give any mail address ?
if not:
how is the procedure to send the .dll+.ahk to qutohotkey.net ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 4th, 2011, 7:22 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8667
Location: Salem, MA
create account on Autohotkey.net
upload files
post links to files here
profit?

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 4th, 2011, 11:49 pm 
Offline

Joined: March 18th, 2008, 4:04 am
Posts: 193
engunneer wrote:
create account on Autohotkey.net
upload files
post links to files here
profit?


autohotkey.net
I uploaded files under rani
can you see these files ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 5th, 2011, 1:30 am 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8667
Location: Salem, MA
you have to give the specific link. http://www.autohotkey.net/~rani/[something]

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 5th, 2011, 5:28 am 
Offline

Joined: March 18th, 2008, 4:04 am
Posts: 193
engunneer wrote:
you have to give the specific link. http://www.autohotkey.net/~rani/[something]


I made, after login:
http://www.autohotkey.net/xfm/list/
I see the files under:Browsing rani


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 26 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], BrandonHotkey, chaosad, Google Feedfetcher, MSN [Bot] and 20 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group