C语言winapi中的noob记事本克隆 [英] noob Notepad Clone in C winapi

查看:67
本文介绍了C语言winapi中的noob记事本克隆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用《伪造者指南》(Forger's Tutorial)进行自我C WINAPI编程的教学,并决定制作一个记事本克隆.为了我的生命,我不知道如何辨别是否已选择文本",因此可以动态启用和禁用菜单项.

I am teaching my self C WINAPI programming using the Forger''s Tutorial and decided to make a Notepad Clone. For the life of me I can not figure out how to tell if Text has been selected so I can Dynamically Enable and Disable Menu Items.

推荐答案

您使用的是什么控件?很难知道在C中可以使用什么功能,在C ++中,我确定文本框具有属性,并且可能是选择更改的事件.

您为什么选择学习C?它并没有太多用,当然也不是用来编写Windows程序.
What control are you using ? It''s hard to know what''s available to you in C, in C++ I am certain the textbox has properties and probably a selection changed event.

Why would you choose to learn C ? It''s not used for much of anything, and certainly not for writing windows programs.


我选择C是因为它是一个很好的开始.足够复杂以了解内部工作原理,但避免了对象的复杂性.我的议程中的下一个是Stromcodes教程,我敢肯定,有一种方法可以使用EM_GETSEL并比较WPARAM和LPARAM来确定它们是否相等,如果没有选择任何文本,则应该使用C_做到这一点(WPARAM和LPARAM应该如果未选择任何文本,都将返回光标位置). C ++正在我的眼前,但目前我对C#毫无兴趣.
I picked C because it is a good starting position. Complicated enough to get an understanding of the inner workings but avoids the complications of objects. Stromcodes tutorial is next on my agenda I am sure there is a way to do it in C something using the EM_GETSEL and comparing the WPARAM and LPARAM to see if they are equal, which they should be if no text is selected ( WPARAM and LPARAM should both return the cursor position if no text is selected ). C++ is on my horizon, but I have no interest in C# at this point in time.


您的推理是错误的. C ++比C有用得多,C只会教您如何编写BAD C ++代码.最好避免使用任何看起来像C的东西,并学习C ++. C#对于Windows编程更有用,但它与C或C ++根本无关,因此,如果您想学习一门更难的语言,则可以学习C ++,而C只会教您如何做事情很糟糕.
Your reasoning is faulty. C++ is far more useful than C, and C will only teach you how to write BAD C++ code. Far better to avoid anything that looks like C, and learn C++. C# is more useful for windows programming, but it''s not related to C or C++ at all, so if you want to learn a harder language, C++ is the one to learn, and C is only going to teach you how to do things badly.


这篇关于C语言winapi中的noob记事本克隆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆