Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

COM Standard Library


  • Please log in to reply
669 replies to this topic
  • Guests
  • Last active:
  • Joined: --
I get this COM Error every time i run the script!

Posted Image

jethrow
  • Moderators
  • 2854 posts
  • Last active: May 17 2017 01:57 AM
  • Joined: 24 May 2009
Is there any way to load a New Excel Spreadsheet/WorkBook into a GUI? I know this can be done with a pre-existing .xls file:
Gui, +LastFound +Resize
Gui, Show, Hide
pwb:=COM_AtlAxCreateControl( WinExist(), xls_directory "\Book1.xls" )
pxl:=pwb.document.application
Gui, Show, w500 h500 center, SpreadSheet GUI
return

GuiClose:
	Gui, Destroy
	ExitApp
Can this be done without creating a .xls file first? I've gotten this to work using the OWC.Spreadsheet as the second param in COM_AtlAxCreateControl(), though it isn't consistent with different computers. I also tried using Excel.Sheet, which creates a new Excel Process, but doesn't seem to load it into the GUI. Any advice would be appreciated :) .

tank
  • Administrators
  • 4345 posts
  • AutoHotkey Foundation
  • Last active: May 02 2019 09:16 PM
  • Joined: 21 Dec 2007
page 25
<!-- m -->http://www.autohotke... ... 259#265259<!-- m -->
Never lose.
WIN or LEARN.

hotkeyd
  • Guests
  • Last active:
  • Joined: --
com related post...

I'm trying to access an LDAP server and am getting errors..
Full post on this thread :
http://www.autohotke...409.html#394409

I've posted it there as I've used some of the code from that thread..

Can anyone help ?

Thanks :)

  • Guests
  • Last active:
  • Joined: --

Thats great. I don't use COM much, but that will change if it gets into AHKL.

Thx for your work.



hoppfrosch
  • Members
  • 399 posts
  • Last active: Feb 26 2016 05:31 AM
  • Joined: 25 Jan 2006
I need some clearification:

Since some time Autohotkey_L is merged with Autohotkey32/64 - therefore it offers native COM-support.

Questions in this context:
* Is COM_L-Library still needed for latest Autohotkey(_L) versions?
* If yes:
* What benefit has the library over built-in functions?
* Is there some additional/missing functionality within COM_L-Library, comparing to latest Autohotkey_L?

Perhaps it makes sense to update to initial message in this thread with this information ....

fragman
  • Members
  • 1591 posts
  • Last active: Nov 12 2012 08:51 PM
  • Joined: 13 Oct 2009
You can do most COM - related things without the library. I think there are one or two functions not covered internally yet, but I didn't have to use them yet.

hoppfrosch
  • Members
  • 399 posts
  • Last active: Feb 26 2016 05:31 AM
  • Joined: 25 Jan 2006

You can do most COM - related things without the library. I think there are one or two functions not covered internally yet, but I didn't have to use them yet.


Can you point out, what's not covered?

Is it possible to use COM-Objects without the IDispatch interface without the library? (as Lexikos suggested here: http://www.autohotke...p=425107#425107)

fragman
  • Members
  • 1591 posts
  • Last active: Nov 12 2012 08:51 PM
  • Joined: 13 Oct 2009
The code that Lexikos mentioned in that post is valid, but not very convenient to use. I tried porting such code to x64 once, but failed because I got some addresses wrong. I think I have only used COM objects which support IDispatch (Shell.Application, Schedule.Service, ...)

hoppfrosch
  • Members
  • 399 posts
  • Last active: Feb 26 2016 05:31 AM
  • Joined: 25 Jan 2006

The code that Lexikos mentioned in that post is valid, but not very convenient to use. I tried porting such code to x64 once, but failed because I got some addresses wrong. I think I have only used COM objects which support IDispatch (Shell.Application, Schedule.Service, ...)


**SIGH** There are so many issues to consider with COM and the topic I've chosen, I cannot find a good/any entry point yet. I think I have to go all the long way down from basics of COM to solve my problem ...

Sean
  • Members
  • 2462 posts
  • Last active: Feb 07 2012 04:00 AM
  • Joined: 12 Feb 2007
I suggest to read this thread and the linked thread thoroughly as the start.

Allowing Function Pointer in DllCall: ComCall via DllCall

maul.esel
  • Members
  • 790 posts
  • Last active: Jan 05 2013 09:26 PM
  • Joined: 28 Feb 2011
Hi,

I'm having a question: The library contains a COM_SafeArrayDestroy() function, but not a COM_SafeArrayCreate() function. Why?

I know I could do this with ComObjArray() in AHK_L, but I still would like to support basic if possible.
Could I use SafeArrayCreate or is this just impossible because basic has no built-in array support?

And just to be sure:

pButton [in]

Type: LPTHUMBBUTTON

A pointer to an array of THUMBBUTTON structures.

I would have to pass a result of ComObjArray() or similar for this parameter, true?

Regards
maul.esel
Join the discussion on The future of AutoHotkey
Posted Image Visit me on github Posted Image
Win7 HP SP1 64bit | AHK_L U 64bit

a4u
  • Guests
  • Last active:
  • Joined: --

The library contains a COM_SafeArrayDestroy() function, but not a COM_SafeArrayCreate() function. Why?

Before the built-in SafeArray support of AHK_L, it wasn't really worth-while to directly manipulate a safearray. If you needed to create one, it was much easer to create and return a vbs array using the ScriptControl object. However, here's a post on how to manually build a SafeArray. Also, you may be interested in this thread.

  • Guests
  • Last active:
  • Joined: --

Encouraged by this post, I tried to incorporate COM into AHK myself. It was my first coding in C++, so there could be many I missed/got wrong. It's based on (UNICODE) AutoHotkey_L45 and I also included the altered/new files in the zip.

DOWNLOAD AutoHotkey_COM.

The new functions are:

ComObjActive(ProgId/CLSID [/pdisp/ComObject]) ; <-> COM_GetActiveObject() [/COM_Enwrap()/COM_Unwrap()] 
ComObjCreate(ProgId/CLSID) ; <-> COM_CreateObject() 
ComObjGet(name) ; <-> COM_GetObject() 
ComObjConnect(ComObject [ , prefix]) ; <-> COM_ConnectObject()/COM_DisconnectObject() 
Not all in COM.ahk were translated yet like COM_Parameter/missing params. And instead of producing MsgBox, Invoke will assign its HRESULT to A_LastError, so an user can handle the error himself.

The most notable syntax change was on Enumerate and Connect to event. Now I'd like to demonstrate only about Enumerate, and later for others.

Example: Enumerate
oSet :=   ComObjGet("winmgmts:").ExecQuery("SELECT * FROM Win32_PhysicalMemory") 

oEnum := oSet._NewEnum 
While   oEnum[color=red][[/color]obj[color=red]][/color] 
   MsgBox,   % obj.GetObjectText_ 



EzBlue
  • Members
  • 27 posts
  • Last active: Aug 15 2011 01:05 PM
  • Joined: 14 Feb 2011
I have made a post in the Wish List section...
http://www.autohotke...pic.php?t=72945
It is related with the subject...