阅读背景:

c++WIN32获取syslistview行数

来源:互联网 
#include "stdafx.h"

#include <windows.h>

#include <commctrl.h>
#include <iostream>
#include <string>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>

using namespace std;

int APIENTRY WinMain(HINSTANCE hInstance,

HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
HWND hwndRoot = NULL;
HWND hwndList = NULL;

int count=0; 
 
hwndRoot=FindWindow("#32770", "Windows 任务管理器");
hwndList=FindWindowEx(hwndRoot,NULL,"SysListView32","任务");
count=SendMessage(hwndList,LVM_GETITEMCOUNT,0,0);


char tmp[8];
memset(tmp,0,8);
itoa(count,tmp,10);

MessageBox( NULL,tmp, ("listview行数"), MB_OK );
/* string pirntStr=NULL;
stringstream stream; 
stream<<count; 
pirntStr=stream.str(); 

MessageBox( NULL,("ss"), ("行数"), MB_OK );*/
return 0;
}

 
#include "stdafx.h"

#include <windows.h>




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: