Home > Back-end >  How listbox is selected in the third party programs
How listbox is selected in the third party programs

Time:10-11

I have a third party of the RR. Exe, after opening a listbox, including DDC/USB/RS232 Connection option, there is a "Connection" button, I am going to put the software embedded in their application, open the RR with WinExec. Exe is normal, with handle to the window and the listbox and Findwindow find the Connection handle, use Sendmessage (HWNDlistbox LB_SETCURSEL, 1, 0) to the USB cursor can display properly to the USB option, then Sendmessage (HWNDConnection BM_CLICK, 0, 0), but unable to connect,
Using hand connection is possible, or in the Sendmessage (HWNDlistbox LB_SETCURSEL, 1, 0) and then manually click of the mouse USB connection is normal again, don't know the listbox use handle how to select the USB?

CodePudding user response:

What the RR. Exe, pass it to Chou Chou try

CodePudding user response:

Try the LB_SETSEL:
 Sendmessage (HWNDlistbox LB_SETSEL, TRUE, 2);//selected ListBox row 3 

CodePudding user response:

Tried, no,

CodePudding user response:

Just to make wrong, should LB_SETCURSEL news,

 SendMessage (ListBox1 - & gt; Handle, LB_SETCURSEL, 2, 0);//on the third line Item 

CodePudding user response:

LB_SETSEL and LB_SETCURSEL with the UpdateWindow,
Use LB_GetCURSEL discovery from 0 to 2, but still won't do, should be a message didn't return to the main window,
Have that to use win32api. SendMessage (PCB_handle, win32con WM_COMMAND, 0 x90000, CB_handle)
17. Win32api. SendMessage (PCB_handle, win32con WM_COMMAND, 0 x10000, CB_handle)
But I don't compile in the past

CodePudding user response:

Compile directly not sure, need to revise the:
 SendMessage (HWNDlistbox WM_COMMAND, 0 x90000, (LPARAM) HWNDlistbox); 
SendMessage (HWNDlistbox, WM_COMMAND, 0 x10000, (LPARAM) HWNDlistbox);

CodePudding user response:

Or no, I don't know what reason?

CodePudding user response:

have so magical? Put your code to Chou Chou, are you sure the ListBox get to handle success?

CodePudding user response:

If (WinExec (" D: \ \ RLS_2_2_52_0 \ \ LoggingTool exe ", SW_SHOW) & lt; 31)
{
//ShowMessage (" LOG TOOL OPEN SUCCESS ");
}
The HWND MainWin;
Sleep(1000);
MainWin=FindWindow (0, "LoggingTool [Build: Dec 23 2013 17:53:54]");

/* if (MainWin!=NULL)
{
ShowMessage (" logging tool, find ");
ShowMessage (IntToStr (MainWin));
}
*/
HWND m_hListBox=FindWindowExA (MainWin, NULL, "ListBox", NULL);

M_hListBox=FindWindowExA (MainWin m_hListBox, ListBox, NULL);
/* if (m_hListBox!=NULL)
{
ShowMessage (" m_hListBox find ");
ShowMessage (IntToStr (m_hListBox));
} */
//int count=: : SendMessage (m_hListBox LB_GETCURSEL, 0, 0).
//ShowMessage (count);
: : SendMessage (m_hListBox LB_SETCURSEL, 1, 0);
: : SendMessage (m_hListBox BM_CLICK, 1, 0);

: : SendMessage (m_hListBox LB_SETSEL, true, 1);
: : SendMessage (MainWin LBN_SELCHANGE, 1, 0);
UpdateWindow;

: : SendMessage (m_hListBox WM_COMMAND, 0 x90000, (LPARAM) m_hListBox);
: : SendMessage (m_hListBox WM_COMMAND, 0 x10000, (LPARAM) m_hListBox);
: : SendMessage (MainWin WM_COMMAND, 0 x90000, (LPARAM) m_hListBox);
: : SendMessage (MainWin WM_COMMAND, 0 x10000, (LPARAM) m_hListBox);
Sleep(1000);
HWND GetConnection=FindWindowExA (MainWin, NULL, "Button", "GetConnection");
: : SendMessage (GetConnection, BM_CLICK, 0, 0);
//Sleep (10000);

//HWND LumEDIT=FindWindowExA (MainWin, NULL, "Edit", NULL);
/* if (LumEDIT!=NULL)
{
ShowMessage (" LumEDIT find ");
ShowMessage (IntToStr (LumEDIT));
} */
//AnsiString ee="200";
//: : SendMessage (LumEDIT, WM_SETTEXT, 20, (LPARAM) ee. C_str ());



//HWND SetBtn=FindWindowExA (MainWin, NULL, "Button", "Set");
/* if (SetBtn!=NULL)
{
ShowMessage (" SetBtn find ");
ShowMessage (IntToStr (SetBtn));
} */


CodePudding user response:

Suggest you use winsight find handle try sending a message

CodePudding user response:

I wrote a listbox program, listbox is 0,1,2,3 respectively, listbox onclick event for which the item is selected, it showmessage item value, and then I use the method of putting findwindow with other program window handle, listbox handle,
LB_SETCURSEL LB_SETSEL, then the program can normal popup showmessage item value,
But customers to RR, exe is not, depressed,

CodePudding user response:

What are the rr. Exe for, it's convenient for compression send my E-mail,

CodePudding user response:

Demon elder brother, mail it's convenient to you? Thank you very much!
  • Related