1:FindWindow
2:GetWindowThreadProcessId
3:OpenProcess
4:CloseHandle
5:WriteProcessMemory
6:ReadProcessMemory
那位高手可以指教下 这些api在vc中怎么用,最好举例说说
本人不胜感激
2:GetWindowThreadProcessId
3:OpenProcess
4:CloseHandle
5:WriteProcessMemory
6:ReadProcessMemory
那位高手可以指教下 这些api在vc中怎么用,最好举例说说
本人不胜感激
解决方案 »
- 结构体循环赋值
- Socket 连接中为什么不能触发OnClose函数?
- 新手求教,请问怎么样给回帖的朋友加分?
- 不安装Oracle客户端,vc如何连接Oracle数据库
- 如何使用Microsoft Web Browser控件 响应里面的window.open的弹出窗口
- 关于CDC::SelectObject()的一系列问题。
- installshield没有将程序打包是什么问题啊?
- 请问高手,VC中用ADO能连到SOLARIS平台上的ORACLE吗???
- api 如何实现半透明子窗体??
- 多媒体时间控制
- 怎么使用CListCtrl的事件响应,我想对标题列的鼠标单击作出响应
- 谁知道哪里有《C++大学教程》电子版下载???
LPCTSTR lpClassName, // pointer to class name
LPCTSTR lpWindowName // pointer to window name
);DWORD GetWindowThreadProcessId(
HWND hWnd, // handle to window
LPDWORD lpdwProcessId // address of variable for process identifier
);HANDLE OpenProcess(
DWORD dwDesiredAccess, // access flag
BOOL bInheritHandle, // handle inheritance flag
DWORD dwProcessId // process identifier
);BOOL CloseHandle(
HANDLE hObject // handle to object to close
);BOOL WriteProcessMemory(
HANDLE hProcess, // handle to process whose memory is written to
LPVOID lpBaseAddress,
// address to start writing to
LPVOID lpBuffer, // pointer to buffer to write data to
DWORD nSize, // number of bytes to write
LPDWORD lpNumberOfBytesWritten
// actual number of bytes written
);BOOL ReadProcessMemory(
HANDLE hProcess, // handle to the process whose memory is read
LPCVOID lpBaseAddress,
// address to start reading
LPVOID lpBuffer, // address of buffer to place read data
DWORD nSize, // number of bytes to read
LPDWORD lpNumberOfBytesRead
// address of number of bytes read
);
但是vc下我搞不定 高手指点我
这几个类型的变量到底是什么东西啊 可以说说吗?
凡是关于这几个类型的都说我搞得不对
is defined in winuser.h beginning with Windows NT 4.0. The
SystemParametersInfo function has been updated for the scrolllines
functionality.
*/#ifndef SPI_GETWHEELSCROLLLINES
#define SPI_GETWHEELSCROLLLINES 104
#endif#include "zmouse.h"/*********************************************************
* FUNCTION: GetNumScrollLines
* Purpose : An OS independent method to retrieve the
* number of wheel scroll lines
* Params : none
* Returns : UINT: Number of scroll lines where WHEEL_PAGESCROLL
* indicates to scroll a page at a time.
*********************************************************/
UINT GetNumScrollLines(void)
{
HWND hdlMsWheel;
UINT ucNumLines=3; // 3 is the default
OSVERSIONINFO osversion;
UINT uiMsh_MsgScrollLines;
memset(&osversion, 0, sizeof(OSVERSIONINFO));
osversion.dwOSVersionInfoSize =sizeof(OSVERSIONINFO);
GetVersionEx(&osversion); // In Windows 9x & Windows NT 3.51, query MSWheel for the
// number of scroll lines. In Windows NT 4.0 and later,
// use SystemParametersInfo. if ((osversion.dwPlatformId ==
VER_PLATFORM_WIN32_WINDOWS) ||
( (osversion.dwPlatformId ==
VER_PLATFORM_WIN32_NT) &&
(osversion.dwMajorVersion < 4) ) )
{
hdlMsWheel = FindWindow(MSH_WHEELMODULE_CLASS,
MSH_WHEELMODULE_TITLE);
if (hdlMsWheel)
{
uiMsh_MsgScrollLines = RegisterWindowMessage
(MSH_SCROLL_LINES);
if (uiMsh_MsgScrollLines)
ucNumLines = (int)SendMessage(hdlMsWheel,
uiMsh_MsgScrollLines,
0,
0);
}
}
else if ( (osversion.dwPlatformId ==
VER_PLATFORM_WIN32_NT) &&
(osversion.dwMajorVersion >= 4) )
{
SystemParametersInfo(SPI_GETWHEELSCROLLLINES,
0,
&ucNumLines, 0);
}
return(ucNumLines);
}
DWORD pID; /* 进程ID */
DWORD tID; /* 线程ID */
HWND hFore;hFore = GetForegroundWindow ();
tID = GetWindowThreadProcessId (hFore, &pID);
这个函数中的两个宏是怎么定义的啊
LPCTSTR lpClassName, // class name
LPCTSTR lpWindowName // window name
);
Parameters
lpClassName
[in] Pointer to a null-terminated string that specifies the class name or a class atom created by a previous call to the RegisterClass or RegisterClassEx function. The atom must be in the low-order word of lpClassName; the high-order word must be zero.
If lpClassName is a string, it specifies the window class name. The class name can be any name registered with RegisterClass or RegisterClassEx, or any of the predefined control-class names. lpWindowName
[in] Pointer to a null-terminated string that specifies the window name (the window's title). If this parameter is NULL, all window names match.
Return Values
If the function succeeds, the return value is a handle to the window that has the specified class name and window name.If the function fails, the return value is NULL. To get extended error information, call GetLastError. Res
If the lpWindowName parameter is not NULL, FindWindow calls the GetWindowText function to retrieve the window name for comparison. For a description of a potential problem that can arise, see the Res for GetWindowText. 通过class名或窗口名来查找窗口,不包括子窗口,
FindWindow(MSH_WHEELMODULE_CLASS, MSH_WHEELMODULE_TITLE);
Points to a null-terminated string that specifies the window’s class name (a WNDCLASS structure). If lpClassName is NULL, all class names match.lpszWindowNamePoints to a null-terminated string that specifies the window name (the window’s title). If lpWindowName is NULL, all window names match.
我在vb中这样写可以通过但是在vc中就通不过
函数功能:该函数返回创建指定窗口线程的标识和创建窗口的进程的标识符,后一项是可选的。 函数原型;DWORD GetWindowThreadProcessld(HWND hwnd,LPDWORD lpdwProcessld); 参数: hWnd:窗口句柄。 lpdwProcessld:接收进程标识的32位值的地址。如果这个参数不为NULL,GetWindwThreadProcessld将进程标识拷贝到这个32位值中,否则不拷贝。 返回值:返回值为创建窗口的线程标识。 速查:Windows NT:3.1以上版本;Windows:95以上版本;Windows CE:1.0以上版本;头文件:winuser.h;库文件;user32.lib。
但是运行时老说什么内存不能访问 请问这是什么原因啊
好像是这个函数有点问题OpenProcess
我是这样写的HANDLE phand=::OpenProcess(PROCESS_ALL_ACCESS,TRUE,*pid);
指点啊