1.窗口、控件的指针和句柄的相互转化 1)指针转化为句柄在MFC应用程序中首先要获得窗口的指针,然后将其转化为句柄 CWnd* pWnd; HANDLE hWnd = pWnd->GetSafeHwnd(); 2)句柄转化为指针在MFC应用程序中首先获得对话框控件的句柄,然后获得其指针HANDLE  ...
                            
                            
                                分类:
编程语言   时间:
2020-11-26 14:36:44   
                                阅读次数:
3
                             
                    
                        
                            
                            
                                
                    近日在做项目时,需要将查询查来的数据在richTextBox里面分行显示,但是richTextBox默认的行间距很小,显示的数据看着很挤,视觉效果差,后查找资料,发现通过以下方法能设置richTextBox的行间距。 using System.Runtime.InteropServices; 里面粘 ...
                            
                            
                         
                    
                        
                            
                            
                                
                    #include <windows.h> #define BUFFER(x,y) *(pBuffer + y*cxBuffer + x) LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); int min(int a, int b) { ret ...
                            
                            
                                分类:
其他好文   时间:
2020-09-24 21:56:40   
                                阅读次数:
47
                             
                    
                        
                            
                            
                                
                    //窗口过程函数INT_PTR CALLBACK myWin::myWinDlgProc(HWND dlgHwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_COMMAND: { OnCommand(wPa ...
                            
                            
                         
                    
                        
                            
                            
                                    /* RANDRECT.C -- Displays Random Rectangles */ #include <windows.h> #include <stdlib.h> //for the rand function LRESULT CALLBACK WndProc(HWND,UINT,WPA ...
                            
                            
                                分类:
其他好文   时间:
2020-07-16 22:08:07   
                                阅读次数:
107
                             
                    
                        
                            
                            
                                    当打开一个不存在的文件名,那会导致读文件出现错误,导致程序崩溃。 为了避免类似问题,我们需要进行判断: //open file CFile file; file.Open("ReadMe.txt", CFile::modeRead,NULL);//open the file 文件打开返回是文件句柄, ...
                            
                            
                                分类:
其他好文   时间:
2020-07-06 12:35:24   
                                阅读次数:
92
                             
                    
                        
                            
                            
                                    `macro MultiLineComment() { hwnd = GetCurrentWnd() selection = GetWndSel(hwnd) LnFirst = GetWndSelLnFirst(hwnd) //取首行行号 LnLast = GetWndSelLnLast(hwnd) ...
                            
                            
                                分类:
其他好文   时间:
2020-06-29 18:50:06   
                                阅读次数:
94
                             
                    
                        
                            
                            
                                    // DIB.cpp : 定义应用程序的入口点。// #include "stdafx.h"#include "DIB.h"#include"DIBFILE.h" LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); int APIENTRY w ...
                            
                            
                                分类:
其他好文   时间:
2020-06-24 10:27:27   
                                阅读次数:
62
                             
                    
                        
                            
                            
                                    void OnEraseBkGnd(HWND hwnd) { /* Vars */ HDC dc; /* Standard Device Context; used to do the painting */ /* rect = Client Rect of the window; Temp = T ...
                            
                            
                         
                    
                        
                            
                            
                                功能:从调用线程的消息队列里取得消息并放于指定的结构。 函数原型: BOOL GetMessage(_Out_ LPMSG lpMsg,_In_opt_ HWND hWnd,_In_ UINT wMsgFilterMin,_In_ UINT wMsgFilterMax); lpMsg:指向MSG结构 ...
                            
                            
                                分类:
其他好文   时间:
2020-06-10 13:05:12   
                                阅读次数:
64