随笔分类 -  Win SDK

摘要:AlphaBlend 函数功能:该函数用来显示透明或半透明像素的位图。 函数原型:BOOL AlphaBlend( HDC hdcDest, // handle to destination DC int nXOriginDest, // x-coord of upper-left corner int nYOriginDest, // y-coord of upper-left corner int nWidthDest, // destination width int nHe... 阅读全文
posted @ 2014-04-06 15:33 执迷不悟~ 阅读(18079) 评论(1) 推荐(1)
摘要:功能:将一个进程内的伪句柄,转化为可以用来进程间通信的实句柄BOOL DuplicateHandle( HANDLE hSourceProcessHandle, HANDLE hSourceHandle, HANDLE hTargetProcessHandle, LPHANDLE lpTargetHandle, DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwOptions);第一个参数是当前的源进程句柄,第二参数是当前的资源句柄,第三个是目标进程的句柄,第四个是你要得到的目的句柄,这里应该是一个变量,使用指针,DuplicateHand 阅读全文
posted @ 2014-03-02 16:21 执迷不悟~ 阅读(13518) 评论(0) 推荐(0)
摘要:#define CW_ABOUT 100 #define CW_DOCUMENT 200 POINT t; GetCursorPos(&t); HMENU hMenu,hPopupMenu; hMenu=CreatePopupMenu(); hPopupMenu=CreatePopupMenu(); AppendMenu(hMenu,MF_STRING,CW... 阅读全文
posted @ 2013-11-22 15:28 执迷不悟~ 阅读(394) 评论(0) 推荐(0)
摘要:简单的放一个最基本的win32程序吧#include <windows.h> LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ; int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) { static TCHAR szAppName[] = TEXT ("HelloWin") ; HWND hwnd ; MSG ... 阅读全文
posted @ 2013-03-28 19:01 执迷不悟~ 阅读(354) 评论(0) 推荐(0)
摘要:#include <Windows.h>#include "resource.h"#include <stdio.h>void RegisterClass_CLS(WNDCLASS &wndcls, const HINSTANCE hInstance);void CreateWindow_Wnd(HWND &hWnd,const HINSTANCE hInstance);LRESULT CALLBACK WindowProc( HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam);int W 阅读全文
posted @ 2013-02-04 16:26 执迷不悟~ 阅读(332) 评论(0) 推荐(0)
摘要:1、文件操作函数: CreateFile //创建或打开文件;WriteFile //写数据到文件;ReadFile //从文件读数据;CopyFile //拷贝文件;MoveFile //移动或重命名文件;DeleteFile //删除文件;GetModuleFileName //获取文件目录;SetFilePointer //文件指针位置设置;CloseHandle //关闭文件句柄;2、文件属性函数: GetFileSize //获取文件大小;GetFileTime //获取文件的时间信息;SetFileTime //设定文件的时间信息;GetFileAttributesEx //获取. 阅读全文
posted @ 2013-02-02 14:06 执迷不悟~ 阅读(1151) 评论(0) 推荐(0)
摘要:#include <Windows.h>#include "resource.h"第三种方法:#define IDM_FILE_NEW 40001#define IDM_FILE_OPEN 40002#define IDM_FILE_SAVE 40003#define IDM_FILE_SAVE_AS 40004#define IDM_APP_EXIT 40005#define IDM_EDIT_UNDO 40006#define IDM_EDIT_CUT 40007#define IDM_EDIT_CO... 阅读全文
posted @ 2013-01-30 19:07 执迷不悟~ 阅读(1208) 评论(0) 推荐(0)
摘要:WM_DESTROY 是关闭程序 WM_CLOSE 是关闭窗口 WM_QUIT 是关闭消息环 WM_CLOSE和WM_DESTROY同属窗口消息,WM_QUIT则不在窗口消息之列。三者先后执行顺序是WM_CLOSE、WM_DESTROY、WM_QUIT 但需要注意的是MFC窗口默认取消按钮函数OnCancel()是不会触发WM_CLOSE消息,只触发WM_DESTROY。WM_CLOSE: 在系统菜单里选择了“关闭”或者点击了窗口右上角的“X”按钮,你的窗口过程就会收到WM_CLOSE。DefWindowProc对WM_CLOSE的处理是调用DestroyWindow。当然,你可以... 阅读全文
posted @ 2013-01-30 18:57 执迷不悟~ 阅读(7926) 评论(0) 推荐(4)
摘要:MFC程序中调用CWnd::CenterWindow就可以实现窗口居中,但是纯SDK编程中没有CenterWindow这个函数,需要自定义一个。Google到一个比较好的实现。自定义函数一:void CentreWindow(HWND hwnd){ RECT winrect, workrect; int workwidth, workheight, winwidth, winheight; SystemParametersInfo(SPI_GETWORKAREA, 0, &workrect, 0); workwidth = workrect.right - workrect.left; 阅读全文
posted @ 2013-01-17 14:23 执迷不悟~ 阅读(614) 评论(0) 推荐(0)