Skip to content

Select Nick On Paltalk Listview Code FInally :)

Viewing 15 posts - 76 through 90 (of 94 total)
  • Author
    Posts
  • #188663

    do you know how to declare a function for your class?

    example like this in your myclassdlg.h

     

    public:
    int GetPosByNick(CString szNick);
    
    and in your file example myclassdlg.ccp
    int myclassdlg::GetPosByNick(CString szNick)
    {
    
    HWND hList=NULL; // List View identifier
    
    HWND parent,child;
    parent=NULL;
    child=NULL;
    parent = ::FindWindow("My Window Class",NULL);
    
    child =::FindWindowEx(parent,0,"WTL_SplitterWindow",NULL);
    child =::FindWindowEx(child,0,"WTL_SplitterWindow",NULL);
    child =::FindWindowEx(child,0,"WTL_SplitterWindow",NULL);
    child =::FindWindowEx(child,0,"ATL:0053C8D0",NULL);
    hList=::FindWindowEx(child,0,"SysListView32",NULL);
    
    HWND hwnd=parent;
    HWND listview=hList;
    
    int count=(int)::SendMessage(listview, LVM_GETITEMCOUNT, 0, 0);
    int i;
    
    LVITEM lvi, *_lvi;
    char item[512];
    char *_item;
    unsigned long pid;
    HANDLE process;
    
    GetWindowThreadProcessId(listview, &pid);
    process=OpenProcess(PROCESS_VM_OPERATION|PROCESS_VM_READ|PROCESS_VM_WRITE|PROCESS_QUERY_INFORMATION, FALSE, pid);
    
    _lvi=(LVITEM*)VirtualAllocEx(process, NULL, sizeof(LVITEM), MEM_COMMIT, PAGE_READWRITE);
    
    _item=(char*)VirtualAllocEx(process, NULL, 512, MEM_COMMIT, PAGE_READWRITE);
    
    lvi.cchTextMax=512;
    
    for(i=0; i
    
    

     

    and in your button click do like this

    HWND listview=NULL; // List View identifier
    HWND parent,child;
    parent=NULL;
    child=NULL;
    parent = ::FindWindow("My Window Class",NULL);
    
    child =::FindWindowEx(parent,0,"WTL_SplitterWindow",NULL);
    child =::FindWindowEx(child,0,"WTL_SplitterWindow",NULL);
    child =::FindWindowEx(child,0,"WTL_SplitterWindow",NULL);
    child =::FindWindowEx(child,0,"ATL:0053C8D0",NULL);
    listview=::FindWindowEx(child,0,"SysListView32",NULL);
    //UpdateData(true);//update content of textbox to m_nick variable
    //::AfxMessageBox(m_nick);
    int pos=-1;
    pos =GetPosByNick("yournicktohighlighthere");
    LVITEM lvi, *_lvi;
    unsigned long pid;
    HANDLE process;
    
    GetWindowThreadProcessId(listview, &pid);
    process=OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE, FALSE, pid);
    if(process)
    {
    
    _lvi=(LVITEM*)VirtualAllocEx(process, NULL, sizeof(LVITEM), MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE);
    lvi.mask = LVIF_STATE;
    lvi.state =15;
    lvi.stateMask = LVIS_SELECTED | LVIS_FOCUSED;
    if(pos==-1)
    pos=0;
    WriteProcessMemory(process, _lvi, &lvi, sizeof(LVITEM), NULL);
    ::SendMessage(listview, LVM_SETITEMSTATE, (WPARAM)pos, (LPARAM)_lvi);
    VirtualFreeEx(process, _lvi, 0, MEM_RELEASE);
    }
    ::CloseHandle(process);

     

    that’s it, that’s all hope is clear for you

    #188662
    method
    Member

    nano i made a new mfc project and just dragged a button and edit box . Now what should i do next? How and where to place your code ? i attached a pic.Thanks

    #188661

    in your file FindUserDlg.h

    add these lines

     

    public:
    int GetPosByNick(CString szNick);
    
    and in FindUserDlg.ccp
    
    add these lines
    int FindUserDlg::GetPosByNick(CString szNick)
    {
    
    HWND hList=NULL; // List View identifier
    
    HWND parent,child;
    parent=NULL;
    child=NULL;
    parent = ::FindWindow("My Window Class",NULL);
    
    child =::FindWindowEx(parent,0,"WTL_SplitterWindow",NULL);
    child =::FindWindowEx(child,0,"WTL_SplitterWindow",NULL);
    child =::FindWindowEx(child,0,"WTL_SplitterWindow",NULL);
    child =::FindWindowEx(child,0,"ATL:0053C8D0",NULL);
    hList=::FindWindowEx(child,0,"SysListView32",NULL);
    
    HWND hwnd=parent;
    HWND listview=hList;
    
    int count=(int)::SendMessage(listview, LVM_GETITEMCOUNT, 0, 0);
    int i;
    
    LVITEM lvi, *_lvi;
    char item[512];
    char *_item;
    unsigned long pid;
    HANDLE process;
    
    GetWindowThreadProcessId(listview, &pid);
    process=OpenProcess(PROCESS_VM_OPERATION|PROCESS_VM_READ|PROCESS_VM_WRITE|PROCESS_QUERY_INFORMATION, FALSE, pid);
    
    _lvi=(LVITEM*)VirtualAllocEx(process, NULL, sizeof(LVITEM), MEM_COMMIT, PAGE_READWRITE);
    
    _item=(char*)VirtualAllocEx(process, NULL, 512, MEM_COMMIT, PAGE_READWRITE);
    
    lvi.cchTextMax=512;
    
    for(i=0; i<count; i++)="" {="" lvi.isubitem="2;" lvi.psztext="_item;" writeprocessmemory(process,="" _lvi,="" &lvi,="" sizeof(lvitem),="" null);="" ::sendmessage(listview,="" lvm_getitemtext,="" (wparam)i,="" (lparam)_lvi);="" readprocessmemory(process,="" _item,="" item,="" 512,="" _subitem,="" subitem,="" if(item="=szNick)" virtualfreeex(process,="" 0,="" mem_release);="" ::closehandle(process);="" return="" i;="" }="" -1;="" }<="" pre="">

     

    and other snippet code put them in button click

    #188660

    try to get vs2005 and I can do some demo for whatever you want if i can. It’s too hard for me to help you like now.

    #188659
    method
    Member

    Nano thank u for u nice explantion. In few days i will install visual studio 2005 express edtion. My hardrive is full i can not install it now. I tried your code and i got the following compile error:

    Configuration: FindUser - Win32 Debug
    
    Compiling...
    FindUser.cpp
    c:visualcfinduserfinduserdlg.h(12) : error C2143: syntax error : missing ';' before 'public'
    FindUserDlg.cpp
    c:visualcfinduserfinduserdlg.h(12) : error C2143: syntax error : missing ';' before 'public'
    C:visualCFindUserFindUserDlg.cpp(15) : error C2653: 'FindUserDlg' : is not a class or namespace name
    Generating Code...
    Error executing cl.exe.
    
    FindUser.exe - 3 error(s), 0 warning(s)

     

    i doubleed clickd on the button and placed the shown code there:

    Here are the errors :

    next error

    how to use value of textbox instead of yournicktohighlighthere

    pos =GetPosByNick(“yournicktohighlighthere”);

    #188658

    the content of your finduserdlg.h must similar like thic pic

    #188657
    method
    Member

    I changed the content of finduserdlg.h and now i got one error:

    error :

     

    Configuration: FindUser - Win32 Debug
    
    Compiling...
    FindUser.cpp
    FindUserDlg.cpp
    C:visualCFindUserFindUserDlg.cpp(15) : error C2653: 'FindUserDlg' : is not a class or namespace name
    Generating Code...
    Error executing cl.exe.
    
    FindUser.exe - 1 error(s), 0 warning(s)

     

    pointing at :

    int FindUserDlg::GetPosByNick(CString szNick) {

    in FindUserDlg.cpp : implementation file

    error pic:

    finduserdlg.h content

    // FindUserDlg.h : header file
    //
    
    #if !defined(AFX_FINDUSERDLG_H__8EF5BE4C_79B2_4F61_B376_E2A019C98B9C__INCLUDED_)
    #define AFX_FINDUSERDLG_H__8EF5BE4C_79B2_4F61_B376_E2A019C98B9C__INCLUDED_
    
    #if _MSC_VER > 1000
    #pragma once
    #endif // _MSC_VER > 1000
    
    /////////////////////////////////////////////////////////////////////////////
    // CFindUserDlg dialog
    
    class CFindUserDlg : public CDialog
    {
    // Construction
    public:
    CFindUserDlg(CWnd* pParent = NULL); // standard constructor
    
    // Dialog Data
    //{{AFX_DATA(CFindUserDlg)
    enum { IDD = IDD_FINDUSER_DIALOG };
    // NOTE: the ClassWizard will add data members here
    //}}AFX_DATA
    
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CFindUserDlg)
    protected:
    virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
    //}}AFX_VIRTUAL
    
    // Implementation
    protected:
    HICON m_hIcon;
    
    // Generated message map functions
    //{{AFX_MSG(CFindUserDlg)
    virtual BOOL OnInitDialog();
    afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
    afx_msg void OnPaint();
    afx_msg HCURSOR OnQueryDragIcon();
    afx_msg void OnButton1();
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()
    
    public:
    int GetPosByNick(CString szNick); ======== placed it here
    
    };
    
    //{{AFX_INSERT_LOCATION}}
    // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
    
    #endif // !defined(AFX_FINDUSERDLG_H__8EF5BE4C_79B2_4F61_B376_E2A019C98B9C__INCLUDED_)

     

    #188656

    seem you dont know how to declare a function for your class, i think is better for you is reading a tutorial on net how to declare it.

    #188655
    method
    Member

    @nanomachine007 wrote:

    seem you dont know how to declare a function for your class, i think is better for you is reading a tutorial on net how to declare it.

    I fixed the problem. I dragged a edit box to my form and i want to use its value instead of Name in pos =GetPosByNick(“Name”);

    i be happy if u tell me how to use editbox input value instead of current name value .Thanks

     

    void CFindUserDlg::OnButton1()
    {
    // TODO: Add your control notification handler code here
    
    HWND listview=NULL; // List View identifier
    HWND parent,child;
    parent=NULL;
    child=NULL;
    parent = ::FindWindow("My Window Class",NULL);
    
    child =::FindWindowEx(parent,0,"WTL_SplitterWindow",NULL);
    child =::FindWindowEx(child,0,"WTL_SplitterWindow",NULL);
    child =::FindWindowEx(child,0,"WTL_SplitterWindow",NULL);
    child =::FindWindowEx(child,0,"ATL:0053C8D0",NULL);
    listview=::FindWindowEx(child,0,"SysListView32",NULL);
    //UpdateData(true);//update content of textbox to m_nick variable
    //::AfxMessageBox(m_nick);
    int pos=-1;
    pos =GetPosByNick("Name");

     

    Nano finally i installed visual studio 2005 express . Now i open your project and want to test it but i do not find execute button? Furthermore, after compile i do not see the .exe file ? i check debug and release folder and there is not there?!!!

    #188654

    if u use my demo code, u just uncomment this like and is all ok

    //UpdateData(true);//update content of textbox to m_nick variable

    change to

    UpdateData(true);//update content of textbox to m_nick variable

    and change pos =GetPosByNick(“Name”);

    to

    pos =GetPosByNick(m_nick);

    #188653

    click on green icon rectangular just left word debug you can see the result of that code. I use vs2005 but professional version i dont know if there are different between them 🙄

    btw if you want link your variable to your control you have to check to function DataExchange something like that.
    Edit control your variable for that type is an instance of CEdit or CString. u just check help online about that. I never ask help when i’am learning mfc or other just read more documentation.
    button control your variable must be an instance of CButton

    and after go to procedure dataexchange and link them for example like this

    DDX_control(pDX,IDC_EDIT1,yourvariableforEditControlHere);

    then after you can interact with your control by your variable with procedure UpdateData

    in our case I linked the Edit control with an instance of CString.

    #188652
    method
    Member

    @nanomachine007 wrote:

    if u use my demo code, u just uncomment this like and is all ok

    //UpdateData(true);//update content of textbox to m_nick variable

    change to

    UpdateData(true);//update content of textbox to m_nick variable

    and change pos =GetPosByNick(“Name”);

    to

    pos =GetPosByNick(m_nick);

    man i change my editbox/textbox name to m_nick and now it only goes select the first postion item. It does not highlight the name i enter in edit/textbox!! could u tell me what i am dong wrong. I did what u told me.Thanks

    code:



    void CFindUserDlg::OnButton1()
    {
    // TODO: Add your control notification handler code here

    HWND listview=NULL; // List View identifier
    HWND parent,child;
    parent=NULL;
    child=NULL;
    parent = ::FindWindow("My Window Class",NULL);

    child =::FindWindowEx(parent,0,"WTL_SplitterWindow",NULL);
    child =::FindWindowEx(child,0,"WTL_SplitterWindow",NULL);
    child =::FindWindowEx(child,0,"WTL_SplitterWindow",NULL);
    child =::FindWindowEx(child,0,"ATL:0053C8D0",NULL);
    listview=::FindWindowEx(child,0,"SysListView32",NULL);
    UpdateData(true);//update content of textbox to m_nick variable
    //::AfxMessageBox(m_nick);
    int pos=-1;

    pos =GetPosByNick("m_nick");

    ....
    ....
    #188651

    m_nick is not a name for edit control in my demo.

    m_nick is a variable i used to link with my edit control. let i check my demo what’s wrong with my demo ❓ ❓ ❓ ❓

    #188650

    my demo is working good, i have just tested and i can select the nick i put in textbox

    i dont know what’s wrong with you lol

    #188649
    method
    Member

    @nanomachine007 wrote:

    my demo is working good, i have just tested and i can select the nick i put in textbox

    i dont know what’s wrong with you lol

    man the problem is with the edit/textbox if i put any name instead of m_nick it goes finds that an higlights it . But it seems it can not get the value of textbox/editbox!! could u tell me what is wrong with my edit/textbo? did u give me the UpdateData functon code ? may be that is missing

Viewing 15 posts - 76 through 90 (of 94 total)
  • You must be logged in to reply to this topic.