资源简介
作者:Mason McCuskey,科学出版社
全书24章,另附录。
代码片段和文件信息
/*
#############################################################################
Ch1p1_HackedWindowProc.cpp: illustrates what happens if you just create a
blank windowproc.
#############################################################################
*/
// Include Directives ///////////////////////////////////////////////////////
#include // we need this header for all windows programs
/****************************************************************************
WindowProc: our hacked WindowProc function. We don‘t actually do anything
here we just always return 1 to indicate success.
****************************************************************************/
LRESULT CALLBACK WindowProc(
HWND hwnd // handle to window
UINT uMsg // message identifier
WPARAM wParam // first message parameter
LPARAM lParam // second message parameter
)
{
return(1);
}
/****************************************************************************
InitWindow: creates a window class and a window.
****************************************************************************/
HWND InitWindow(HINSTANCE hinst int nCmdShow)
{
HWND hwnd; // the window handle we obtain will be put here
WNDCLASSEX wc;
// set up and register window class
memset(&wc 0 sizeof(wc));
wc.cbSize = sizeof(wc);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WindowProc; // change this to NULL and crash!
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hinst;
wc.hIcon = NULL;
wc.hIconSm = NULL;
wc.hCursor = LoadCursor(NULL IDC_ARROW);
wc.hbrBackground = NULL;
wc.lpszMenuName = NULL;
wc.lpszClassName = “MyCoolWindow“;
RegisterClassEx(&wc);
// create a window that‘s 200 pixels wide 100 tall
hwnd = CreateWindowEx(0 “MyCoolWindow“ “My First Window“
WS_POPUP 50 50 200 100 NULL NULL hinst NULL);
if (!hwnd) {
::MessageBox(NULL “CreateWindow failed!“ “Ch1p1_HackedWindowProc“ MB_IConstop);
exit(-1);
}
ShowWindow(hwnd nCmdShow);
return(hwnd);
}
/****************************************************************************
WinMain: program execution starts here.
****************************************************************************/
int APIENTRY WinMain(HINSTANCE hInstance
HINSTANCE hPrevInstance
LPSTR lpCmdLine
int nCmdShow)
{
// create a window
HWND hwnd = InitWindow(hInstance nCmdShow);
// exit!
return 0;
}
- 上一篇:编译原理的实验12376
- 下一篇:君正t31智能视频应用处理器datasheet
相关资源
- Scratch源码
- bp神经网络源代码,可直接运行
- E4A无障碍跨程序操作类库(带源码、
- 设备管理系统源码
- 安卓wifi直连app源码
- 我的世界源码(易语言版)
- labview编程软件滤波器以及编写程序设
- 我的界面(visual foxpro)源码
- 易语言:一键cf基址源码
- 仿知乎界面小程序源代码
- The Secret Path 3D 3D魔方迷宫[源码][scra
- scratch垃圾分类源码(最终版本).sb
- 贪吃蛇源代码.fla
- 安卓QQ6.71协议源码易语言,qq协议源码
- 编译原理实验工具及参考源码(lex&
- E盾偷后台工具源码
- UNIX/LINUX编程实践教程的源码
- dotnet 写字板 实验 源代码 不好请要不
- 图像二维小波变换的实现源代码
- 八三编码器设计 VHDL代码 简单,包附
- 十以内加减法练习 powerbuilder源码
- linux应用层的华容道游戏源代码
- 农场开发项目
- 网上拍卖系统完整源代码
- OCR源码
- CSMA/CD等动画演示加源代码
- PLC上位机编程软件
- 用foobar2000听google音乐[更新一下]
- silicon lab公司的收音IC SI47XX全套开发工
- 学生信息管理系统源码
评论
共有 条评论