| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 445 人关注过本帖
标题:创建windows窗口 求改码 真心不会改了
只看楼主 加入收藏
vc小白
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2011-9-25
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:3 
创建windows窗口 求改码 真心不会改了
#include<windows.h>
#include<stdio.h>
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain(HINSTANCE hInstances,HINSTANCE hPrevInst,LPSTR lpszCmdLine,int nComdShow)
{
    HWND hwnd;
    MSG Msg;
    WNDCLASS wndclass;
    char lpszClassName[]="窗口";
    char lpszTitle[]="My_Windows";

    //窗口类定义
    wndclass.style=0;
    wndclass.lpfnWndProc=WndProc ;
    wndclass.cbWndExtra=0 ;
    wndclass.hinstance=hinstance ;
    wndclass.hIcon=LoadIcon(NULL,IDI_APPLICATION);
    wndclass.hCursor=LoadCursor( NULL,IDC_ARROW);
    wndclass.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
    wndclass.lpszMenuName=NULL ;
    wndclass.lpszClassName=lpszClassName ;


//-------以下进行窗口类的注册----
    if(!RegisterClass(&wndclass))
    {
        MessageBeep(0);
        return FALSE;

    }
 
    //创建窗口
    hwnd=CreateWindow(
                        lpszClassName,
                        lpszTitle,
                        WS_OVERLAPPEDWINDOW,
                        CW_USEDEFAULT,
                        CW_USEDEFAULT,
                        CW_USEDEFAULT,
                        CW_USEDEFAULT,
                        NULL,
                        NULL,
                        hInstance,
                        NULL
                        );
    ShowWindow( hwnd, nCmdShow);
    UpdateWindow(hwnd);
    while( GetMessage(&Msg, NULL, 0,0))
    {
        TranslateMessage( &Msg);
        DispatchMessage( &Msg);

    }
   
    //窗口函数
    LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
    {
        switch(message)
        {
        case WM_DESTROY:
             PostQuitMessage(0);
        default:
            return DefWindowProc(hwnd,message,wParam,lParam);
        }
    return(0);
    }
   
   














}
搜索更多相关主题的帖子: windows include 
2011-09-25 17:50
czsbc
Rank: 10Rank: 10Rank: 10
等 级:青峰侠
帖 子:469
专家分:1700
注 册:2008-12-13
收藏
得分:20 
程序代码:
#include<windows.h>
#include<stdio.h>

 LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);

 int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInst,LPSTR lpszCmdLine,int nCmdShow)

 {
     HWND hwnd;
     MSG Msg;
     WNDCLASS wndclass;
     char lpszClassName[]="窗口";
     char lpszTitle[]="My_Windows";

    //窗口类定义
     wndclass.style=0;
     wndclass.lpfnWndProc=WndProc ;
     wndclass.cbWndExtra=0 ;
     wndclass.cbClsExtra=0;
     wndclass.hInstance=hInstance ;
     wndclass.hIcon=LoadIcon(NULL,IDI_APPLICATION);
     wndclass.hCursor=LoadCursor( NULL,IDC_ARROW);
     wndclass.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
     wndclass.lpszMenuName=NULL ;
     wndclass.lpszClassName=lpszClassName ;


//-------以下进行窗口类的注册----
     if(!RegisterClass(&wndclass))
     {
         MessageBeep(0);
         return FALSE;

    }
     //创建窗口
     hwnd=CreateWindow(
                         lpszClassName,
                         lpszTitle,
                         WS_OVERLAPPEDWINDOW,
                         CW_USEDEFAULT,
                         CW_USEDEFAULT,
                         CW_USEDEFAULT,
                         CW_USEDEFAULT,
                         NULL,
                         NULL,
                         hInstance,
                         NULL
                         );
     ShowWindow(hwnd, nCmdShow);
     UpdateWindow(hwnd);
     while( GetMessage(&Msg, NULL, 0,0))
     {
         TranslateMessage( &Msg);
         DispatchMessage( &Msg);

    }
     return Msg.wParam;

 }
    //窗口函数
     LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
     {
         switch(message)
         {
         case WM_DESTROY:
              PostQuitMessage(0);
         default:
             return DefWindowProc(hwnd,message,wParam,lParam);
         }
     return(0);
     }

 
2011-09-25 17:58
vc小白
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2011-9-25
收藏
得分:0 
能加qq交流一下吗 我的364441753
2011-09-25 18:05
vc小白
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2011-9-25
收藏
得分:0 
#include<windows.h>
#include<stdio.h>
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInst,LPSTR lpszCmdLine,int nCmdShow)
{
    HWND hwnd;
    MSG Msg;
    WNDCLASS wndclass;
    char lpszClassName[]="′°?ú";
    char lpszTitle[]="My_Windows";

    //′°?úààμ??¨ò?
    wndclass.style=0;
    wndclass.lpfnWndProc=WndProc ;
    wndclass.cbWndExtra=0 ;
    wndclass.hInstance=hInstance ;
    wndclass.hIcon=LoadIcon(NULL,IDI_APPLICATION);
    wndclass.hCursor=LoadCursor( NULL,IDC_ARROW);
    wndclass.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
    wndclass.lpszMenuName=NULL ;
    wndclass.lpszClassName=lpszClassName ;


//----ò?????DD′°?úààμ?×¢2á
    if(!RegisterClass(&wndclass))
    {
        MessageBeep(0);
        return FALSE;

    }
 
    //′′?¨′°?ú
    hwnd=CreateWindow(
                        lpszClassName,
                        lpszTitle,
                        WS_OVERLAPPEDWINDOW,
                        CW_USEDEFAULT,
                        CW_USEDEFAULT,
                        CW_USEDEFAULT,
                        CW_USEDEFAULT,
                        NULL,
                        NULL,
                        hInstance,
                        NULL
                        );
    ShowWindow( hwnd, nCmdShow);
    UpdateWindow(hwnd);
    while( GetMessage(&Msg, NULL, 0,0))
    {
        TranslateMessage( &Msg);
        DispatchMessage( &Msg);


    }
    return Msg.wParam;
}
    //′°?úoˉêy

    LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
    {
        switch(message)
        {
        case WM_DESTROY:
             PostQuitMessage(0);
        default:
            return DefWindowProc(hwnd,message,wParam,lParam);
        }
    return(0);
    }
   



正解了 哈哈 多谢!!!!
2011-09-25 18:33
快速回复:创建windows窗口 求改码 真心不会改了
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017276 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved