代码活动 ---》模板(貌似大家没有兴趣啊)程序(聊天程序)
大家貌似没有激情,但我还是把模板程序写完了。先贴一下 前几天自己写的置顶程序。
这个程序是简单把一个目标的程序来置顶。
因为有时候自己写代码的时候要参考别人的代码写,但不方便 所以我自己写了一个简单的置顶程序。

// 置顶程序测试.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <stdio.h> #include <windows.h> int FindNameHwnd() { HWND hHd = FindWindow(0,"测试.txt - 记事本"); if(hHd == NULL) { printf("程序获取句柄失败"); return 1; } else { int flag = SetWindowPos(hHd,HWND_TOPMOST,0,0,0,0,SWP_NOSIZE|SWP_SHOWWINDOW); if(0 ==flag) { printf("设置失败"); return 1; } } return 0; } int GetCursorHwnd() { POINT ptXY; // 鼠标位置 HWND hwnd; //窗口句柄 Sleep(2000);//暂定2毫秒 int flag = GetCursorPos(&ptXY); if(!flag) { MessageBox(0,"获取鼠标位置失败",0,0); return 0; } else { hwnd = WindowFromPoint(ptXY); if(!hwnd) { MessageBox(0,"获取窗口句柄失败",0,0); return 1; } else { int flag = SetWindowPos(hwnd,HWND_TOPMOST,0,0,0,0,SWP_NOSIZE|SWP_SHOWWINDOW); if(0 ==flag) { MessageBox(0,"设置失败",0,0); return 1; } } } return 1; }
置顶附近

下面是活动程序,本来是想大家一起来写一个聊天的程序比赛,;来对聊天程序进行扩展。
结果大家兴趣不大,所以我的模板本来想是写几个版本的。但大家没有激情我就只写2个版本。
一个是c语言下的聊天程序,一个MFC下的聊天程序、
是把孙鑫视频写的、


c语言版本写了注释是方便新手写的,本来是想写的详细一点,但大家没有激情我就没有激情。
其实这个聊天程序其实可以考虑学习一下QQ的东西来写的。

