激情久久久_欧美视频区_成人av免费_不卡视频一二三区_欧美精品在欧美一区二区少妇_欧美一区二区三区的

服務器之家:專注于服務器技術及軟件下載分享
分類導航

PHP教程|ASP.NET教程|Java教程|ASP教程|編程技術|正則表達式|C/C++|IOS|C#|Swift|Android|VB|R語言|JavaScript|易語言|vb.net|

服務器之家 - 編程語言 - C/C++ - VC通過托盤圖標得到該所屬進程的實現代碼

VC通過托盤圖標得到該所屬進程的實現代碼

2022-01-19 12:50墨言 C/C++

這篇文章主要介紹了VC通過托盤圖標得到該所屬進程的實現代碼,為了方便大家使用特將多個代碼分享給大家,需要的朋友可以參考下

本例以獲取程序托盤圖標位置為例

//根據需要還可以獲取不少信息

代碼一

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
//獲取托盤區域數據
RECT CTray::GetTrayRect()
{
    RECT rect = {0};
    HWND hWnd = NULL;
 
    hWnd = FindTrayWnd();
    if (hWnd != NULL)
    {
        if (!EnumNotifyWindow(rect,hWnd))//如果沒在普通托盤區
        {
            hWnd = FindNotifyIconOverflowWindow();//在溢出區(win7)
            if (hWnd != NULL)
            {
                EnumNotifyWindow(rect,hWnd);
            }
        }
    }
 
    return rect;
}
//枚舉獲取托盤區域位置
bool CTray::EnumNotifyWindow(RECT &rect,HWND hWnd)
{
    //RECT rect = {0};
    bool bSuc = false;
    unsigned long lngPID = 0;
    long ret = 0,lngButtons = 0;
    long lngHwndAdr = 0,lngHwnd = 0;//,lngTextAdr,lngButtonID;
    HANDLE hProcess = NULL;
    LPVOID lngAddress = NULL,lngRect = NULL;
 
    if (hWnd != NULL)
    {
        ret = GetWindowThreadProcessId(hWnd, &lngPID);
        if(ret != 0 && lngPID != 0)
        {
            hProcess = OpenProcess(PROCESS_ALL_ACCESS|PROCESS_VM_OPERATION|PROCESS_VM_READ|PROCESS_VM_WRITE,0,lngPID);//
            if (hProcess != NULL)
            {
                lngAddress = VirtualAllocEx(hProcess,0, 0x4096, MEM_COMMIT, PAGE_READWRITE);
                lngRect = VirtualAllocEx(hProcess,0,sizeof(RECT), MEM_COMMIT, PAGE_READWRITE);
                lngButtons = SendMessage(hWnd, TB_BUTTONCOUNT, 0, 0); //發送消息獲取托盤button數量
                if (lngAddress != NULL  && lngRect != NULL)
                {
                    for(int i=0 ;i< lngButtons;i++)
                    {
                        RECT rc = {0};
                        int j = i;
                        ret = SendMessage(hWnd,TB_GETBUTTON,j,long(lngAddress));//發送消息獲取托盤項數據起始地址
                        ret = ReadProcessMemory(hProcess, LPVOID(long(lngAddress) + 12),&lngHwndAdr,4,0);
                        if(ret != 0 && lngHwndAdr != -1)
                        {
                            ret = ReadProcessMemory(hProcess, LPVOID(lngHwndAdr),&lngHwnd, 4,0);//獲取句柄
                            if(ret != 0 && (HWND)lngHwnd == m_NotifyIconData.hWnd)//
                            {
                                ret = ::SendMessage(hWnd,TB_GETITEMRECT,(WPARAM)j,(LPARAM)lngRect); //發送消息獲取托盤項區域數據
                                ret = ReadProcessMemory(hProcess,lngRect,&rc, sizeof(rc),0);  //讀取托盤區域數據
                                if(ret != 0)
                                {
                                    CWnd::FromHandle(hWnd)->ClientToScreen(&rc);
                                    rect = rc;
                                }
                                bSuc = true;//在普通托盤區找到,在溢出區不再查找
                                break;
                            }
                        }
                    }
                }
                if (lngAddress != NULL)
                {
                    VirtualFreeEx( hProcess, lngAddress, 0x4096, MEM_DECOMMIT);
                    VirtualFreeEx( hProcess, lngAddress, 0, MEM_RELEASE);
                }
                if (lngRect != NULL)
                {
                    VirtualFreeEx( hProcess, lngRect, sizeof(RECT), MEM_DECOMMIT);
                    VirtualFreeEx( hProcess, lngRect, 0, MEM_RELEASE);
                }
                CloseHandle(hProcess);
            }
        }
    }
    return bSuc;
}
//獲取普通托盤區窗口句柄
HWND CTray::FindTrayWnd()
{
    HWND hWnd = NULL;
    HWND hWndPaper = NULL;
 
    if ((hWnd = FindWindow(_T("Shell_TrayWnd"), NULL)) != NULL)
    {
        if ((hWnd = FindWindowEx(hWnd, 0, _T("TrayNotifyWnd"), NULL)) != NULL)
        {
            hWndPaper = FindWindowEx(hWnd, 0, _T("SysPager"), NULL);
            if(!hWndPaper)
                hWnd = FindWindowEx(hWnd, 0, _T("ToolbarWindow32"), NULL);
            else
                hWnd = FindWindowEx(hWndPaper, 0, _T("ToolbarWindow32"), NULL);
        }
    }
 
    return hWnd;
}
//獲取溢出托盤區窗口句柄
HWND CTray::FindNotifyIconOverflowWindow()
{
    HWND hWnd = NULL;
 
    hWnd = FindWindow(_T("NotifyIconOverflowWindow"), NULL);
    if (hWnd != NULL)
    {
        hWnd = FindWindowEx(hWnd, NULL, _T("ToolbarWindow32"), NULL);
    }
 
    return hWnd;
}

以下代碼網上收集的,變量 初始化 指針句柄 及函數是否成功都沒判定

//需要的自己加下判定,有時間再改了

代碼二

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
struct TRAYDATA
{
    HWND hwnd;                              
    UINT uID;                              
    UINT uCallbackMessage;      
    DWORD Reserved[2];              
    HICON hIcon;                              
};
void CTray::GetTrayRect()
{
HWND hWnd,hWndPaper;
unsigned long lngPID;
long ret,lngButtons;
HANDLE hProcess;
LPVOID lngAddress;
long lngTextAdr,lngHwndAdr,lngHwnd,lngButtonID;
TCHAR strBuff[1024]={0};
  TRAYDATA trayData = {0};
  TBBUTTON btnData={0};
 
hWnd = FindWindow(_T("Shell_TrayWnd"), NULL);
hWnd = FindWindowEx(hWnd, 0, _T("TrayNotifyWnd"), NULL);
hWndPaper = FindWindowEx(hWnd, 0, _T("SysPager"), NULL);
if(!hWndPaper)
hWnd = FindWindowEx(hWnd, 0, _T("ToolbarWindow32"), NULL);
else
hWnd = FindWindowEx(hWndPaper, 0, _T("ToolbarWindow32"), NULL);
ret = GetWindowThreadProcessId(hWnd, &lngPID);
hProcess = OpenProcess(PROCESS_ALL_ACCESS|PROCESS_VM_OPERATION|PROCESS_VM_READ|PROCESS_VM_WRITE,0,lngPID);
lngAddress = VirtualAllocEx(hProcess,0, 0x4096, MEM_COMMIT, PAGE_READWRITE);
lngButtons = SendMessage(hWnd, TB_BUTTONCOUNT, 0, 0);                     
RECT rc; POINT point;
LPVOID lngRect = VirtualAllocEx(hProcess,0,sizeof(RECT), MEM_COMMIT, PAGE_READWRITE);
 
CRect rect;
for(int i=0 ;i< lngButtons;i++)
{
int j = i;
ret = SendMessage(hWnd,TB_GETBUTTON,j,long(lngAddress));
ret = ReadProcessMemory(hProcess, LPVOID(long(lngAddress) + 16),&lngTextAdr,4,0);
if(lngTextAdr != -1)
{
ret = ReadProcessMemory(hProcess, LPVOID(lngTextAdr),strBuff,1024,0);
//ret = ReadProcessMemory(hProcess, LPVOID(long(lngAddress) + 12),&lngHwndAdr,4,0); //獲取句柄
//ret = ReadProcessMemory(hProcess, LPVOID(lngHwndAdr),&lngHwnd, 4,0);
//ret = ReadProcessMemory(hProcess, LPVOID(long(lngAddress) + 4),&lngButtonID,4,0);//獲取buttonID
CString str(strBuff);
if (str.Compare(m_NotifyIconData.szTip) == 0)
{
::SendMessage(hWnd,TB_GETITEMRECT,(WPARAM)j,(LPARAM)lngRect);
ReadProcessMemory(hProcess,lngRect,&rc, sizeof(rc),0);  //獲取托盤圖標區域
CWnd::FromHandle(hWnd)->ClientToScreen(&rc);
}
 
//以下是隱藏托盤圖標
//    {
//    if(show)
//    {
//    SendMessage(hWnd,TB_HIDEBUTTON,lngButtonID,0);
//    }
//    else
//    {
//    SendMessage(hWnd,TB_HIDEBUTTON,lngButtonID,1);
//    }
//    }
 
}
}
VirtualFreeEx( hProcess, lngAddress, 0x4096, MEM_DECOMMIT);
VirtualFreeEx( hProcess, lngAddress, 0, MEM_RELEASE);
VirtualFreeEx( hProcess, lngRect, sizeof(RECT), MEM_DECOMMIT);
VirtualFreeEx( hProcess, lngRect, 0, MEM_RELEASE);
CloseHandle(hProcess);
}

代碼三

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
VOID StartStorm()
{
         HWND hMain = FindWindow("animate_layered_window_class", "暴風媒體中心");
         if ( hMain )
         {
                 ShowWindow(hMain, SW_HIDE);
         }
 
        //得到工具欄句柄
     HWND hTray = FindWindow("Shell_TrayWnd", NULL);
     hTray = FindWindowEx(hTray, 0, "TrayNotifyWnd", NULL);
     hTray = FindWindowEx(hTray, 0, "SysPager", NULL);
     hTray = FindWindowEx(hTray, 0, "ToolbarWindow32", NULL);
 
        //獲取explore進程ID
         DWORD TrayPid;
         GetWindowThreadProcessId(hTray, &TrayPid);
 
        //打開進程 并且開辟進程空間
         RECT rect;
         TBBUTTON tb;
         TBBUTTON pTb;
         LPVOID lpAddr;
         DWORD dwThreadIdOfICO;
         DWORD dwTempId = FindStorm("Stormtray.exe"); //你要點擊的進程的PID
 
         TRAYDATA traydata;
 
        HANDLE hOpen = OpenProcess(PROCESS_ALL_ACCESS, FALSE, TrayPid);
         lpAddr = VirtualAllocEx(hOpen, NULL, sizeof(tb) + sizeof(rect), MEM_COMMIT, PAGE_READWRITE);
 
        int nCount = SendMessage(hTray, TB_BUTTONCOUNT, 0, 0);
         int i;
         DWORD dwOutWrite;
         for ( i = 0; i < nCount; i ++)
         {
                 ZeroMemory(&tb, sizeof(tb));
                 ZeroMemory(&rect, sizeof(rect));
                 //把參數寫進目標進程
                 WriteProcessMemory(hOpen, lpAddr, &tb, sizeof(tb), &dwOutWrite);
                 //WriteProcessMemory(hOpen, (LPVOID)((DWORD)lpAddr + sizeof(pTb)), &rect, sizeof(rect), &dwOutWrite);
                 //獲取BUTTON
                 SendMessage(hTray, TB_GETBUTTON, i, LPARAM(lpAddr));
                 //讀取TBBUTTON結構
                 ReadProcessMemory(hOpen, lpAddr, &pTb, sizeof(TBBUTTON), &dwOutWrite);
                 //讀取TRAYDATA結構
                 ReadProcessMemory(hOpen, (LPVOID)pTb.dwData, &traydata, sizeof(TRAYDATA), &dwOutWrite);
 
                 GetWindowThreadProcessId(traydata.hwnd, &dwThreadIdOfICO);
                 if ( dwThreadIdOfICO == dwTempId )
                 {
                         //獲取ICO的RECT
                         LPVOID lp = (LPVOID)((DWORD)lpAddr + sizeof(pTb));
                         SendMessage(hTray, TB_GETITEMRECT, i, (LPARAM)lp);
                         LPVOID lpdata = (LPVOID)((DWORD)lpAddr + sizeof(TBBUTTON));
                         ReadProcessMemory(hOpen, lpdata, &rect, sizeof(rect), &dwOutWrite);
                         int iGap = rect.right/2; //得到圖標的中間坐標的間隔
                         //點擊
                         SendMessage(hTray, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(rect.right - iGap, rect.bottom - iGap));
                         SendMessage(hTray, WM_LBUTTONUP, 0, MAKELPARAM(rect.right - iGap, rect.bottom - iGap));
                         //
                         CloseHandle(hOpen);
                         break;;
                 }
         }
 
}

win7有一個溢出托盤區:以下是隱藏在托盤區中的托盤信息,用以上的方法找不到,因為在NotifyIconOverflowWindow里

Fhwnd = FindWindow("NotifyIconOverflowWindow", NULL)

參考文章:http://topic.csdn.net/u/20101003/23/859851ee-5aa1-4476-8ce1-1359826df2b0.html

代碼四

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#include "stdafx.h"
#include <afx.h>
#include <locale.h>
#include <string>
using namespace std;
 
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
 
BOOL IsWow64()
{
    BOOL bIsWow64 = FALSE;
 
    LPFN_ISWOW64PROCESS
        fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(
        GetModuleHandle(_T("kernel32")),"IsWow64Process");
 
    if (NULL != fnIsWow64Process)
    {
        if (!fnIsWow64Process(GetCurrentProcess(),&bIsWow64))
        {
            // handle error
        }
    }
    return bIsWow64;
}
 
HWND FindTrayWnd()
{
    HWND hWnd = NULL;
 
    hWnd = FindWindow(_T("Shell_TrayWnd"), NULL);
    hWnd = FindWindowEx(hWnd, NULL, _T("TrayNotifyWnd"), NULL);
    hWnd = FindWindowEx(hWnd, NULL, _T("SysPager"), NULL);
    hWnd = FindWindowEx(hWnd, NULL, _T("ToolbarWindow32"), NULL);
 
    return hWnd;
}
 
HWND FindNotifyIconOverflowWindow()
{
    HWND hWnd = NULL;
 
    hWnd = FindWindow(_T("NotifyIconOverflowWindow"), NULL);
    hWnd = FindWindowEx(hWnd, NULL, _T("ToolbarWindow32"), NULL);
 
    return hWnd;
}
 
void EnumNotifyWindow(HWND hWnd)
{
    DWORD dwProcessId = 0;
    GetWindowThreadProcessId(hWnd,&dwProcessId);
 
    HANDLE hProcess = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE, FALSE, dwProcessId);
    if ( hProcess==NULL ){
        return;
    }
    LPVOID lAddress = VirtualAllocEx(hProcess, 0, 4096, MEM_COMMIT, PAGE_READWRITE);
    if ( lAddress==NULL ){
        return;
    }
    DWORD lTextAdr = 0;
    BYTE buff[1024] = {0};
    CString strFilePath;
    CString strTile;
    HWND hMainWnd = NULL;
    int nDataOffset = sizeof(TBBUTTON) - sizeof(INT_PTR) - sizeof(DWORD_PTR);
    int nStrOffset = 18;
    if ( IsWow64() ){
        nDataOffset+=4;
        nStrOffset+=6;
    }
 
    //得到圖標個數
    int lButton = SendMessage(hWnd, TB_BUTTONCOUNT, 0, 0);
    for (int i = 0; i < lButton; i++) {
        SendMessage(hWnd, TB_GETBUTTON, i, (LPARAM)lAddress);
        //讀文本地址
        ReadProcessMemory(hProcess, (LPVOID)((DWORD)lAddress + nDataOffset), &lTextAdr, 4, 0);
        if ( lTextAdr!=-1 ) {
            //讀文本
            ReadProcessMemory(hProcess, (LPCVOID)lTextAdr, buff, 1024, 0);
            hMainWnd = (HWND)(*((DWORD*)buff));
            strFilePath = (WCHAR *)buff + nStrOffset;
            strTile = (WCHAR *)buff + nStrOffset + MAX_PATH;
            _tprintf(_T("%s %s\n"),strTile,strFilePath);
        }
    }
    VirtualFreeEx(hProcess, lAddress, 4096, MEM_RELEASE);
    CloseHandle(hProcess);
}
 
int _tmain(int argc, _TCHAR* argv[])
{
    setlocale(LC_ALL, "chs");
    EnumNotifyWindow(FindTrayWnd());
    _tprintf(_T("\n"));
    EnumNotifyWindow(FindNotifyIconOverflowWindow());
    system("pause");
    return 0;
}

代碼五

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
void  CTrayDlg::OnButton1()   
           //  TODO:  Add  your  control  notification  handler  code  here 
HWND  wd=::FindWindow("Shell_TrayWnd",NULL); 
   if  (wd==NULL) 
   
         MessageBox("Error1"); 
             return
   
   HWND  wtd=FindWindowEx(wd,NULL,"TrayNotifyWnd",NULL); 
   if  (wtd==NULL) 
   
         MessageBox("Error2"); 
             return
   
   HWND  wd1=FindWindowEx(wtd,NULL,"ToolbarWindow32",NULL); 
   if  (wd1==NULL) 
   
         MessageBox("Error3"); 
             return
   
   DWORD  pid; 
   pid=0; 
   GetWindowThreadProcessId(wd1,&pid); 
   if  (pid==NULL) 
   
         MessageBox("Error4"); 
             return
   
 
   HANDLE  hd=OpenProcess(PROCESS_QUERY_INFORMATION    ¦    PROCESS_ALL_ACCESS            ,true,pid); 
   if  (hd==NULL) 
   
         MessageBox("Error6"); 
         return
     
 
   int  num=::SendMessage(wd1,TB_BUTTONCOUNT  ,NULL,NULL); 
   int  i; 
   unsigned  long  n; 
   TBBUTTON  p,*pp; 
   CString  x; 
   wchar_t  name[256]; 
   unsigned  long  whd,proid; 
   CString  temp; 
 
   TBBUTTON  *sp; 
 
   sp=  (TBBUTTON  *)0x20f00; //這里應該改成用VirtualAllocEx分配內存否則有可能出錯,不過人懶,就先這么著吧
   for(i=0;i<num;i++) 
   
           ::SendMessage(wd1,TB_GETBUTTON,i,(LPARAM)sp); 
       pp=&p; 
       ReadProcessMemory(hd,sp,pp,sizeof(p),&n); 
//        x.Format("%x  %x  %x  %x    %x  %x",p.iBitmap,p.idCommand,p.fsState,p.fsStyle,    p.dwData,  p.iString); 
       name[0]=0; 
       if  (p.iString!=0xffffffff) 
       
               try
               
                       ReadProcessMemory(hd,(void  *)p.iString,name,255,&n); 
                       name[n]=0; 
               
               catch() 
               
               
//                x+="  "; 
//                x+=name; 
                       temp=name; 
                       try
                       
                                   whd=0; 
                       ReadProcessMemory(hd,(void  *)p.dwData,&whd,4,&n); 
                       
                       catch() 
                       
                       
                       proid=0; 
               GetWindowThreadProcessId((HWND)whd,&proid); 
                       x.Format("位置=%d  名稱=%s  窗口句柄=%08x  進程ID=%08x"
                                         i,(LPCTSTR  )temp,whd,proid); 
               m_list.AddString(x); 
       
   }             
}

代碼六

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
void   CTrayDlg::OnButton1()    
  {  
  //   TODO:   Add   your   control   notification   handler   code   here  
  HWND   wd=::FindWindow("Shell_TrayWnd",NULL);  
      if   (wd==NULL)  
      {  
            MessageBox("Error1");  
    return;  
      }  
      HWND   wtd=FindWindowEx(wd,NULL,"TrayNotifyWnd",NULL);  
      if   (wtd==NULL)  
      {  
            MessageBox("Error2");  
    return;  
      }  
      HWND   wd1=FindWindowEx(wtd,NULL,"ToolbarWindow32",NULL);  
      if   (wd1==NULL)  
      {  
            MessageBox("Error3");  
    return;  
      }  
      DWORD   pid;  
      pid=0;  
      GetWindowThreadProcessId(wd1,&pid);  
      if   (pid==NULL)  
      {  
            MessageBox("Error4");  
    return;  
      }  
 
      HANDLE   hd=OpenProcess(PROCESS_QUERY_INFORMATION   |     PROCESS_ALL_ACCESS ,true,pid);  
      if   (hd==NULL)  
      {  
            MessageBox("Error6");  
            return;  
        }  
 
      int   num=::SendMessage(wd1,TB_BUTTONCOUNT   ,NULL,NULL);  
      int   i;  
      unsigned   long   n;  
      TBBUTTON   p,*pp;  
      CString   x;  
      wchar_t   name[256];  
      unsigned   long   whd,proid;  
      CString   temp;  
 
      TBBUTTON   *sp;  
 
      sp=   (TBBUTTON   *)0x20f00;  
      for(i=0;i<num;i++)  
      {  
  ::SendMessage(wd1,TB_GETBUTTON,i,(LPARAM)sp);  
          pp=&p;  
          ReadProcessMemory(hd,sp,pp,sizeof(p),&n);  
  //         x.Format("%x   %x   %x   %x     %x   %x",p.iBitmap,p.idCommand,p.fsState,p.fsStyle,     p.dwData,   p.iString);  
          name[0]=0;  
          if   (p.iString!=0xffffffff)  
          {  
                  try  
                  {  
                          ReadProcessMemory(hd,(void   *)p.iString,name,255,&n);  
                          name[n]=0;  
                  }  
                  catch(...)  
                  {  
                  }  
  //                 x+="   ";  
  //                 x+=name;  
  temp=name;  
  try  
  {  
  whd=0;  
                          ReadProcessMemory(hd,(void   *)p.dwData,&whd,4,&n);  
  }  
  catch(...)  
  {  
  }  
  proid=0;  
                  GetWindowThreadProcessId((HWND)whd,&proid);  
  x.Format("位置=%d   名稱=%s   窗口句柄=%08x   進程ID=%08x",  
        i,(LPCTSTR   )temp,whd,proid);  
                  m_list.AddString(x);  
          }  
 
      }  
 
  }  

到此這篇關于VC通過托盤圖標得到該所屬進程的實現代碼的文章就介紹到這了,更多相關VC托盤圖標得到該所屬進程內容請搜索服務器之家以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持服務器之家!

原文鏈接:https://www.moyann.com/archives/239/

延伸 · 閱讀

精彩推薦
  • C/C++深入理解goto語句的替代實現方式分析

    深入理解goto語句的替代實現方式分析

    本篇文章是對goto語句的替代實現方式進行了詳細的分析介紹,需要的朋友參考下...

    C語言教程網7342020-12-03
  • C/C++C++之重載 重定義與重寫用法詳解

    C++之重載 重定義與重寫用法詳解

    這篇文章主要介紹了C++之重載 重定義與重寫用法詳解,本篇文章通過簡要的案例,講解了該項技術的了解與使用,以下就是詳細內容,需要的朋友可以參考下...

    青山的青6062022-01-04
  • C/C++詳解c語言中的 strcpy和strncpy字符串函數使用

    詳解c語言中的 strcpy和strncpy字符串函數使用

    strcpy 和strcnpy函數是字符串復制函數。接下來通過本文給大家介紹c語言中的strcpy和strncpy字符串函數使用,感興趣的朋友跟隨小編要求看看吧...

    spring-go5642021-07-02
  • C/C++C語言中炫酷的文件操作實例詳解

    C語言中炫酷的文件操作實例詳解

    內存中的數據都是暫時的,當程序結束時,它們都將丟失,為了永久性的保存大量的數據,C語言提供了對文件的操作,這篇文章主要給大家介紹了關于C語言中文件...

    針眼_6702022-01-24
  • C/C++C語言實現電腦關機程序

    C語言實現電腦關機程序

    這篇文章主要為大家詳細介紹了C語言實現電腦關機程序,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下...

    xiaocaidayong8482021-08-20
  • C/C++學習C++編程的必備軟件

    學習C++編程的必備軟件

    本文給大家分享的是作者在學習使用C++進行編程的時候所用到的一些常用的軟件,這里推薦給大家...

    謝恩銘10102021-05-08
  • C/C++C/C++經典實例之模擬計算器示例代碼

    C/C++經典實例之模擬計算器示例代碼

    最近在看到的一個需求,本以為比較簡單,但花了不少時間,所以下面這篇文章主要給大家介紹了關于C/C++經典實例之模擬計算器的相關資料,文中通過示...

    jia150610152021-06-07
  • C/C++c++ 單線程實現同時監聽多個端口

    c++ 單線程實現同時監聽多個端口

    這篇文章主要介紹了c++ 單線程實現同時監聽多個端口的方法,幫助大家更好的理解和學習使用c++,感興趣的朋友可以了解下...

    源之緣11542021-10-27
主站蜘蛛池模板: 久久亚洲国产精品 | 18被视频免费观看视频 | 看一级毛片 | 精品在线观看一区 | 日韩中字在线 | 亚洲一区在线看 | av电影手机在线看 | 狠狠干天天 | 久久另类视频 | 亚洲天堂中文字幕在线观看 | 九草视频 | 国产免费看片 | 免看黄大片aa | 中文字幕极速在线观看 | 成年免费视频黄网站在线观看 | 毛片在线免费 | 日本精品免费观看 | 久久久国产一级片 | 亚洲人成中文字幕在线观看 | 日本网站在线播放 | 亚a在线 | 成人三级电影网址 | 日日狠狠久久偷偷四色综合免费 | 欧美a∨一区二区三区久久黄 | 欧美a一| 国产免费观看视频 | 国产91久久精品 | 日本精品免费观看 | 欧美三级日本三级少妇99 | 亚洲视频在线观看免费 | 懂色av懂色aⅴ精彩av | 国产乱淫av片免费网站 | 久久精品一区视频 | 在线日韩 | 日日摸夜夜添夜夜添牛牛 | 免费毛片电影 | 精品国产一区三区 | 91精品国产综合久久婷婷香蕉 | 大胆在线日本aⅴ免费视频 美国黄色毛片女人性生活片 | 欧美国产综合视频 | 欧美成人精品一区二区三区 |