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

c判断汉字

#include <windows.h>
int IsGB(PTSTR pText);
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
     PSTR szCmdLine, int iCmdShow)
{
 static TCHAR szText[] = {TEXT ("i服,了。uy")} ;
 PTSTR pText;
 int i;
 unsigned char sqChar[20];
 pText=szText;
 while (*pText != '\0')
 {
  i=IsGB(pText);
  switch(i)
  {
  case 0:
   pText++;
   MessageBox (NULL, TEXT ("发现数字、英文字符或英文标点"), TEXT ("Hello"), 0);
   break;
  case 1:
   pText++;
   pText++;
   MessageBox (NULL, TEXT ("发现全角字符"), TEXT ("Hello"), 0);
   break;
  case 2:
   pText++;
   pText++;
   MessageBox (NULL, TEXT ("发现汉字"), TEXT ("Hello"), 0);
   break;
  }
 }
 return 0 ;
}
int IsGB(PTSTR pText)
{
 unsigned char sqChar[20];
 sqChar[0]=*pText;
 if (sqChar[0]>=0xa1)
  if (sqChar[0]==0xa3)
   return 1; //全角字符
  else
   return 2; //汉字
 else
  return 0; //英文、数字、英文标点
}


相关文档:

用C写的3D迷宫

          Boss说,要看OpenGL,看了快一个月,总算出了个像样的东西,用C写了个3D迷宫,
虽然只有350行
       代码,不过边学边写,足足写了一周时间,还是小有成就感的,活活活!
         &n ......

C#中一些字符串操作的常用用法,c#编码和解码

//获得汉字的区位码
  byte[] array = new byte[2];
  array = System.Text.Encoding.Default.GetBytes("啊");
int i1 = (short)(array[0] - ''\0'');
  int i2 = (short)(array[1] - ''\0'');
//unicode解码方式下的汉字码
  array = System.Text.Encoding.Unicode.GetBytes("啊");
  i1 = (short)(arra ......

c用api调用对话框

#include <windows.h>
int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nShowCmd )
{
OPENFILENAME ofn;
//在内存中开辟一块空间,存放用户选取的文件名
char szFile[MAX_PATH];//MAX_PATH ......

纯C实现c++类

//#include "stdafx.h"
/*
描述:纯c模拟类,纯c编写c++类,纯c实现c++类的简单范例,结构模拟类,struct 编写class.
c编写类是实现纯c编写com组件的基础。
*/
#include <stdio.h>
typedef struct _Vtbl
{
    void (*AddRef)(struct CObject* obj,int);//所有的函数的第一个参数类似class的隐匿的 ......

C Snippet #8(规定时间输入,否则默认跳转的实现)

http://www.ddj.com/cpp/221600722
Q: HOW DO I... put timers with default actions in my C code?
A: Many times, we need to write programs that will only wait a certain specified amount of time for a user to do something. After that time, we need to assume that the user isn't going to do anything and ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号