#include "windows.h"
//#include <stdio.h>
LRESULT CALLBACK WNDFUN(HWND hWnd,UINT msg,WPARAM wparam,LPARAM lparam);
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
WNDCLASS wndcls;
wndcls.style = CS_DBLCLKS|CS_VREDRAW|CS_HREDRAW;
wndcls.lpszMenuName = NULL;
wndcls.lpszClassName = "yunzhongyue";
wndcls.lpfnWndProc = WNDFUN;
wndcls.hInstance = GetModuleHandle(NULL);
wndcls.hIcon = NULL;//LoadIcon(NULL,IDI_APPLICATION);
wndcls.hCursor = NULL ;// LoadCursor(NULL,IDC_ARROW)
wndcls.hbrBackground =(HBRUSH)GetStockObject(WHITE_BRUSH/*GRAY_BRUSH*/);
wndcls.cbClsExtra = 0;
wndcls.cbWndExtra = 6;
RegisterClass(&wndcls);
HWND hwnd;
hwnd = CreateWindow("yunzhongyue","Win32App_yunzhongyue",WS_CAPTION|WS_OVERLAPPEDWINDOW|WS_SYSMENU,500,50,400,400,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,SW_SHOW);
UpdateWindow(hwnd);
MSG msg;
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
//return 0;
}
LRESULT CALLBACK WNDFUN(HWND hWnd,UINT msg,WPARAM wparam,LPARAM lparam)
{
switch(msg)
{
case WM_PAINT:
{
HDC hdc = GetDC(hWnd);
SetBkMode(hdc,TRANSPARENT);
TextOut(hdc,120,80,"云中岳好样的",12);
DeleteDC(hdc);
break;
}
case WM_RBUTTONDOWN:
MessageBox(hWnd,"mouse clicked","weixin",0);
break;
case WM_LBUTTONDOWN:
MessageBox(hWnd,"mouse clicked","weixin",0);
HDC hdc;
hdc=GetDC(hWnd);
TextOut(hdc,50,50,"计算机编程语言培训",strlen("计算机编程语言培训"));
case WM_CLOSE:
{
DestroyWindow(hWnd);
break;
}
case WM_DESTROY:
{
PostQuitMessage(0);
break;
}
default:
return DefWindowProc(hWnd ,msg,wparam,lparam);
}
return 0;
}
以下是转载内容:
#include <windows.h
#include <stdio.h>
LRESULT CALLBACK WinSunProc(
HWND hwnd, // handle to window //窗口句柄
UINT uMsg, // message identifier //消息
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter //附加参数
);
int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance //当前实例句柄
HINSTANCE hPrevInsta
LPSTR lpCmdLine, // command line
int nCmdShow
)
{
WNDCLASS wndcls;
wndcls.cbC
wndcls.cbW
wndcls.hbr
//窗口类的背景画刷句柄
wndcls.hCu
wndcls.hIc
wndcls.hIn
wndcls.lpf
wndcls.lps
wndcls.lps
wndcls.sty
//当窗口发生变化时窗口
RegisterCl
//创建窗口
HWND hwnd;
hwnd=Creat
/*HWND CreateWind
LPCTSTR lpClassNam
LPCTSTR lpWindowNa
DWORD dwStyle, // window style //所创建窗口的具体样式
int x,
int y,
int nWidth,
int nHeight, // window height //窗口的宽度和高度
HWND hWndParent
HMENU hMenu, // handle to menu or child-wind
HANDLE hInstance, //handle to applicatio
LPVOID lpParam // pointer to window-cre
);*/
ShowWindow
UpdateWind
MSG msg;
while(GetM
{
}
return 0;
}
LRESULT CALLBACK WinSunProc(
HWND hwnd, // handle to window //窗口句柄
UINT uMsg, // message identifier //消息
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter //附加参数
)
{
switch(uMs
{
case WM_CHAR:
case WM_RBUTTON
case WM_LBUTTON
HDC hdc,
int nXStart, // x-coordina
int nYStart, // y-coordina
LPCTSTR lpString, // pointer to string
int cbString // number of characters
case WM_PAINT:
case WM_CLOSE:
case WM_DESTROY
default:
}
return 0;
}