|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 | |
|
Member (10 bit)
|
Need some help with a Visual Basic problem
Hi there, I'm trying to get around a problem with a bit of software called Sweetlight where it controls something through an external smartbox. The problem is that I have to click a few buttons in the program and i'm looking at a way to automate this (like on a timer), and i've found out that I can assign the buttons to keystrokes in their configuration software, so while the program is open pressing the key 'A' on the keyboard would trigger sequence A in their program, 'B' for B etc.
Recently, this was posted on their forum (www.sweetlight-controller.com) and it's in C, so i'm not famailiar at all with it Quote:
Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Type COPYDATASTRUCT
dwData As Long
cbData As Long
lpData As Long
End Type
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_COPYDATA = &H4A
Const MACRO1_ON = 101
Const MACRO2_ON = MACRO1_ON + 1
...
Const MACRO35_ON = MACRO34_ON + 1
Dim Window As Long
Dim cds As COPYDATASTRUCT
Dim message_out As String
Window = FindWindow(vbNullString, "user screen")
If Window <> vbNull Then
cds.dwData = MACRO1_ON
message_out = StrConv("ext prog", vbFromUnicode)
cds.lpData = StrPtr(message_out)
cds.cbData = LenB(message_out) + 1
SendMessage Window, WM_COPYDATA, vbNull, cds
End If
Thanks
__________________
Intel Core i7 920 2.66GHz | Asus P6T SE| 6GB Corsair ram | XFX Radeon HD 4780 | 2 x 250 Gb Maxtor SATA II (in RAID 0), 1 x 250GB SATA II | Creative XFI soundcard | Coolermaster 650W PSU | ThermalTake Tsunami case My new website -Carp Fishing Forums |
|
|
|
|
|
|
#2 |
|
Member (10 bit)
|
Oh well I finally found the answer to this by myself, just thought i'd post it so everyone else knows.
Code:
AppActivate ("user screen")
SendKeys ("a"), wait
Quite straightforward in the end, lol it's just taken me about 8 months to do it though Last edited by Designer; 11-21-2004 at 04:58 AM. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|