JAY 发表于 2006-12-26 22:15:52

Windows窗口是用Win32API做的。至于怎么做Windows应用程序建议去看看《Programming Windows》

leesoft 发表于 2006-12-26 22:19:18

窗口与语言无关

wqstar028 发表于 2006-12-27 10:28:44

那窗口中的最大化最小化的功能都不是用C语言写出来的罗?
还有,那个鼠标坐标是怎么得到的?

leesoft 发表于 2006-12-27 10:39:06

就是说:窗口是操作系统的一部分,而不上语言的特性
用basic语言也可写窗口

wqstar028 发表于 2006-12-27 10:51:55

那如果要学做windows下的*.exe应用程序一般要看什么书呢?LEE能帮我推荐一本吗?我好买来系统学习一下!谢谢了!

JAY 发表于 2006-12-27 12:23:27

我的沙发贴不就告诉你了么...算了...都被无视了...

wqstar028 发表于 2006-12-27 13:48:56

引用第6楼yzk0370于2006-12-27 12:23发表的“”:
我的沙发贴不就告诉你了么...算了...都被无视了...
非常抱歉!是我大意了!谢谢你啊!
谢谢大家的帮忙!

starwing 发表于 2007-1-1 19:20:14

最近淘到一本《Windows下的C/C++高级编程》,好像刚好就可以回答LZ的问题~~

LavaMX 发表于 2007-1-9 17:00:52

用C#吧,那个做窗口容易~

zhoufan 发表于 2007-1-27 18:09:18

WIN32API

tzp_1210 发表于 2007-2-7 18:52:08

Windows 窗口 有专门的API函数
C可能难以实现一点

冰渊 发表于 2007-2-7 23:44:21

我觉得还是Delphi好,很多东西都设计好了的,虽然说最近Borland发展得不怎么样,我还是一直支持Delphi的(偶Pascal学开头的,呵呵!)

songfei 发表于 2007-2-15 22:14:07

学 VC#直接就可以画窗口

songfei 发表于 2007-2-15 22:18:18

#include <windows.h>

/*Declare Windows procedure*/
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

/*Make the class name into a global variable*/
char szClassName[ ] = "WindowsApp";

int WINAPI WinMain (HINSTANCE hThisInstance,
            HINSTANCE hPrevInstance,
            LPSTR lpszArgument,
            int nFunsterStil)

{
   HWND hwnd;          /* This is the handle for our window */
   MSG messages;      /* Here messages to the application are saved */
   WNDCLASSEX wincl;      /* Data structure for the windowclass */

   /* The Window structure */
   wincl.hInstance = hThisInstance;
   wincl.lpszClassName = szClassName;
   wincl.lpfnWndProc = WindowProcedure;    /* This function is called by windows */
   wincl.style = CS_DBLCLKS;            /* Catch double-clicks */
   wincl.cbSize = sizeof (WNDCLASSEX);

   /* Use default icon and mouse-pointer */
   wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
   wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
   wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
   wincl.lpszMenuName = NULL;            /* No menu */
   wincl.cbClsExtra = 0;               /* No extra bytes after the window class */
   wincl.cbWndExtra = 0;               /* structure or the window instance */
   /* Use Windows&#39;s default color as the background of the window */
   wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;

   /* Register the window class, and if it fails quit the program */
   if (!RegisterClassEx (&wincl))
      return 0;

   /* The class is registered, let&#39;s create the program*/
   hwnd = CreateWindowEx (
      0,             /* Extended possibilites for variation */
      szClassName,      /* Classname */
      "Windows App",   /* Title Text */
      WS_OVERLAPPEDWINDOW, /* default window */
      CW_USEDEFAULT,   /* Windows decides the position */
      CW_USEDEFAULT,   /* where the window ends up on the screen */
      544,            /* The programs width */
      375,            /* and height in pixels */
      HWND_DESKTOP,      /* The window is a child-window to desktop */
      NULL,         /* No menu */
      hThisInstance,   /* Program Instance handler */
      NULL            /* No Window Creation data */
      );

   /* Make the window visible on the screen */
   ShowWindow (hwnd, nFunsterStil);

   /* Run the message loop. It will run until GetMessage() returns 0 */
   while (GetMessage (&messages, NULL, 0, 0))
   {
      /* Translate virtual-key messages into character messages */
      TranslateMessage(&messages);
      /* Send message to WindowProcedure */
      DispatchMessage(&messages);
   }

   /* The program return-value is 0 - The value that PostQuitMessage() gave */
   return messages.wParam;
}


/*This function is called by the Windows function DispatchMessage()*/

LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
   switch (message)            /* handle the messages */
   {
      case WM_DESTROY:
      PostQuitMessage (0);   /* send a WM_QUIT to the message queue */
      break;
      default:               /* for messages that we don&#39;t deal with */
      return DefWindowProc (hwnd, message, wParam, lParam);
   }

   return 0;
}

songfei 发表于 2007-2-15 22:22:02

这个是一个最简单的窗口

调用windows api

显示窗口 刷新窗口 消息循环

wqstar028 发表于 2006-12-26 21:37:58

在C语言中,窗口是怎么做出来的?

自学TC这么久了,写的程序都是在一个DOS窗口里运行的,想问一下各位,那些WINDOWS的窗口是怎么做的?
还有,鼠标操作是怎么完成的?
还有,最大化,最小化是怎么完成的?
望高手解释一下!谢谢!


我是C语言的新手,各位别打我啊!!我闪!
页: [1]
查看完整版本: 在C语言中,窗口是怎么做出来的?