How To Click External Listview Item?
Hi all could any one show me how i can click an external list view item . I have the following information about the listview :
hWnd=66310 Class=GradienTreeViewClass
Thanks
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Simulate A Click On An Item In An External Listview
I'm trying to simulate a mouse click on an item in an external listview (syslistview32) from my VB application.
I found out how to get an item highlighted, but it seems I need the actual mouse click simulation to get the effect I need. Anyone know what I'd need to do this?
Any help is very much appreciated
Click Item In Listview Then Show That Item In Combo As Index = 0
Hi guys,
I have a listview (lvwUserPunchedOut) that is populated with records in a database (persons first name in one column and last name in the second column), what I am looking to do is if I select a persons name by clicking on it in the listview on frmMain, and then bring up frmSearchCriteria, i would like to show that selected name in the combobox as default (cboEmployee.ListIndex = 0) on frmSearchCriteria (the combobox is sorted = True and is also populated with first name and last name of the person)
How would this be done? Hope I make sense. Thanks in advance.
Add Item To External Listview.
Bascially i need to insert a new row of text into a listview on another program.
I found this code which seems to add the row:
Quote:
Public Function InsertItem(hwnd As Long, i As Long, ItemText As String, Optional State As Long)
Dim pitem As LVITEM
With pitem
.mask = LVIF_TEXT Or LVIF_STATE
.iItem = i
.pszText = ItemText
.State = 1
.stateMask = LVIS_STATEIMAGEMASK
End With
Call SendMessage(hwnd, LVM_INSERTITEM, 0, pitem)
Call SendMessage(hwnd, LVM_SETITEMSTATE, ByVal i, pitem)
End Function
It added the row, but my text was garbled and once i added a 2nd row the external program crashed.
Also i have looked at "Dr Memory's "CopyListview" Demo ", ( http://www.xtremevbtalk.com/t38276.html ) which is an amazing piece of code. It does the opposite of what i want. But the idea is the same. I tried editing it to do what i need but it crashes the remote program.
I've been workgin on this for weeks now, if anyone can help, please :)
my icq 8036469
msn m.drover@excite.com
Thanks for reading.
-MatthewJ
Select 2nd Item Of External Listview?
Is there an easy way to select the second Item of an external listview.
This is the api of that listview
VB Code:
Dim mywindowclass As Long, wtlsplitterwindow As Long, atlb As LongDim syslistview As Longmywindowclass = FindWindow("my window class", vbNullString)wtlsplitterwindow = FindWindowEx(mywindowclass, 0&, "wtl_splitterwindow", vbNullString)wtlsplitterwindow = FindWindowEx(wtlsplitterwindow, 0&, "wtl_splitterwindow", vbNullString)wtlsplitterwindow = FindWindowEx(wtlsplitterwindow, 0&, "wtl_splitterwindow", vbNullString)atlb = FindWindowEx(wtlsplitterwindow, 0&, "atl:005047b8", vbNullString)syslistview = FindWindowEx(atlb, 0&, "syslistview32", vbNullString)
Thanks
Retrieving Listview Item Texts Frm External App
Hi guys,
I've been searching high and low for some code that allows me to get the item text from an external listview(another program) whose hwnd is known.
I've already read through most of the code regarding this on here with no result, can one of u gurus plz help ?
Probelm Highligting First Item Of External Listview
Hi all i am triyiing to select first item of external listview using code beleow but each time i click on button it does not work. could any one look at this and let me know what i am doing wrong.Thanks
module code:
VB Code:
Option Explicit Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As LongPrivate Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As LongPrivate Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As LongPrivate Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Long, lpdwProcessId As Long) As LongPrivate Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As LongPrivate Declare Function VirtualAllocEx Lib "kernel32" (ByVal hProcess As Long, ByVal lpAddress As Long, ByVal dwSize As Long, ByVal flAllocationType As Long, ByVal flProtect As Long) As LongPrivate Declare Function VirtualFreeEx Lib "kernel32" (ByVal hProcess As Long, lpAddress As Any, ByVal dwSize As Long, ByVal dwFreeType As Long) As LongPrivate Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As LongPrivate Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long Private Type LV_ITEM mask As Long iItem As Long iSubitem As Long state As Long stateMask As Long pszText As String cchTextMax As Long iImage As Long lParam As Long iIndent As LongEnd Type Private Const LVM_FIRST = &H1000&Private Const LVM_SETITEMSTATE = (LVM_FIRST + 43)Private Const LVIF_STATE = &H8&Private Const LVIS_FOCUSED = &H1Private Const LVIS_SELECTED = &H2&Private Const PROCESS_VM_OPERATION = &H8Private Const PROCESS_VM_READ = &H10Private Const PROCESS_VM_WRITE = &H20Private Const PAGE_READWRITE = &H4&Private Const MEM_RESERVE = &H2000Private Const MEM_COMMIT = &H1000Private Const MEM_RELEASE = &H8000 Private hWndlvw As Long Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As LongPrivate Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hWnd As Long) As Long Private Function EnumWindowsProc(ByVal hWnd As Long, ByVal lParam As String) As Long Dim strCaption As String Dim lLen As Long [b] hWnd = 3410942 hWndlvw = FindWindowEx(hWnd, 0&, "My Window Class", "")[/b] ' If we've found a window with the SysListView32 class ' check to see if parent window caption is the one we are looking for If hWndlvw <> 0 Then lLen = GetWindowTextLength(hWnd) If lLen > 0 Then strCaption = Space(lLen) GetWindowText hWnd, strCaption, lLen + 1 End If End If EnumWindowsProc = (hWndlvw = 0 And strCaption <> lParam)End Function ' New example looks for a window with class SysListView32 that is hosted' by a window whose caption matches the contents of strInWindowWithCaptionPublic Function FindListView(strInWindowWithCaption As String) As Long EnumWindows AddressOf EnumWindowsProc, StrPtr(strInWindowWithCaption) FindListView = hWndlvwEnd Function Public Function MessageCrossProcess(ByVal hWnd As Long) Dim lProcID As Long Dim hProc As Long Dim lxprocLVITEM As Long Dim LVITEM As LV_ITEM Dim lItemPos As Long GetWindowThreadProcessId hWnd, lProcID ' Get the process ID in which the ListView is running If lProcID <> 0 Then hProc = OpenProcess(PROCESS_VM_OPERATION Or PROCESS_VM_READ Or PROCESS_VM_WRITE, False, lProcID) ' make sure we have read write permissions in the process space If hProc <> 0 Then lxprocLVITEM = VirtualAllocEx(hProc, 0, LenB(LVITEM), MEM_RESERVE Or MEM_COMMIT, PAGE_READWRITE) ' Grab enough memory in the other procedure's space to hold our LV_ITEM ' Set up our local LV_ITEM to change the selected item LVITEM.mask = LVIF_STATE LVITEM.state = True LVITEM.stateMask = LVIS_SELECTED Or LVIS_FOCUSED ' Just enforcing the selection better than in original version by moving the focus as well ' Copy the local LV_ITEM into the space we reserved in the foreign process WriteProcessMemory hProc, ByVal lxprocLVITEM, ByVal VarPtr(LVITEM), LenB(LVITEM), 0 ' Now send the message, but pass the address of the copy of our LV_ITEM that now exists in the foreign process instead of our local version lItemPos = 0& ' first item SendMessage hWnd, LVM_SETITEMSTATE, lItemPos, ByVal lxprocLVITEM ' Clean up VirtualFreeEx hProc, ByVal lxprocLVITEM, LenB(LVITEM), MEM_RELEASE CloseHandle hProc End If End IfEnd Function
main form code:
VB Code:
Private Sub Command1_Click()MessageCrossProcess FindListView("[b]caption of external window[/b]") End Sub
Problem Selecting First Item Of External Listview
Hi all i got this code that supposed to select and highlight the first item of external list view but unfortuntly when i click the command button it does not do any thing. It seems it can not find the right window . i placed the class name of external listview and caption of the window that holds the listview but no luck. i be happy if an expert tell me how to fix this.Thanks
Code:
Option Explicit
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 Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Long, lpdwProcessId As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function VirtualAllocEx Lib "kernel32" (ByVal hProcess As Long, ByVal lpAddress As Long, ByVal dwSize As Long, ByVal flAllocationType As Long, ByVal flProtect As Long) As Long
Private Declare Function VirtualFreeEx Lib "kernel32" (ByVal hProcess As Long, lpAddress As Any, ByVal dwSize As Long, ByVal dwFreeType As Long) As Long
Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Type LV_ITEM
mask As Long
iItem As Long
iSubitem As Long
state As Long
stateMask As Long
pszText As String
cchTextMax As Long
iImage As Long
lParam As Long
iIndent As Long
End Type
Private Const LVM_FIRST = &H1000&
Private Const LVM_SETITEMSTATE = (LVM_FIRST + 43)
Private Const LVIF_STATE = &H8&
Private Const LVIS_FOCUSED = &H1
Private Const LVIS_SELECTED = &H2&
Private Const PROCESS_VM_OPERATION = &H8
Private Const PROCESS_VM_READ = &H10
Private Const PROCESS_VM_WRITE = &H20
Private Const PAGE_READWRITE = &H4&
Private Const MEM_RESERVE = &H2000
Private Const MEM_COMMIT = &H1000
Private Const MEM_RELEASE = &H8000
Private hWndlvw As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hWnd As Long) As Long
Private Function EnumWindowsProc(ByVal hWnd As Long, ByVal lParam As String) As Long
Dim strCaption As String
Dim lLen As Long
hWndlvw = FindWindowEx(hWnd, 0&, "SysListView32", "")
' If we've found a window with the SysListView32 class
' check to see if parent window caption is the one we are looking for
If hWndlvw <> 0 Then
lLen = GetWindowTextLength(hWnd)
If lLen > 0 Then
strCaption = Space(lLen)
GetWindowText hWnd, strCaption, lLen + 1
End If
End If
EnumWindowsProc = (hWndlvw = 0 And strCaption <> lParam)
End Function
' New example looks for a window with class SysListView32 that is hosted
' by a window whose caption matches the contents of strInWindowWithCaption
Public Function FindListView(strInWindowWithCaption As String) As Long
EnumWindows AddressOf EnumWindowsProc, StrPtr(strInWindowWithCaption)
FindListView = hWndlvw
End Function
Public Function MessageCrossProcess(ByVal hWnd As Long)
Dim lProcID As Long
Dim hProc As Long
Dim lxprocLVITEM As Long
Dim LVITEM As LV_ITEM
Dim lItemPos As Long
GetWindowThreadProcessId hWnd, lProcID ' Get the process ID in which the ListView is running
If lProcID <> 0 Then
hProc = OpenProcess(PROCESS_VM_OPERATION Or PROCESS_VM_READ Or PROCESS_VM_WRITE, False, lProcID) ' make sure we have read write permissions in the process space
If hProc <> 0 Then
lxprocLVITEM = VirtualAllocEx(hProc, 0, LenB(LVITEM), MEM_RESERVE Or MEM_COMMIT, PAGE_READWRITE) ' Grab enough memory in the other procedure's space to hold our LV_ITEM
' Set up our local LV_ITEM to change the selected item
LVITEM.mask = LVIF_STATE
LVITEM.state = True
LVITEM.stateMask = LVIS_SELECTED Or LVIS_FOCUSED ' Just enforcing the selection better than in original version by moving the focus as well
' Copy the local LV_ITEM into the space we reserved in the foreign process
WriteProcessMemory hProc, ByVal lxprocLVITEM, ByVal VarPtr(LVITEM), LenB(LVITEM), 0
' Now send the message, but pass the address of the copy of our LV_ITEM that now exists in the foreign process instead of our local version
lItemPos = 0& ' first item
SendMessage hWnd, LVM_SETITEMSTATE, lItemPos, ByVal lxprocLVITEM
' Clean up
VirtualFreeEx hProc, ByVal lxprocLVITEM, LenB(LVITEM), MEM_RELEASE
CloseHandle hProc
End If
End If
End Function
and the on click event
Code:
Private Sub Command1_Click()
MessageCrossProcess FindListView("Rooms List - Search Results")
End Sub
How To Select/highligh Item From External Listview?
Hi all. i got an external listview in an application. I want create a program that one click of button i select a perticuler item from external listview. i searched every where but i did not find a working example. could any one show me how to select/highlight external listview item.Thanks
Why This Code Doesn't Select External Listview 1st Item?
Well I cant figure why this code does not work all i want to do is select an external listview firts item, this what i have so far:
Module
VB Code:
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPublic Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As LongPublic Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As LongPublic Declare Function SendMessageLong& Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long)Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As LongPublic Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As LongPublic Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As LongPublic Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As LongPublic Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As LongPublic Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As BooleanPrivate Declare Function SendMessageA Lib "user32" (ByVal hwnd As Long, ByVal _wMsg As Long, ByVal wParam As Long, lParam As Any) As LongPrivate Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As LongGlobal lngRhWnd As Long ' global to store handleGlobal strWindowTitle As String ' global to store titleGlobal strClassname As StringPublic Const WM_SETTEXT = &HCPublic Const WM_LBUTTONDOWN = &H201Public Const WM_LBUTTONUP = &H202Public Const VK_SPACE = &H20Public Const WM_KEYDOWN = &H100Public Const WM_KEYUP = &H101Public Const WM_CLOSE = &H10
General
VB Code:
Private Declare Function SendMessageAny Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, _ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Call command
VB Code:
Dim mywindowclass As Long, wtlsplitterwindow As Long, atlb As LongDim syslistview As Longmywindowclass = FindWindow("my window class", vbNullString)wtlsplitterwindow = FindWindowEx(mywindowclass, 0&, "wtl_splitterwindow", vbNullString)wtlsplitterwindow = FindWindowEx(wtlsplitterwindow, 0&, "wtl_splitterwindow", vbNullString)wtlsplitterwindow = FindWindowEx(wtlsplitterwindow, 0&, "wtl_splitterwindow", vbNullString)atlb = FindWindowEx(wtlsplitterwindow, 0&, "atl:005047b8", vbNullString)syslistview = FindWindowEx(atlb, 0&, "syslistview32", vbNullString)SendMessage syslistview32, WM_KEYDOWN, VK_DOWN, 0&SendMessage syslistview32, WM_KEYUP, VK_DOWN, 0&
All the apis seem to be correct is just not highlighting it
Is There A Quicker Way To Select An Item In An External Listview? (see Code Inside)
VB Code:
With myLVitem .mask = LVIF_STATE .state = &HF .stateMask = LVIS_SELECTED Or LVIS_FOCUSED End With dmWriteProcessData lvItemPointer, VarPtr(myLVitem), Len(myLVitem) apiResult = SendMessage(lvWindow, LVM_SETITEMSTATE, 1, lvItemPointer)
is what im currently using to select the item.. but the thing is i have to use SendMessage multiple times to select multiple items.. is there a way to select multiple items using only one sendmessage call?
Listview With Item Right-click
Hello,
I couldn't find a code on internet for listview with the list of the items and the right click. Please can you find to get me the code??
thanks
Listview With Item Right Click
Hello,
I couldn't find a code for listview with the list of the item and the right click. Please can you find to get me the code??
thanks
Select Listview Item By Right Click
I have a listview and I would like the user to be able to select and item by right clicking it and also haveing a popupmenu. I have it so if they first left click on it then right click it would work, but I want to have it so they are able to just right click and have the menu apear. Here is the code that I have so far.
If Button = 2 Then
Dim aPt As POINTAPI
Dim anInd As Long
GetCursorPos aPt
With viewEntry
.SelectedItem.Index = LBItemFromPt(.hwnd, aPt.X, aPt.Y, False)
End With
PopupMenu DepClick
End If
This isn't working right because I tried to port it from a listbox. Any help would be great, thanks.
Listview - Right Click On Main Item.
How would I right-click on a listview's main item and make it show a menu via popupmenu?
So let's say I am showing a directory list using a listview and I right click on a file and it shows file options (rename, del, copy). How would I do that? It is kind of like explorer's view. I will include an image.
Right-Click Select Item In ListView
Hi. How can I program a ListView so that when the user right-clicks on it, the corresponding item is selected just as if the user had left-clicked? I thought of the SendMessage API but then how do I convert the X and Y values from the ListView's MouseDown event into an lParam value? i.e. how do i do the opposite of extracting High and Low-Order words?
Thanks in advance.
ListView: Click On Item By Code
hi all
with the ListView in report mode
how can I make an 'item click' by program code? [I want the
background to go blue]
I have tried calling listview_itemclick and _click but
they do not make the list item go blue backround ....
Listview Item Click Grrrrrr!!!!!!!!!!!
Okay I have a list control on a form. I fill the list view with files and subdirectorys in a folder. Fairly straight forward
when a user clicks on a subfoder it clears the listview and then shows files and subfolders of that folder (sound familiar ) however it now has somehow activated the mousedown event on the first item in the list and as soon as you move the mouse it drags it all over the show. Then if you click to deselect it.. it fires of my click event again on the item.
How can I stop this from happening
PS I tried putting item.selected = false at the end of the code in the item click event but becuase for a subfolder it clears and refills the listview I just recieve an error
HELP PLEASE
Capturing A Double-click On A ListView Item
How would I go about detecting double clicks on ListView items? I've looked at the DblClick, ItemClick and Mousedown events, but it seems the only way I can effectively do it is detect a single click and then use a timer with a short interval and wait to see if another click event occurs within the interval (very long-winded, in other words). Come on, Windows uses it all the time, there HAS to be an easier way...
Listview: Arrow Keys Do Item Click
with the listview control (report mode)
when I move (from the selected item) up or down the list using the arrow keys it immediately causes an item_click event.
how do I stop this happening. I only want item_click to occur
when mouse is clicked on item
How Add Listview Item To Clip Board On Click Of A Button
hi all. i got a listview that loads sentences from a text file . I want to create a button so that it once clicked it copies the current select listview item to clip board.When next time the button is clicked it goes copies the next listview item and so on. could any one show me how this can be done?Thanks
Note: i want the listview item hightlight move to next item item as i click the button each time.
Right-click Menu And Sending Left Click To Item
Can anyone tell me how I can use insert a right-click menu into my program so that when the user has selected a file (in a file list) and right-clicks, a menu appears at the location of the mouse pointer. I aleady know how to use the PopupMenu function to show a menu as I suppose that will need to be used, I just don't know how to capture a right-click mouse event and also use the position of the mouse pointer to show the menu.
Thanks in advance!
Select Combobox Item In External App
I get the hwnd of the combobox in question then execute this code:
Code:
If lngHwnd <> 0 Then
lngRetVal = SendMessage(lngHwnd , CB_FINDSTRINGEXACT, 0,objCust.Salutation)
If lngRetVal <> CB_ERR Then
lngRetVal = SendMessage(lngHwnd , CB_SETTOPINDEX, 0, lngRetVal)
Else
'I can't do anything about this I'm afraid.
End If
End If
The findstringexact message is returning index 4 which is correct for my combo, however the CB_SETTOPINDEX message does nothing???? What am I missing?
Cheers.
How To Select External Menue Item?
Hi all . Could any one show me how i can select menue item from external meues in diffrent application. I have shown what i want in pic.Thanks
Selecting Item From External Listbox
Hi there,
I'm in the same boat as member 'Pubulis', in that I posted this question to the API forum, however unfortunately no-one has been able to help me. Hopefully you more 'General' guys will ba able to help me here, (
(Please excuse any spelling errors that may follow due to large quantities on 'Stella Artois'?!?!?!?!?!?? )
I am writing some VB code that will automatically start up
a third party application.
When this third party application starts up, the user would
normally select two things - a session, followed by an
environment.
I can automatically select the session by passing in a
command-line parameter, however I am not sure how to go
about selecting an environment.
The environment options are listed in a ListBox control and
I have used the FindWindow & FindWindowEx API's, to get the
handle of this listbox
Can anyone tell me how to select an item from the Listbox
so the third party application starts-up completely.
Here is the code I have come up with so far....
Code:
Private Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hwndParent As Long, ByVal hwndChildAfter As Long, ByVal lpszClass As Any, ByVal lpszWindow As Any) As Long
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As Any, ByVal lpWindowName As Any) As Long
Dim RetVal
'Start up the Third Party application, passing in a Command-Line parameter
RetVal = Shell("C:INFOCONNACCMGRACCMGR.EXE C:INFOCONNACCMGRENV1.XWP", 3)
'At this point the application has started and a session has been
'selected automatically. Now there is a listbox of available
'environments to choose from.
'Attempt to locate a window called "Select INFOConnect Path"
Dim hWnd As Long
hWnd = FindWindow(CLng(0), "Select INFOConnect Path")
If hWnd <> 0 Then
'The window "Select INFOConnect Path" has been found.
'Now look for the Listbox control
Dim hWndListBox As Long
hWndListBox = FindWindowEx(hWnd, 0, "ListBox", CLng(0))
If hWndListBox <> 0 Then
'ListBox has been found
'This is where I want to select an environment so
'that the application will start up completely
'without any interference from the user.
End If
End If
Thanks for your time. Any help would be much appreciated.
__________________
Selecting An Item In A List Box In An External Program
Hello,
I am currently working on writing a program for work, and I have come across something that I dont know exactly how to do.
The program that I am working with runs while another program is running. The program I am writing is to "use" (act as a person using the program itself) the other program.
The program that this program is interfacing with and using has a big list box with a few thousand entries in it. This list box allows multiple items in it to be selected at once.
The problem at the moment is that a actual human has to look at an excel list, and then find these entries in this big list box, hold down the control button and click all of the items in the list that are on the excel sheet. What I am hoping to do is create a program that will read the excel sheet, get the contents of this list box, and then select the items in the list box that are also on the excel sheet.
I know how to do all the code so far except for the part of selecting the items in the actual list box.
Since the program that I need to select the item in the list box in is an external program (its not the program that I am coding, its the one I am coding this program to modify) I assume that in order to select the item I will have to use some sort of API code.
Any person that can help me out with this (tell me the API that I could use, give me a code example, whatever) to select an item in a list box in an external program, would be VERY appreciated.
Thanks a million,
John
Selecting An Item In A List Box In An External Program
Hello,
I am currently working on writing a program for work, and I have come across something that I dont know exactly how to do.
The program that I am working with runs while another program is running. The program I am writing is to "use" (act as a person using the program itself) the other program.
The program that this program is interfacing with and using has a big list box with a few thousand entries in it. This list box allows multiple items in it to be selected at once.
The problem at the moment is that a actual human has to look at an excel list, and then find these entries in this big list box, hold down the control button and click all of the items in the list that are on the excel sheet. What I am hoping to do is create a program that will read the excel sheet, get the contents of this list box, and then select the items in the list box that are also on the excel sheet.
I know how to do all the code so far except for the part of selecting the items in the actual list box.
Since the program that I need to select the item in the list box in is an external program (its not the program that I am coding, its the one I am coding this program to modify) I assume that in order to select the item I will have to use some sort of API code.
Any person that can help me out with this (tell me the API that I could use, give me a code example, whatever) to select an item in a list box in an external program, would be VERY appreciated.
Thanks a million,
John
How To Get All List Item From A Listbox Of An External Program?
I want my program to get all the list item from a listbox of an external/another program and transfer it to my program's listbox. The external/another program have a two listbox and also my own program. How can I programmed it? And it is possible to automatically add item to my listbox when the listbox of the external program add another item to the listbox? Thanks in advanced.
Selecting An Item In A List Box In An External Program
Hello,
I am currently working on writing a program for work, and I have come across something that I dont know exactly how to do.
The program that I am working with runs while another program is running. The program I am writing is to "use" (act as a person using the program itself) the other program.
The program that this program is interfacing with and using has a big list box with a few thousand entries in it. This list box allows multiple items in it to be selected at once.
The problem at the moment is that a actual human has to look at an excel list, and then find these entries in this big list box, hold down the control button and click all of the items in the list that are on the excel sheet. What I am hoping to do is create a program that will read the excel sheet, get the contents of this list box, and then select the items in the list box that are also on the excel sheet.
I know how to do all the code so far except for the part of selecting the items in the actual list box.
Since the program that I need to select the item in the list box in is an external program (its not the program that I am coding, its the one I am coding this program to modify) I assume that in order to select the item I will have to use some sort of API code.
Any person that can help me out with this (tell me the API that I could use, give me a code example, whatever) to select an item in a list box in an external program, would be VERY appreciated.
Thanks a million,
John
Problem Selecting Floating Menu Bar Item In External App?
Hi all i am trying to use this code to select floating menu bar item but it does not work.could any one help me fix it. The floating menu bar is already visable ! See the pic attached if that is floating menue or reguler menue?.Thanks
VB Code:
Private Declare Function GetMenu Lib "user32" (ByVal hWnd As Long) As LongPrivate Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long'Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPrivate Declare Function GetMenuItemID& Lib "user32" (ByVal hMenu As Long, ByVal nPos _ As Long) Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _(ByVal lpClassName As String, ByVal lpWindowName As String) As LongPrivate Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As LongConst WM_COMMAND = &H111Private Sub Command1_Click()Dim hMenu As Long, hSubMenu As Long 'get the handle of the current menu Dim ptwnd As Long 'ptwnd = FindWindow("My Window Class", vbNullString)[b] ptwnd = FindWindow("#32768", vbNullString)[/b] hMenu = GetMenu(ptwnd) 'get the handle of the first submenu [b]hSubMenu = GetSubMenu(hMenu, 0)[/b] 'initialize the structure ItemID = GetMenuItemID(hSubMenu, 2) PostMessage ptwnd, WM_COMMAND, ItemID, 0End Sub
Mouse Click On External Program
ok here is my code
Private Sub cmdGo_Click()
Call SetCursorPos(530, 180)
Timer1.Enabled = True
End Sub
Private Sub cmdQuit_Click()
End
End Sub
Private Sub Timer1_Timer()
SendKeys ("Password")
Timer1.Enabled = False
End Sub
i am making an auomated program which runs throught an external program's login screen but i need someone to tell me how i can include a mouse click or send the key 'Enter' to press the ok button. Please dont refer me to another thread or url. Explain Please.
How To Send A Click In An External Application?
How do I program to send a click in an external application even if the external application is not on top window. What I wanted to click is not a button and I most used postmessage not sendmessage 'cause when what I wanted to click is clicked it sometimes produce a messagebox and I wanted my program to know it message box appear so I used postmessage.
I used:
PostMessage(hChild, WM_LBUTTONDOWN, 0, 0)
PostMessage(hChild, WM_LBUTTONUP, 0, 0)
but this will only click the external application if some portion of the hChild control is seen in the screen. It will not send a click if portion of the hchild control is not seen.
Please help
External App Menu Click Code
Using the InsertMenu, GetMenu and FindWindow API's, I've successfully managed to add a new menu item to an external application (in this case, Notepad). But, what I don't know how to do is add the code that will make the menu item do something when I click it.
Any ideas?
Detect Double-Click On External Program
I am trying to detect a double-click on an external program but the following is not working.
Timer1.interval = 1
Code:
Option Explicit
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Const WM_LBUTTONDBLCLK = &H203
Private Const WM_RBUTTONDBLCLK = &H206
Private Sub Timer1_Timer()
If GetAsyncKeyState(WM_LBUTTONDBLCLK) Then MsgBox GetAsyncKeyState(WM_LBUTTONDBLCLK) & " Left Button Double-Click"
If GetAsyncKeyState(WM_RBUTTONDBLCLK) Then MsgBox GetAsyncKeyState(WM_RBUTTONDBLCLK) & " Right Button Double-Click"
End Sub
I found from this post.
http://www.vbforums.com/showthread.p...e+click+detect
How To Load External .exe Application And Click A Button
HI all i got an .exe applicaton which is mssanger and i want to load it on click of button and click on one of its button that logins me in all on click of one button. But i do not know how to do this. i be happy if some show me how i can do this.Thanks
Button Click On External Application (RESOLVED)
I was wondering if it is possible to create a VB program that can handle a button click on an external application. If so, how would I go about doing this?
Thanks!
Edited by - jseal on 4/21/2006 4:09:52 AM
Single-click Vs. Double-click On Listview
Hey gang, can you help me on this one?
In my listview, if the user clicks an item, I basically don't want to do anything (the item that they clicked will be the current "SelectedItem" which can be used when needed).
However, if they double-click an item, I want that to act as a "shortcut" to an Update command.
Bottom line - how do I manage both single and double-click events?
|