更新时间:2023-11-09 13:35:52
可以通过cygwin程序通过包含"windows.h"头文件来访问Win32 API.当然,这意味着您已经安装了win32软件包.这是一个示例程序:
The Win32 API can be accessed from a cygwin program by including the "windows.h" header file. It implies that you have the win32 packages installed, of course. Here is an example program:
#include <iostream>
#include <string>
#include <windows.h>
int main(int argc, char *argv[])
{
std::string val;
if (argc > 1)
{
val = argv[1];
}
std::cout << "You typed: " << val << std::endl;
::MessageBox(NULL, val.c_str(), "You Typed:", MB_OK);
return 0;
}
这可以编译并与"make filename"链接,其中filename.cpp包含上述源.然后在bash提示符下键入./filename xxxx来执行.然后xxxx将出现在消息框窗口中.
This can be compiled and linked with "make filename" where filename.cpp contains the above source. Then execute by typing ./filename xxxx at the bash prompt. Then xxxx will appear in a message box window.