询问windows API应用程序如何调用类对象 [英] Ask windows API applications how to call class objects

查看:59
本文介绍了询问windows API应用程序如何调用类对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在vc.net项目下,窗口是通过windows api绘制的。

此时,我在我的项目中添加了一个类testClass,这是一个窗口。

通常你应该写这样的代码:

TestClass ^ frmTest = gcnew testClass(filepath);

FrmTest - > eReLoadFile + = gcnew EventHandler(this,& Form1 :: frmTest_eReLoadFile);

FrmTest - > ShowDialog();

但是如何表达Win32应用程序?



我尝试过的方法:



Under a vc.net project, windows are drawn through windows api.
At this point, I added a class testClass to my project, which is a window.
Normally you should write code like this:
TestClass ^ frmTest = gcnew testClass (filepath);
FrmTest - > eReLoadFile += gcnew EventHandler (this, & Form1:: frmTest_eReLoadFile);
FrmTest - > ShowDialog ();
But how should Win32 applications be expressed?

What I have tried:

TestClass ^ frmTest = gcnew testClass (filepath);
FrmTest - > eReLoadFile += gcnew EventHandler (this, & Form1:: frmTest_eReLoadFile);
FrmTest - > ShowDialog ();




Compile error




Error 413 Error C2061: Syntax Error: Identifier "testClass"

推荐答案

您的代码适用于Windows Forms,Win32(Winapi)应用程序是完全不同的野兽(例如,参见模块1.您的第一个Windows程序 - Windows应用程序| Microsoft Docs [ ^ ]。。
You code is for Windows Forms, Win32 (Winapi) applications are quite different beasts (see, for instance Module 1. Your First Windows Program - Windows applications | Microsoft Docs[^]).


你在代码中输入了一些拼写错误(使用了小写字母),后来用了大字母

You made some typo (used small letters) in your code, and used later big letters
TestClass ^ frmTest = gcnew TestClass (filepath);
frmTest - > eReLoadFile += gcnew EventHandler (this, & Form1:: frmTest_eReLoadFile);
frmTest - > ShowDialog ();

这不喜欢编译器!!!



更加注重细节。每一位都很重要; - )

That doesnt like the compiler!!!

Pay more attention to details. Every bit counts ;-)


这篇关于询问windows API应用程序如何调用类对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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