- 博客(54)
- 收藏
- 关注
转载 __attribute__ ((packed))
<br /><br />1. __attribute__ ((packed)) 的作用就是告诉编译器取消结构在编译过程中的优化对齐,按照实际占用字节数进行对齐,是GCC特有的语法。这个功能是跟操作系统没关系,跟编译器有关,gcc编译器不是紧凑模式的,我在windows下,用vc的编译器也不是紧凑的,用tc的编译器就是紧凑的。例如:<br />在TC下:struct my{ char ch; int a;} sizeof(int)=2;sizeof(my)=3;(紧凑模式)<br />在GCC下:struct
2010-11-25 10:01:00
717
原创 VS2005 can't create the project
<br /><br />Some VS2005 and VS2008 Wizards Pop Up Script Error.<br /><br />Visual C++ team has discovered that after installing the current release of Internet Explorer (Internet Explorer 8), some VC++ wizards do not function correctly. The products affec
2010-09-06 20:26:00
573
转载 Android Property System
<br /><br /><br />Everyproperty has a name and value. Both name and value are text strings.Property is heavily used in Android to record system setting orexchange information between processes. The property is globallyvisible in the whole system. E
2010-07-22 17:55:00
440
原创 misc设备
misc_register(),注册将在/dev下自动生成设备节点,主设备号为10,从设备号一般采用动态分配方式static struct file_operations helloworld_mic_fops = {.owner = THIS_MODULE,// .open = helloworld_open,// .release = helloworld_release,// .ioctl = helloworld_ioctl,};static struct miscdevice helloworld
2010-07-12 11:53:00
668
原创 Scratchbox on Ubuntu
1:可以下载deb包,也可以下载tar.gz包,这里使用tar.gz,解压完后进行相关的设置即可使用。scratchbox-core-1.0.17-i386.tar.gzscratchbox-libs-1.0.17-i386.tar.gzscratchbox-devkit-cputransp-1.0.9-i386.tar.gzscratchbox-toolchain-arm-l
2010-05-18 16:16:00
628
原创 Qemu on Ubuntu
1: 下载Qemu源码编译,由于只需要arm的其他的就不编了./configure --target-list=arm-softmmu --prefix=xxxmake make install添加xxx/bin 到环境变量 运行 qemu-system-arm -M ?可以查看qemu支持的开发板,默认支持integratorcp. 2:配置内核,选
2010-05-17 18:22:00
2191
原创 Nfs on Ubuntu
Ubuntu 10.04 1:sudo apt-get install nfs-kernel-server nfs-common portmap 2:sudo dpkg-reconfigure portmap,选择 “否” 3:sudo vim /etc/exports /home/xxx * (rw,sync,no_root_squash),*表示接受
2010-05-17 18:00:00
442
原创 Vnc on Ubuntu
Ubuntu 10.04 1:sudo apt-get install vnc4server 2:vncpasswd 3:编辑 ~/.vnc/xstartup: #!/bin/sh # Uncomment the following two lines for normal desktop:# unset SESSION_MANAGER# ex
2010-05-17 17:50:00
784
原创 Debug Mini2440 on Ubuntu
1:usb转串口,usb转串口芯片为pl2303,ubuntu10.04带了该芯片的驱动,插上usb后通过dmesg可以查看驱动打印的信息 [ 97.620050] usb 5-2: new full speed USB device using ohci_hcd and address 2[ 97.787229] usb 5-2: configuration #1 cho
2010-05-15 18:45:00
697
原创 View the android source code in Eclipse
1:在SDK的相应目录中建立sources目录:android-sdk-windows/platforms/android-7/sourcesandroid-sdk-windows/platforms/android-6/sources...... 2:把/frameworks拷贝到sources目录下,重启Eclipse即可。
2010-05-10 09:57:00
532
原创 Svn on Ubuntu
1:sudo apt-get install subversion esvn 2:svnadmin create ~/svnrepo 3:edit the svnserve.conf and passwd svnserve.conf:anon-access = noneauth-access = writepassword-db = passwd passw
2010-04-09 18:17:00
420
原创 samba on ubuntu9.10
1:sudo apt-get install samba smbfs telnetd xinetd 2:edit the /etc/samba/smb.confworkgroup = Ubuntusecurity = user[homes] comment = Home directories path =/home/%S
2010-04-07 18:28:00
536
原创 Gitweb on Ubuntu9.10
1:install the toolsa:sudo apt-get install gitweb openssh-sever openssh-client lighttpd python-setuptools 2:config the servera:edit the /etc/lighttpd/lighttpd.conf server.modules
2010-04-07 17:22:00
936
原创 Ubuntu 字符终端
进入字符终端sudo /etc/init.d/gdm stop 退出字符终端sudo /etc/init.d/gdm start 字符终端中文显示:sudo apt-get install zhconzhcon --utf8 --drv=vga zhcon web:http://zhcon.sourceforge.net/index_cn.html
2010-02-25 13:59:00
1454
原创 Mobile设置查看MAC地址
设置MAC地址:DWORD SetIfEntry( PMIB_IFROW pIfRow );查看MAC地址:DWORD GetAdaptersInfo( PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen);DWORD WINAPI GetAdaptersAddresses( ULONG Family,
2010-02-24 14:15:00
673
原创 GetWindowLong,SetWindowLong,CallWindowProc
WNDPROC g_deskproc; LRESULT CALLBACK DeskWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_LBUTTONDOWN:
2010-01-25 11:32:00
1243
转载 ASCII,Unicode和UTF-8
Unicode和UTF-8之间的关系:1. ASCII码我们知道,在计算机内部,所有的信息最终都表示为一个二进制的字符串。每一个二进制位(bit)有0和1两种状态,因此八个二进制位就可以组合出256种状态,这被称为一个字节(byte)。也就是说,一个字节一共可以用来表示256种不同的状态,每一个状态对应一个符号,就是256个符号,从0000000到11111111。上个世纪60年代,美
2010-01-22 10:14:00
469
原创 ScrollBar
1:滚动对话框内容,SetScrollInfo窗口句柄为对话框的初始化:ScrollInfo.cbSize = sizeof(SCROLLINFO);ScrollInfo.fMask = SIF_RANGE|SIF_POS|SIF_PAGE;ScrollInfo.nMin = 0;ScrollInfo.nMax = 300;ScrollInfo.nPag
2009-12-18 10:49:00
516
原创 CaptureScreen
1:GDI HDC g_hCaptureDC void CaptureScreen(void){ RECT TaskBarRect; HWND hDesktopWnd = GetDesktopWindow(); HDC hDesktopDC = GetDC(hDesktopWnd); g_hCaptureDC = Cr
2009-12-16 14:34:00
649
原创 AlphaBlend
AlphaBlend实现透明效果,不过只能针对某块区域进行alpha操作,透明度可设。TransparentBlt可以针对某种颜色进行透明,不过透明度不可设。 AlphaBlend:BLENDFUNCTION bn;bn.AlphaFormat = 0;bn.BlendFlags = 0;bn.BlendOp = AC_SRC_OVER;bn.S
2009-10-26 11:20:00
10105
原创 FillRect and GradientFill
FillRect 填充单一颜色,GradientFill可以绘制渐变颜色。 FillRect(hdc,&rect,(HBRUSH) GetStockObject (BLACK_BRUSH)); TRIVERTEX vert[2] ; GRADIENT_RECT gRect;
2009-10-26 10:53:00
1384
原创 电源通知 RequestPowerNotifications
当系统的电源状态该变时,可以通过RequestPowerNotifications要求电源管理器向自己发送一个通知 HANDLE RequestPowerNotifications( HANDLE hMsgQ, DWORD Flags); 示例: #include #include #i
2009-10-26 10:41:00
4199
原创 注册表监控
当需要注册表某项改变时通知我们,可以通过调用RegistryNotifyCallback实现,当不再需要时需要调用RegistryCloseNotification关闭通知 HREGNOTIFY g_hNotify[3]; void CloseNotificationReg(void){ RegistryCloseNotifica
2009-10-26 10:34:00
1075
原创 IImagingFactory IImage
void DrawImage(HDC hdc){ IImagingFactory *pImgFactory = NULL; IImage *pImage = NULL; RECT rc = { 0, 0, 110, 88}; // Normally you would only call CoInitialize/CoUni
2009-10-26 10:04:00
1012
原创 键盘钩子
#include #include "hook.h" typedef LRESULT (CALLBACK * HOOKPROC)(int code, WPARAM wParam, LPARAM lParam);typedef HHOOK (WINAPI * SetWindowsHookFunc)(int, HOOKPROC, HINSTANCE
2009-10-26 09:30:00
434
原创 加载显示位图
hBMP = LoadBitmap(g_hInst, MAKEINTRESOURCE(IDB_BITMAP1)); hMemDC = CreateCompatibleDC(NULL);hOldBMP = (HBITMAP)SelectObject(hMemDC, hBMP);BitBlt(hdc, 0, 0, 320, 45, hMemDC, 0, 0, SRCCOPY); Select
2009-09-29 16:49:00
451
原创 字体
1:创建字体,HFONT CreateFontIndirect(const LOGFONT *lplf),结构体LOGFONT 用于设置字体的相关参数如高度、宽度、粗体、斜体、字体名称等。hFont = CreateFontIndirect (&lplf); 2:为设备上下文选择字体hOldFont = (HFONT)SelectObject (hdc, hFont); h
2009-09-29 11:14:00
1161
1
原创 FullScreen
1: 用于隐藏、显示任务栏、开始菜单、输入面板,BOOL SHFullScreen( HWND hwndRequester, DWORD dwState) MSDN里的参考代码: #include LRESULT CALLBACK SHFullScreenWndProc(HWND hwnd, UINT message, WPARAM wParam
2009-09-24 16:35:00
1194
原创 Qt on Mobile
1:下载源码包,qt-embedded-wince-opensource-src-4.5.2.zip 2:参考INSTALL和README文件编译安装 a:解压源码包到相应目录如C:/Qt/4.5.2b:添加环境变量PATH,指向c:/Qt/4.5.2/binc:在开始菜单中选择打开Visual Studio Command Prompt(visual studio 200
2009-09-23 11:34:00
548
原创 Mobile 控制面板
1:新建一个空的smartdevice dll工程 2:将输出文件的后缀.dll改为.cpl 3:参考Windows Mobile 6 SDK的例子myBacklight进行修改 4:编译后将生成cpl文件,将该cpl文件拷贝到windows目录下即可,之后可以做成cab包进行安装
2009-09-12 19:56:00
586
转载 Windows CE LCD Driver
wince的显示驱动和普通的设备驱动不一样.普通的设备驱动是由设备管理器device.exe加载和管理的;而显示驱动是由GWES.exe加载和管理的,类似的由GWES加载管理的还有键盘鼠标,触摸屏,打印机等驱动,这些叫本地驱动(内置驱动).所以,显示驱动ddi就不是常见设备驱动的ddi(流接口ddi).更具体说,它不是通过CreateFile这些文件系统api接口来访问.而是通过GDI接
2009-09-03 17:24:00
1105
原创 临界区
临界区和互斥量相似,但是临界区被限制在单个进程内,而互斥量可以在进程间共享。所有临界区在进程内实现速速比互斥量快很多,如果不需要在进程间共享资源应优先选择临界区而不是互斥量。 void InitializeCriticalSection (LPCRITICAL_SECTION lpCriticalSection):创建临界区 void EnterCriticalSection
2009-09-01 10:40:00
603
原创 GetCurrentProcess and GetCurrentThread
HANDLE GetCurrentProcess(void) :获取当前进程句柄DWORD GetCurrentProcessId(void):获取当前进程IDHANDLE GetCurrentThread(void):获取当前线程句柄DWORD GetCurrentThreadId(void):获取当前线程ID
2009-09-01 10:20:00
865
原创 信号量
创建信号量:HANDLE CreateSemaphore (LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCTSTR lpName);1:lpSemaphore
2009-09-01 09:54:00
410
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人