吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 4023|回复: 11
收起左侧

[C&C++ 转载] c 大婶来看下 哪里出错

[复制链接]
头像被屏蔽
yuan71058 发表于 2013-5-7 09:27
提示: 作者被禁止或删除 内容自动屏蔽

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

海浪SeaWave 发表于 2013-8-15 17:36
楼主看的是......C++黑客编程揭秘与防范??
silent_grief 发表于 2013-8-15 17:43
RinCherish 发表于 2013-9-30 12:40
楼主 看msdn要细致点啊!

Retrieves the identifier of the thread that created the specified window and, optionally, the identifier of the process that created the window.

Syntax

DWORD WINAPI GetWindowThreadProcessId(
  _In_       HWND hWnd,
  _Out_opt_  LPDWORD lpdwProcessId
);

Parameters
hWnd [in]
Type: HWND

A handle to the window.

lpdwProcessId [out, optional]
Type: LPDWORD

A pointer to a variable that receives the process identifier. If this parameter is not NULL, GetWindowThreadProcessId copies the identifier of the process to the variable; otherwise, it does not.

Return value
Type:
Type: DWORD


The return value is the identifier of the thread that created the window.
傻b控、 发表于 2013-5-18 09:56
HANDLE Phwd
头像被屏蔽
 楼主| yuan71058 发表于 2013-5-7 11:49
提示: 作者被禁止或删除 内容自动屏蔽
LeoSky 发表于 2013-5-7 11:31
yuan71058 发表于 2013-5-7 11:22
真的可以了 这是为什么呢 我怎么没明白呢


GetWindowThreadProcessId 的第二个参数是获取进程ID。而这个函数返回的却是创建这个窗口的线程ID,这两个概念不同。
你下面用OpenProcess打开进程,所需要的是进程ID,也就是 GetWindowThreadProcessId的第二参数返回的值。

你这样写:DWORD PID_=::GetWindowThreadProcessId (hwnd_,&PID_);
这个函数会先将 进程ID传给 PID_这个变量,然后会返回重新给这个变量赋值了线程ID,所以你拿到的是线程ID。
头像被屏蔽
 楼主| yuan71058 发表于 2013-5-7 11:27
提示: 作者被禁止或删除 内容自动屏蔽
头像被屏蔽
 楼主| yuan71058 发表于 2013-5-7 11:22
提示: 作者被禁止或删除 内容自动屏蔽
LeoSky 发表于 2013-5-7 11:15
[AppleScript] 纯文本查看 复制代码
DWORD PID_=::GetWindowThreadProcessId (hwnd_,&PID_);

//改成
DWORD PID_= 0;
::GetWindowThreadProcessId (hwnd_,&PID_);


您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止灌水或回复与主题无关内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-4-26 22:09

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表