Jump to content

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

Exec Litestep Bangs From AHK [dll]


  • Please log in to reply
29 replies to this topic
savage
  • Members
  • 207 posts
  • Last active: Jul 03 2008 03:12 AM
  • Joined: 02 Jul 2004
bang.dll

This is a small dll for using litestep bang commands from ahk. Sorry, nothing more than executing is possible for now. Use the loadlibrary function as well, and you can call bang commands as fast as if they were called from within a litestep module.

Use it like this:

DllCall("bang.dll\fnbang", "str", "!alert", "str", "w00t it's from ahk!", "cdecl")

And that's it. Very very handy if you use litestep. It lets you basically replace litestep's (decent) hotkey modules with (100% kickass) ahk. Hooray for dllcall!

savage
  • Members
  • 207 posts
  • Last active: Jul 03 2008 03:12 AM
  • Joined: 02 Jul 2004
I recompiled it with mingw - it's about a third of the size now.

savage
  • Members
  • 207 posts
  • Last active: Jul 03 2008 03:12 AM
  • Joined: 02 Jul 2004
God I hate the internet. Starting about the time I posted this, I started getting really really lame hacking attempts on my server. Well, if any of the involved parties reads this, I'm banning your ips in the firewall and emailing your hostmaster to report you. Hooray.

Smurth
  • Members
  • 120 posts
  • Last active: Feb 23 2014 09:58 PM
  • Joined: 13 Dec 2006
Hi,

I'd really like to use this "bang.dll" but the link is dead and googleing doesn't give much result.
Does anyone have this dll somewhere ?

madrano
  • Members
  • 2 posts
  • Last active: Dec 19 2009 12:51 PM
  • Joined: 23 Aug 2008
yes please

tnl
  • Members
  • 5 posts
  • Last active: May 22 2011 10:54 AM
  • Joined: 15 Jun 2009
Hi Smurth. ltns

Here's a native AHK version:
; After failed DllCall attempts this works.
StringCopy(ByRef dst, offset, ByRef src) {
  Loop, Parse, src
    NumPut(Asc(A_LoopField), dst, offset + A_Index-1, "Char")
}

Bang(command) {
  if pos := InStr(command, " ")
  {
    bang := SubStr(command, 1, pos - 1)
    args := SubStr(command, pos + 1)
  }
  else
  {
    bang := command
    args := ""
  }

  ;MAX_BANGCOMMAND = 64
  ;MAX_BANGARGS = 256
  ;struct _LMBANGCOMMANDA
  ;{
  ;  UINT cbSize;
  ;  HWND hWnd;
  ;  CHAR szCommand[MAX_BANGCOMMAND];
  ;  CHAR szArgs[MAX_BANGARGS];
  ;}

  VarSetCapacity(lmbc, 4+4+64+256, 0)
  NumPut(4+4+64+256, lmbc, 0)
  NumPut(0, lmbc, 4)
  StringCopy(lmbc, 4+4, bang)
  StringCopy(lmbc, 4+4+64, args)

  ;COPYDATASTRUCT
  VarSetCapacity(cds, 12, 0)
  ;LM_BANGCOMMAND = 9420
  NumPut(9420, cds, 0)
  NumPut(4+4+64+256, cds, 4)
  NumPut(&lmbc, cds, 8)

  dhw := A_DetectHiddenWindows
  DetectHiddenWindows On
  ;WM_COPYDATA = 0x4A
  SendMessage, 0x4A, 0, &cds,, LiteStep ahk_class TApplication
  ret := ErrorLevel
  DetectHiddenWindows %dhw%
  return ret
}

Bang("!alert Moo $USERNAME$")


Smurth
  • Members
  • 120 posts
  • Last active: Feb 23 2014 09:58 PM
  • Joined: 13 Dec 2006
Thanks tnl; works fine :wink:

budRich
  • Members
  • 146 posts
  • Last active: Aug 03 2015 08:33 PM
  • Joined: 09 Aug 2011

I've been using tnl's bang code for years, but it doesn't work with AHK 1,1 U64, and it's the only thing holding me back from going all U64. I have no idea how to make the code work, any help is welcome.



HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008

Try this:

StringCopyA(ByRef dst, offset, ByRef src) {
  Loop, Parse, src
    NumPut(Asc(A_LoopField), &dst, offset + (A_Index-1),"Char")
}

Bang(command) {
static bang,args,MAX_BANGCOMMAND := 64,MAX_BANGARGS := 256,init := VarSetCapacity(bang,MAX_BANGCOMMAND) VarSetCapacity(args,MAX_BANGARGS)
   StrPut((pos := InStr(command, " ")) ? SubStr(command, 1, pos - 1) : command,&bang,"CP0")
  ,StrPut(pos?SubStr(command, pos + 1):"",&args,"CP0")
  ;MAX_BANGCOMMAND = 64
  ;MAX_BANGARGS = 256
  ;struct _LMBANGCOMMANDA
  ;{
  ;  UINT cbSize;
  ;  HWND hWnd;
  ;  CHAR szCommand[MAX_BANGCOMMAND];
  ;  CHAR szArgs[MAX_BANGARGS];
  ;}

  VarSetCapacity(lmbc,sz := 4+A_PtrSize+MAX_BANGCOMMAND+MAX_BANGARGS, 0)
  NumPut(sz, lmbc, 0, "UInt")
  NumPut(0, lmbc, 4, "UInt")
  StringCopyA(lmbc, 4+A_PtrSize, bang)
  StringCopyA(lmbc, 4+A_PtrSize+MAX_BANGCOMMAND, args)

  ;COPYDATASTRUCT
  VarSetCapacity(cds, A_PtrSize*2 + 4, 0)
  ;LM_BANGCOMMAND = 9420
  NumPut(9420, cds, 0, "UInt")
  NumPut(sz, cds, A_PtrSize, "UInt")
  NumPut(&lmbc, cds, A_PtrSize + 4)

  dhw := A_DetectHiddenWindows
  DetectHiddenWindows On
  ;WM_COPYDATA = 0x4A
  SendMessage, 0x4A, 0, &cds,, LiteStep ahk_class TApplication
  ret := ErrorLevel
  DetectHiddenWindows %dhw%
  return ret
}

Bang("!alert Moo $USERNAME$")


budRich
  • Members
  • 146 posts
  • Last active: Aug 03 2015 08:33 PM
  • Joined: 09 Aug 2011

Thanks for taking the time HotKeyIt, but it still doesn't work with Unicode builds. ANSI however, works.



HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008

Try above again.



budRich
  • Members
  • 146 posts
  • Last active: Aug 03 2015 08:33 PM
  • Joined: 09 Aug 2011

Nope, still doesn't work.



budRich
  • Members
  • 146 posts
  • Last active: Aug 03 2015 08:33 PM
  • Joined: 09 Aug 2011

Nope, still not working with U64/32.



HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008

So it does work with ANSI 64/32?



HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008

I thing I got it now, please try again. I had not realized that structure is ANSI :(