VC6.0 MFC下截取窗口特定部分并保存为bmp图片的类
admin | C++ | 2013-04-04
C++
/*类名称:bmpScreen.h。
; 类功能:提供了一个MFC下截取窗口特定部分并保存为bmp图片的类。
; 类参数:Crect rect, int left, int top, int top, char* name。
; 类参数说明:
; (1)Crect rect 定义截图框的大小。
; (2)int left 定义截图框距截图窗口左边的距离。
; (3)int top 定义截... [阅读全文]
Qt不规则窗体的实现
admin | Qt Gui | 2013-04-04
C++
//shapewidget.h
/*
*@date 2012-11-17
*/
#ifndef __SHAPE_WIDGET_H
#define __SHAPE_WIDGET_H
#include <QWidget>
#include <QMouseEvent>
#include <QPaintEvent>
#include <QPoint>
class ShapeWidget:public QWidget
{
Q_OBJECT
public:
ShapeWidget(QWidget *... [阅读全文]
Get IP by Hostname
admin | net work | 2013-04-04
C++
#include<stdio.h>
#include<stdlib.h>
#include<netdb.h>
#include<arpa/inet.h>
int main(int argc, char **argv) {
struct hostent *host;
char str[100];
char addr[INET_ADDRSTRLEN];
char **p;
int c;
while (1){
c=0;
gets(str);
printf("%s\n",str);
if ... [阅读全文]
ip地址正则表达式测试是否正确
admin | net work | 2013-04-04
C++
#include <sys/types.h>
#include <regex.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
char *test;
/*
int regcomp(regex_t *preg, const char *regex, int cflags);
int regexec(const regex_t *preg, const char *string, size_t nmatch,
... [阅读全文]
raw socket 发送阻断包
admin | net work | 2013-04-04
C++
来源:http://bugkill.01safe.com/thread-207-1-1.html
*int sndpkt_tcp_rst(u32 seq,u32 src_ip, u32 dst_ip, u16 src_prt, u16 dst_prt)
{
static int i=0;
int one=1; /* R.Stevens says we need this variable for the setsockopt call */
int tcphdrlen = sizeof(struct tcphdr);
int iphdrlen = sizeof(str... [阅读全文]
raw socket 发送阻断包
admin | net work | 2013-04-04
C++
来源:http://bugkill.01safe.com/thread-207-1-1.html
*int sndpkt_tcp_rst(u32 seq,u32 src_ip, u32 dst_ip, u16 src_prt, u16 dst_prt)
{
static int i=0;
int one=1; /* R.Stevens says we need this variable for the setsockopt call */
int tcphdrlen = sizeof(struct tcphdr);
int iphdrlen = sizeof(str... [阅读全文]
当前程序退出后重启
admin | win32 | 2013-04-04
C++
TCHAR szPath[MAX_PATH]; //
GetModuleFileName(NULL, szPath, MAX_PATH); //获取当前应用程序的全路径
//定义俩变量,具体的请参见msdn
STARTUPINFO startupInfo;
PROCESS_INFORMATION procInfo;
memset(&startupInfo,0x00,sizeof(STARTUPINFO));
startupInfo.cb = sizeof(STARTUPINFO);
// 这个变量是标... [阅读全文]
获取本地主机ipv4地址和ipv6地址
admin | net work | 2013-04-04
C++
#include <Winsock2.h>
#include <stdio.h>
#include <iostream>
#include <cstring>
#include<ws2tcpip.h>
#pragma comment(lib, "ws2_32.lib ") //linking to the library
using namespace std;
int get_ip()
{
struct addrinfo *ailist, *aip;
struct addrinfo hin... [阅读全文]