易截截图软件、单文件、免安装、纯绿色、仅160KB

自动更改桌面背景 c/c++ win32

这个程序仅供编程参考
若想在平时用,请下载微软的wallpaper changer
我这个程序实现了定时更换桌面背景的功能
命令行 wallpaper "your images' directory path" time_in_minute
编程要点
findfirstfile findnextfile 查找图像文件
SystemParametersInfo  修改系统信息,在这儿当然是桌面背景
注册表操作 保存信息
如果做得实用,应加入开机启动功能,自然还要gui
//wallpaper.c
//by onezeros@yahoo.cn||Zhijie Lee
//usage:wallpaper "full directory path" interval
// interval is in minutes
#include <windows.h>
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
/* argc=3;
argv[1]="E:\\picture\\testbmp";
argv[2]="1";
*/ LPCSTR currentDir;
LPCSTR currentImage;
int interval;

HKEY hKey;
WIN32_FIND_DATAA FileData;
HANDLE hFind;

//initialize parameters
if(argc==1){
//find parameters in registry
if(RegOpenKeyA(HKEY_LOCAL_MACHINE,(LPCSTR)"Software\\wallpaper",
&hKey)!=ERROR_SUCCESS||
RegQueryValueExA(hKey,(LPCSTR)"interval",0,NULL,
(LPBYTE)interval,NULL)!=ERROR_SUCCESS||
RegQueryValueExA(hKey,(LPCSTR)"directory",0,NULL,
(LPBYTE)currentDir,NULL)!=ERROR_SUCCESS||
RegQueryValueExA(hKey,(LPCSTR)"image",0,NULL,
(LPBYTE)currentImage,NULL)!=ERROR_SUCCESS){
//if connot be found ,wrong usage
cout<<"wrong usage"<<endl
<<"Please use it like this"<<endl
<<"wallpaper \"D:\\Files\\Images\" 30"<<endl
<<"30 is the interval in minutes or"<<endl
<<"wallpaper \"D:\\Files\\Images\""<<endl
<<"with 30 minutes as default interval"<<endl;
exit(1);
}else{
hFind=FindFirstFileA(currentImage,&FileData);
if(hFind==INVALID_HANDLE_VALUE){
cout<<"connot open file";
exit(1);
}
}
}else if(argc==3){
interval=60000*atoi(argv[2]);
currentDir=(LPCSTR)argv[1];
SetCurrentDirectoryA(currentDir);
hFind = FindFirstFileA((LPCSTR)"*.jpg",&am


相关文档:

航空公司管理系统(VC++ 与SQL 2005)

系统环境:Windows 7
软件环境:Visual C++ 2008 SP1 +SQL Server 2005
本次目的:编写一个航空管理系统
      这是数据库课程设计的成果,虽然成绩不佳,但是作为我用VC++ 以来编写的最大程序还是传到网上,以供参考。用VC++ 做数据库设计并不容易,但也不是不可能。以下是我的程序界面,后面 ......

【C/C++相关知识】ATOM优化之GCC篇

作者: Yanqing Wang (Intel)
在ATOM程序优化利器中,笔者着重讲述了如何使用Intel Compiler对ATOM应用程序的优化,很多网友都比较感兴趣并想知道在GCC编译器下如何优化ATOM。借此,本文将重点于讨论如何使ATOM应用程序在GCC编译器下优化。
细心的网友可能发现GCC4.4.2手册没有讲述如何在ATOM平台优化,所以要通过GCC对AT ......

用c写个控制台下的进度条

最近想写个控制台下的进度条,可以知道程序的进展情况,不用弄个界面。其中最主要的就是“\b“字符,它的ascii码值是10,是退格的意思。
现把代码贴上,如下(可以在vc和linux编译):
progress.c
#include <stdio.h>
#ifdef _WIN32
#include <windows.h>
#define mysleep(n) Sleep(n*1000)
......

深入理解C/C++函数指针

转:http://school.ogdev.net/ArticleShow.asp?categoryid=10&id=6019
函数指针数组的妙用
笔者在开发某软件过程中遇到这样一个问题,前级模块传给我二进制数据,输入参数为 char* buffer和 int length,buffer是数据的首地址,length表示这批数据的长度。数据的特点是:长度不定,类型不定,由第一个字节(buffer[0] ......

Linux C notes (BOOK UNIX)

Chapter 1: Thread
① thread functions
1. pthread_self();
2. thread existing
    you can get the value of rval_ptr just by  pthread_join(pthread_t tht, void ** rval_ptr)
    cancel a thread as the thread exits with PTHREAD_CANCELED in pthread_exit, this functio ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号