草庐IT

win_class

全部标签

C++ 风格约定 : Parameter Names within Class Declaration

我是一个相当新的C++程序员,我想听听支持和反对在类声明中命名参数的争论。这是一个例子:Student.h#ifndefSTUDENT_H_#defineSTUDENT_H_#includeusingnamespacestd;classStudent{private:stringname;unsignedintage;floatheight,GPA;public:Student(string,unsignedint,float,float);voidsetAge(unsignedint);};#endif/*STUDENT_H_*/对比#ifndefSTUDENT_H_#defineS

c++ - c++ 中是否有任何类是所有类的父类(super class)?

像javaJava.lang.Object是所有类的父类(superclass)所以在C++中是否有任何类像对象? 最佳答案 不,没有。在C++中,您为使用的东西付费,而不是更多。你可以有void*可以指向任何东西,或者如果有意义的话,写你自己的基类。 关于c++-c++中是否有任何类是所有类的父类(superclass)?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/1831

c++ - 如何从 win32 应用程序的命令行参数中获取 std::string?

所以现在我有一个intmain(intargc,char*argv[]){}如何使它基于字符串?intmain(intargc,std::string*argv[])就够了吗? 最佳答案 你不能改变main的签名,所以这是你最好的选择:#include#includeintmain(intargc,char*argv[]){std::vectorparams(argv,argv+argc);//...return0;} 关于c++-如何从win32应用程序的命令行参数中获取std::st

封装win10系统并保存为iso格式【一】

封装WINDOWS10系统封装win10系统并保存为iso格式【一】:https://www.cnblogs.com/jw35/p/18006534封装win10系统并保存为iso格式【二】: https://www.cnblogs.com/jw35/p/18006738封装win10系统并保存为iso格式【完】: https://www.cnblogs.com/jw35/p/18006752一、准备工具:1、安装NTLite。下载链接:https://www.ntlite.com/download/2、准备一个ISO的PE例如:FirPE。下载链接https://firpe.cn/page-

C++ -- Detours (Win32 API Hijacking) -- 劫持类方法

很长一段时间我都没有遇到使用Detours劫持函数的问题...当我试图劫持类方法时(在我的例子中是IHTMLDocument2::writefrommshtml.dll)我遇到了无穷无尽的问题(主要是类型不匹配)。由于我没有在网上找到任何相关示例,我开始怀疑是否可以这样做。我的问题是:是否可以使用Detours劫持类方法?我可以举个例子吗?如果不是,是否可以使用另一个Hook库以更简单的方式劫持类方法?提前谢谢大家! 最佳答案 IHTMLDocument2::write不仅仅是一个类方法;这是一个COM方法。这意味着更多。例如,还有

c++ - 模板类中函数指针的成员给出错误 : must be a class or namespace when followed by '::'

我试图在C++中声明一个模板函数指针。templateclassMyClass{public:typedefconstunsignedchar*(T::*MyTemplatedEvent)(unsignedlong&myParameter);};但出于某种原因,我不断收到此错误:'T':mustbeaclassornamespacewhenfollowedby'::'有人能告诉我哪里做错了吗?编译器应该知道T是一个类。它在MyClass声明上方这样说...... 最佳答案 对于T::*MyTemplatedEvent,您期望T是类类

c++ - 非类型模板参数 : how to pass reference to base class object?

似乎无法传递对的引用派生对象的基类对象作为模板参数,正如我在这里尝试做的那样:structa{int_v;constexpra():_v(0){}constexpra(intv):_v(v){}};structc:publica{constexprc():a(){}constexprc(intv):a(v){}};externconstcdefault_a;constexprconstcdefault_a{1};consta&c_as_a=default_a;//^--thisline(16)causesnoerror-ccanbeconvertedtoatemplatestructb

C++ 模板 "class type"错误

我一直在研究一个链表模板类来对各种变量做同样的事情,并设法解决了大部分问题。除了编译时,我得到这些:g++-Wall-otemplate_testtemplate_test.cppInfileincludedfromtemplate_test.cpp:1:0:LinkedList.h:50:11:error:declarationof‘classType’LinkedList.h:7:11:error:shadowstemplateparm‘classType’LinkedList.h:51:30:error:invaliduseofincompletetype‘classLinked

c++ - 为什么 injected-class-name 有时不被视为类模板中的模板名称?

SourceInthefollowingcases,theinjected-class-nameistreatedasatemplate-nameoftheclasstemplateitself:itisfollowedbyitisusedasatemplateargumentthatcorrespondstoatemplatetemplateparameteritisthefinalidentifierintheelaboratedclassspecifierofafriendclasstemplatedeclaration.所以我尝试检查所有3种情况(另外在基本歧义的情况下,尽管我

c++ - 如何在没有延迟的情况下从 Win32 中的另一个进程捕获标准输出?

我想做的类似于VisualStudio在其输出窗口或其他编辑器在其工具窗口中所做的:从我的进程A启动另一个进程B并捕获其stdout/stderr输出。到目前为止,我使用CreatePipe()让它工作,但由于某种原因,B的输出在写入时并没有立即到达B。它的行为更像是某种缓冲区被填满,当缓冲区已满时,所有缓冲区内容立即到达A。我编写了自己的测试程序,该程序输出一些内容并随后直接执行fflush(stdout)。然后输出直接到达A。但是我不能更改我想那样使用的所有B进程的代码。尝试从A冲洗管道也不起作用。这应该如何工作?我的初始化代码和消费代码:sa.nLength=sizeof(SEC