使用C语言进行GUI编程。 [英] GUI Programming with C language.
问题描述
先生或女士,我想在Windows平台的C中制作一个gui应用程序。当我谷歌的时候,我发现它是一种完全不同的语言。
请帮助我。告诉我,要制作一个GUI,我必须学习win32 api编程,但除了预处理命令之外,我找不到c和win32 api之间的任何相似性。
please ..告诉我..
Sir or Madam, I want to make a gui application in C in windows platform. When i google about it , i found that its a totally different language.
Please help me. tell me ,to make a GUI i have to study the win32 api programming , but i can't find any similarity between c and win32 api except preprocessing commands.
please .. tell me..
推荐答案
我不确定我是否相信你断言他们是完全不同的语言。 C中使用标准运行时库的简单hello world应用程序可能如下所示:
I'm not sure I believe your assertion that they're "a totally different language." A simple hello world app in C using the standard runtime library might look like:
#include <stdio.h>
int main()
{
puts( "Hello World!" );
}
使用Windows API时看起来像:
while using the windows API it looks like:
#include <windows.h>
int main()
{
MessageBoxA( NULL, "Hello World!", "Hello", MB_OK );
}
唯一不同的是你用来输出的功能。
编写一个需要调度一组嵌套命令的标准C程序,你会发现使用Windows API的Windows编程是非常多的C编程。我建议阅读Charles Petzold的Programming Windows作为在Windows上成为熟练的GUI程序员的良好开端。你想要大约2000年出版的第5版。这是一本旧书,其中一些编程技术有点介绍,但它是一本非常好的入门书。
干杯,
Ash
The only difference there is the function you use to do the output.
Write a standard C program that needs to dispatch a set of nested commands and you'll see that Windows programming using the Windows API is very much C programming. I'd suggest reading "Programming Windows" by Charles Petzold as a good first start on becoming a proficient GUI programmer on Windows. You want the 5th edition which came out about 2000. It's an old book and some of the programming techniques grate a bit but it's a very good introductory book.
Cheers,
Ash
引用:但是除了预处理命令之外,我找不到c和win32 api之间的任何相似性。
如果您从Visual Studio或Visual C ++ Express IDE创建新的Windows应用程序,您会发现它全部用C语言编写,这是不正确的。更多信息有关API的信息,请参阅此处 [ ^ ]。
但是,如果使用MFC创建应用程序,则使用C ++,这是不同的。
Quote: "but i can't find any similarity between c and win32 api except preprocessing commands."
This is not true, if you create a new Windows application from the Visual Studio or Visual C++ Express IDE you will find that it is all written in C. For more information on the API see here[^].
However, if you create an application using MFC it is in C++, which is different.
查看编程Windows,第5版,Charles Petzold [ ^ ]
这可能是Win32编程的最佳可用介绍。
祝你好运:-)
Espen Harlinn
Have a look at Programming Windows, 5th Edition, by Charles Petzold[^]
This is perhaps the best available introduction to Win32 programming.
Good luck :-)
Espen Harlinn
这篇关于使用C语言进行GUI编程。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!