|
在window7系统上 MoveMemory、CopyMemory 等函数跟XP系统上使用有区别吗
楼主为什么定位到是这几个函数的问题呢?更有可能是其它函数的问题啊。有没有代码? |
|
[讨论]msvcr90.dll的问题
如果是win32的程序,可以不使用C库,直接在选项里将C库去掉,有kernel32, user32, advapi这些库的API足够了。你可以去尝试一下,不过这个答案对你来说显然现在来不及了。 另外,你要看看你的应用有没有使用其它的DLL,这些DLL有没有对vs2008的运行时库有依赖。 |
|
[讨论]msvcr90.dll的问题
LZ,给你看个链接,希望对你有帮助。 If you build test2.cpp using the /MT (or /MTd, for a debug build) compiler option, your program will link with LIBCMT.LIB (or LIBCMTD.LIB, for debug build) and LIBCPMT.LIB (or LIBCPMTD.LIB, for debug build), in addition to other libraries. If you build test2.cpp using the /MD (or /MDd, for a debug build) compiler option, your program will link with MSVCRT.LIB (or MSVCRTD.LIB, for debug build) and MSVCPRT.LIB (or MSVCPRTD.LIB, for debug build), in addition to other libraries. For Microsoft Visual C++ 2008, your program will be dependent on MSVCR90.DLL and MSVCP90.DLL (or MSVCR90D.DLL and MSVCP90D.DLL for debug build). http://support.microsoft.com/kb/154753/en-us |
|
SendMessage()函数求助!
win32 api, mouse_event, kbd_event,等等。 |
|
FS:[30]+2 写如0如何用汇编写?
[QUOTE=蘇仨;978940]XP2 藍屏文件指示的是mov eax, dword ptr [eax]; 這句 看了一下說FS是16寄存器,EAX是24位的,是不是轉換出錯了呢, 還是說沒有修改權限[/QUOTE] eax什么时候是24bit的了? |
|
各位怎么把先前 TextOut的文字清除掉 因为后面TextOut的字符太短没办法覆盖掉 所以必须把之前的弄掉
楼主要看看GDI的知识,pen,brush,等等。 |
|
[讨论]msvcr90.dll的问题
不大确定LZ的意思。你是想你程序不使用msvcr90.dll这个库嘛?这可是C库,除非你的程序不使用C库中的API,不过大多数C库中的API都就对应的Win32 API,这个是有可能的。 另外,这个是C库,和MFC没什么关系。 |
|
各位怎么把先前 TextOut的文字清除掉 因为后面TextOut的字符太短没办法覆盖掉 所以必须把之前的弄掉
理论上会的,WM_PAINT消息,不只写字,在写字之前,会用刷子重绘背景的, |
|
dr寄存器清零!
dr4-dr7 4个寄存器中只用了2个dr6, dr7,另外2个dr4和dr5是这2个的镜像,保留的。 |
|
[邀请码已发]虚拟地址与虚拟内存个人理解
下面这篇帖子不错的,最后一张图清楚的描述了保护模式下的分段与分页机制。 INTEL-X86保护模式下的内存管理 http://user.qzone.qq.com/31731705/blog/1307847866 |
|
sendmessage鼠标模拟一点疑问
有印象是使用mouse_event API来实现模拟鼠标事件的。 |
|
[求助]线程起始地址修改
这个看你封装的目的是什么。一般来说,简化使用是比较主要也是重要的目的。API参数很多,很繁,使用class则很简单。 另外,不过是个成员指针,在构造函数时初始化有何不妥呢?按你的说法,构造函数不能有参数了,还有,难道C++中不能使用全局函数? |
|
[求助]线程起始地址修改
这真的是C++的基础知识, 1. 首先从最简单的说起吧, typedef DWORD (WINAPI *PTHREAD)(void*); class A { public: A( PTHREAD p ) : p_(p) {} DWORD Start() { return CreateThread( .... ) } private: PTHREAD P_; }; 这样一来,每个对象可以拥有不同的线程函数,当然也可以共享相同的线程函数。 A a( ThreadProc1 ), b( ThreadProc2 ), c(ThreadProc1 ); 2. 复杂一点的,上网搜索 C++实现线程类。 |
|
[求助]线程起始地址修改
这是C++的基本知识。 如果你是希望每个对象都有自己的线程函数,那把线程函数参数化即可。 更高阶一点的,可以使用函数对象封装线程函数,你可以参考一下网上的相关资料,或者boost库中线程类的实现。 |
|
[求助]在反汇编的过程中经常看到函数的开头是mov edi,edi,这是啥意思?
以前函数序言都是这么开头的,只有3个字节的序言, push ebp mov ebp, esp 后面的指令与具体的函数相关,不能确定了。 微软为了hot patch,加了一个mov edi, edi 即函数的开头是如下5个字节。 mov edi, edi push ebp mov ebp, esp 一条jmp指令就5个字节,函数开头的5个字节正好放一条jmp,跳转到其它代码里去了。而且这5个字节是固定的,不用考虑哪个函数的问题。因此这套流程的通用性很强。 |
|
[求助]汇编代码this指针问题
, lea ecx, DWORD PTR [ebp-14H] 是把 [ebp-14h]的这个地址(也就是这个局部变量的地址)装入ecx,而不是内容,否则就是mov 指令了。this指针本身的含义也就是对象的地址。至于它的内容是0xcccccccc,这无关紧要,因为ctor会初始化成员的。 |
|
任务管理器的 选项 前端显示怎么实现的?
我误人子弟,,真是好笑,拜托楼上的看清楚楼主的需求好不好,这么毛糙也来写程序。 我特地写了一段程序验证下,其实很简单。我是win7的系统,就2句代码就能看出效果,启动一个记事本,然后运行。 HWND h = FindWindow( NULL, "无标题 - 记事本" ); if( h ) { SetWindowPos( h, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW ); } 效果很明显,记事本窗口变成了topmost,始终在一般应用的最上面。楼主还可以使用spy++,看看记事本窗口的style的前后变化。 |
|
求助 c++ 代码
这真的是很无聊的问题啊。 引用一段<狂人C>里的话来回答你的问题,希望对你有所帮助。 在现实的运用中,这个两个“++”运算符还是会经常让我们感到头痛,甚至很多成熟的编程团队会将其定义为尽量避免使用的运算符。那么,这个谜一样的运算符,为什么会成为不少程序员极力回避的禁忌呢? 我们首先来看看下面这个简单的代码片段。 i = 3; j = ++ i + i; 按照前面我们讲过的原理,在第二行的表达式里,CPU读取第一个i值(求++i的值)之前,需要完成将i赋值为i+1这个副效应。但问题在于,在前后两个序点之间,CPU需要两次读取i的值,我们并不清楚会先读哪个i,这个次序选择权在于编译器。我们根本无法控制。也就是说,上面那句话可能表示两种不同的运算语意,产生两种完全不同的运算结果。 语意一 完成副效应i=i+1(i的值变为4) 读第一个i值(此时赋值的副效应已经完成,i的值为4) 读第二个i值(i值已经变为了4,这个i值自然也不例外) 两次读得的i值相加,把结果写入j内存(结果即是8) 语意二 读第二个i值(此时i值为3) 完成副效应i=i+1(i的值变为4) 读第一个i值(此时赋值的副效应已经完成,i的值为4,于是出现了第一个i值和第二个i值之间的值并不相等的现象) 两次读得的i值相加,把结果写入j内存(结果竟然是7) 由于C语言并未明确规定这些运算的次序,因此在完全符合C语言语法规则的前提下,竟然能得到两种结果,这就是所谓的“二义性”。 编写程序时候是不可能容忍代码存在这种“二义性”的,否则程序很可能就变成了“鸡同鸭讲”。代码必须具备唯一确定的语意。 除了涉及到序点,C语言没有规定编译器在这种情况下应该究竟选择哪种语意,这样,表达式 j = ++ i + i就成了一种未定义行为。如同前面曾经提到的那样,这种未定义行为尽管不违背C语言的语法规则,但本质上却是一种错误的代码。 以这里讨论的表达式为例,在求“+”运算符右边的i值的时候,从C语言或代码的角度来说,并不能确定i在内存中确切的值。因为在求“+”左面的操作数——表达式“++i”的值的时候可能改变i的值。由于没有规定求“++i”的值和求“+”右边的i值这两个动作之间的次序,于是求表达式“++ i + i”的值就成了一个未定义的行为。 未定义的行为出现在代码中,就是一个“语病”。只不过这里我们说的“语病”不是那种不符合语法要求的语病,而是那种语法上符合要求,但在语言或代码层面却无法确定其唯一含义的语病。比如,有一个大家很熟悉的广告词――“xx皮鞋,足以自豪的皮鞋”,语法上这句话绝对没有问题,但那个“足”字显然是一语双关的,作为广告语这很好,但编程不是做广告,计算机也不会听你忽悠,它只接受具体明确的、不带有“二义性”的指令。而代码中没有语法错误的“二义性”会导致编译器为你“胡乱”选择一种语意。这当然是不可接受的。 根据程序运算结果揣测j = ++ i + i这样未定义行为没有确定含义的表达式的含义是肤浅幼稚的。因为未定义行为不但是不可能预测的,同样也不可以逆向推测。它产生什么样的后果都不奇怪,哪怕让机器死机,关闭电源甚至火山爆发。C语言的学习者之间经常会出现很多类似这样的可笑对话:一个学习者问,为什么这个计算机(编译器)说“足以自豪的皮鞋”里面的“足”字是“脚”的意思,而不是“足够”的意思?另一个学习者立刻反驳,不对!我的计算机(编译器)明明说“足”是足够的意思嘛! 这两个不明就里的学习者也许会争论上好一阵子,却也得不出一个所以然来。本书的读者对此应该有个清晰的认识,能够很轻松地告诉他们代码“二义性”的来龙去脉。 下面,列出了一些C语言中典型的“二义性”例子。 int i = 3,j; j = (++i)+(++i)+(++i); (i++)+ (i++)+(i++) i = i++ printf(“%d %d\n”, i , i++ ); p=(++p>0)?(p++) :p++); j = (i = 4) + (i = 5) ; 执行 int k = 11 ; k = 1/3*k++;后,k的值是____。 a += a -= a * a 这些例子,都会让编译器陷入那个“足”是脚还是足够的疑惑。写出这种表达式的人,说明其对于运算符的真实含义还是缺乏了解。可惜的是,在现在国内很多专业的C语言论坛中,还是会有不少程序员,在这个问题上疑惑不解。 这些人往往都还有另一个误区,这个误区就是把优先级和结合性与运算次序相混淆,他们难以理解为什么优先级高的反而后计算。比如下面的表达式: j + i ++ 在这个表达式中,“++”的优先级最高,但这个运算却不是最先进行的。这里的优先级只是决定了“++”这个运算符的运算对象是i,而不是“j+i”,即: j + (i ++ ) 也就是说这个表达式的意义是计算“j+ i”的值,再加上一个副效应。而这个副效应发生的时间,我们只知道会是在编译器求完i值之后,但我们无法知道会是发生在计算“j+i”值的之前还是之后。 然而,不少人把优先级理解成了小学里的“先乘除后加减”,这是完全的误解。这里需要再次强调的是,优先级和运算次序完全是两回事! 对于初学者来说,另外一个错误不得不提。就是,++或--(无论前缀或后缀),只能用于左值。比如,int i; “++i”是可以的,因为i是左值;但++(i+1)是一个语法错误。因为(i+1)只有值的含义不可能表示一块连续的具有类型含义的内存(左值),因此(i+1)只是一个右值表达式。在目前这个学习阶段,只有变量名这种初级表达式是左值表达式。 4. 总结 好了,现在我们完全搞清了“++”运算符的来龙去脉。那么,在代码中应该如何避免上面所提到的“二义性”问题呢? 首先,我们需要把握一个原则,即不在两个序点之间更改同一个变量(严格的术语是对象)两次或更多次(a += a -= a * a就是违背了这种原则的错误代码)。如果两个序点之间只写一次同一对象的值,但同时还存在着读这个对象值的情况,那么必须确保写这个对象的值发生在读这个对象值之后。所以,表达式 i = i + 1 的行为是确定的,而表达式++ i + i则属于未定义的行为。 其次,尽量少使用可能引发“二义性”的复杂表达式。熟练的程序员在使用“++”这类运算符时是极其审慎的,在利用“++”的副效应时,一定要确保不会发生出乎自己意料之外的结果。 或许有人会问,这么麻烦干什么,直接取消可恶的“副效应”不久可以了吗?然而,“副效应”真的那么可恶吗?是否取消了副效应就可以一了百了了呢?其实不是的。 副效应不一定是什么坏事。比如前面例子中for语句中的“++”就是利用了其将i值加1的副效应使得代码写得非常简洁,而求得的i值本身倒是没有什么用处的。 而且,没有副效应的表达式语句,在编译器看来是可以不理睬的废话。比如: 2 + 4 ; 这句话,几乎所有的编译器都不会执行。我们最常用的printf()函数,其实多数情况下使用的是它的副效应,而函数调用得到的值几乎很少被用到。编译器对这样有副效应的表达式语句不可能置之不理。 因此,副效应是非常有用的,有时候甚至是必须的。作为一个合格的程序员,应该善于使用副效应。但是在涉及到改变变量在内存中的值的表达式中,一定要慎重,否则就会像前文中那些例子一样,画虎不成反成犬。 |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值