摘要:作者: 广东省深圳市温卫红陈耀光 (ewardchen@21cn.com)
开发基于 windows nt/2000的程序时,程序员往往需要知道系统是否处于屏幕保护状态,然后可以根据不同的状态在程序中做出相应的处理,如改变程序运行的优先级、先执行低优先级的例行工作等,以优化系统性能。微软公司在 windows 2000操作系统中提供了 systemparametersinfo() api函......
摘要:// registry.cpp
#include "stdafx.h"
#include "registry.h"
cregistry::cregistry()
{
m_hkey = null;
open( _hkey, m_strusekey );
}
cregistry::cregistry( hkey hkey, const ......
用VC++制作一个简单的局域网消息发送工程上一页 ...
extern cstring bb; 【程序编程相关:
让你的VC程序动起来】
【推荐阅读:
在Windows95/98中实现苹果窗口】
{ 【扩展信息:
VC用Ado接口连接和使用数据库】
void caboutdlg::onkillfocus(cwnd* pnewwnd)
// todo: add your message handler code here
cdialog::onkillfocus(pnewwnd);
bb=m_edit;
}
对于oicqview类
char aa[100];
cstring mm;
cdc* pdc;
class mysock:public csocket //派生mysock类,此类既有接受功能
{public:void onreceive(int nerrorcode) //可以随时接收信息
{
csocket::receive((void*)aa,100,0);
mm=aa;
cstring ll=" ";//在显示消息之前,消除前面发送的消息
pdc->textout(50,50,ll);
pdc->textout(50,50,mm);
}
};
mysock sock1;
cstring bb;
bool coicqview::onsetcursor(cwnd* pwnd, uint nhittest, uint message)
{
cview::onsetfocus(poldwnd);
// todo: add your message handler code here and/or call default
bb="besting:"+bb; //确定发送者身份为besting
sock1.sendto(bb,100,1060,"192.168.0.255",0); //获得焦点以广播形式发送信息,端口号为1060
return cview::onsetcursor(pwnd, nhittest, message);
}
int coicqview::oncreate(lpcreatestruct lpcreatestruct)
{
if (cview::oncreate(lpcreatestruct) == -1)
return -1;
sock1.create(1060,sock_dgram,null);//以数据报形式发送消息
static cclientdc wdc(this); //获得当前视类的指针
pdc=&wdc;
// todo: add your specialized creation code here
return 0;
}
运行一下,打开about对话框,输入发送信息,enter键就可以发送信息了,是不是有点像qq啊?
摘要:- windows中有一系统热键alt+f4用来关闭当前窗口,笔者最近出于兴趣,用vc++ 6编写了一个程序用来实现此热键功能.实现思想如下:
---- 1.创建一个不在任务栏显示图标的窗口.
---- 2.在程序中注册一个系统热键,并在通知栏为程序创建一个图标..
---- 3.禁止多个程序同时运行.
---- 4.通过枚举窗口函数关闭当前窗口.
---- 一、创建一个不在任务栏显示图标的......