Win32 API Tree control and comboBox

wlwshang 2013-10-29 06:05:58
各位,

我想用纯Win32 API实现在Tree control 中显示comboBox.就是tree control 正常显示text. 但是当我双击具体的某个节点时,一个comboBox显示出来,用户可以从中选出自己的选项。看看大家有什么好主意。谢谢
...全文
96 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
wlwshang 2013-10-29
  • 打赏
  • 举报
回复

if(((LPNMHDR)lParam)->code == NM_DBLCLK) //user has Double clicked the left mouse button within the control
{
__wchar_t Text[255]= L"";
memset(&tvi,0,sizeof(tvi));

Selected=(HTREEITEM)SendDlgItemMessage(hWnd,IDC_TREE1,TVM_GETNEXTITEM,TVGN_CARET,(LPARAM)Selected);

if(Selected==NULL)
{
MessageBox(hWnd,L"No Items in TreeView",L"Error",MB_OK|MB_ICONINFORMATION);
break;
}
TreeView_EnsureVisible(hWnd,Selected);
SendDlgItemMessage(hWnd,IDC_TREE1,TVM_SELECTITEM,TVGN_CARET,(LPARAM)Selected);
flagSelected = true;
tvi.mask=TVIF_TEXT;
tvi.pszText = Text;
tvi.cchTextMax = 256;
tvi.hItem = Selected;

if(SendDlgItemMessage(hWnd,IDC_TREE1,TVM_GETITEM,TVGN_CARET,(LPARAM)&tvi))
{
// convert LPWSTR to char
char temp[550];
wcstombs(temp, tvi.pszText, 550);
if(tvi.cChildren==0 && strcmp(temp,"Double Click Me!")==0)
{
//MessageBox(hWnd,L"Press OK to delete me!",L"Example",MB_OK|MB_ICONINFORMATION);
//SendDlgItemMessage(hWnd,IDC_TREE1,TVM_DELETEITEM,TVGN_CARET,(LPARAM)tvi.hItem);
//flagSelected=false;
//break;
/* hWndComboBox = */
//point.x = LOWORD(lParam);
//point.y = HIWORD(lParam);
//GetCursorPos(&point);
/*CreateWindow(L"COMBOBOX",
NULL,
WS_CHILD | WS_VISIBLE,
point.x - 30 , point.y - 25, 100, 60,
hWnd,
NULL,
hInst,
NULL);*/
RECT point1;
TreeView_GetItemRect(hWnd,Selected,&point1,true);
CreateWindow(L"COMBOBOX",
NULL,
WS_CHILD | WS_VISIBLE,
point1.left , point1.top, point1.right - point1.left, point1.bottom - point1.top,
hWnd,
NULL,
hInst,
NULL);
break;
}
}
}


point1(3114712,-858993460,-858993460,-858993460)

似乎用这种方法得到的point只有left的值更新了,而且也不对。不知何故。
xiaohuh421 2013-10-29
  • 打赏
  • 举报
回复
参考WTL中的源码. 实际已经封装好基本控件的一些消息,变成方法. 创建窗口的时候传入对应控件的类名, 可可创建出控件, 然后通过这些通用控件的消息来操作这些控件.
Eleven 2013-10-29
  • 打赏
  • 举报
回复
响应NM_DBCLICK通知,然后ShowWindow一个ComboBox出来在对应的树节点的位置上TreeView_GetItemRect
1 , vb5dialog.zipThis demonstrates how to subclass the Common Dialog Dialogs and manipulate a specific Dialog.2 , cpnl.zipForm_Taskbar is a control for Visual Basic which, once placed onto a form, makes the form act like the Taskbar (minus the Start Menu).3 , vbo_progbar.zipImplement a common control progress bar with added features that are not accessable using COMCTL32.OCX! 4 , vbo_infolabel.zipThis control adds a great user-friendly interface with and icon and "Hover" ability. Based on a control seen in ICQ. 5 , vbo_checkcombo.zipAdd a checkbox to a combo box and use it to enabled/disable the combo! or whatever you would like to do with it! 6 , vbo_controlframe.zipCreate your own system button such as a Maximize, Minimize, Close, and many others with ease! 7 , vbo_ctextbox.zipThis class makes using the Textbox or Edit class API simple. Easily set properties and access many features not available directly from VB. 8 , taskbar.zipForm_Taskbar is a control for Visual Basic which, once placed onto a form, makes the form act like the Taskbar (minus the Start Menu).9 , NT_Service.zipThis is an OCX that allows you to create an NT service application...add the control to your project and register it as a service!!10 , Scroller.zipThis is a Control Container, it's like a frame control but it lets you scroll the content up and down...11 , TrayArea.zipThis control lets you add your icon to the System Tray Area and handle some events such as MouseMove, MouseDown, MouseUp and DblClick.12 , Resizer.zipThis is a very useful control: It's a container control, you can insert two controls inside and then you'll have a vertical (or horizontal) resizer bar (like the Windows File Explorer). A resizer can contain another resizer... an so on. (you can divide you form in as many sizable sections as you want...).13 , Label3D.zipTh
1 , TaskBar_v0.5.zip"Form_Taskbar is a control for Visual Basic which, once placed onto a form, makes the form act like the Taskbar (minus the Start Menu)." -- David Newcum2 , RemBuilderplus.zip"Rem Builder will auto load on startup to use Rem Builder; start your Visual Basic program with your project code showing, right click and you should see "Rem Builder".3 , syntax.zipThis is an excellent example of how to highlight HTML code in a rich textbox. I encourage everyone to check it out.4 , status.zipThis example demonstrates how to display text about each control the mouse is currently above.5 , dm10e.zipThis COM object allows you to send SMTP mail from many of the most used applications, including:Active Server Pages (Microsoft IIS or Chili!ASP extensions) Microsoft Visual Basic 4.x/5.x/6.x Microsoft Word, Access, Excel 95/97 (VBA) Windows Scripting Host (cscript / wscript) Perl 5.x for Win32 Inprise Delphi 4 Microsoft Visual C++ 4.x/5.x/6.x Microsoft Visual J++ 1.x/6.0 (Java) 6 , ocxex.zip"This is a quick example I made to show you how to use Events and properties in a OCX."7 , news.exeThis control aids as a complete Newsgroup control. It can post messages and recieve messages through the internet.8 , optiondemo.zipThis example demonstrates how to create realistic Option Buttons in Visual Basic.9 , mencrypt.zipThis ocx allows you to encrypt strings while utilizing a password shift method.10 , listtxt.zipThis shows how to retrieve the text from the current selection in a listbox.11 , list_index.zipThis example tells you if the inputted List Index is selected or not.12 , fade.zipThis is a bas to fade a pictuerbox. Can be used to make a progressbar13 , subcls32.zipThis demonstrates hoe to write a subclassing control. And it has many examples as to how to use the control (included.)14 , djmeter.zipThis is the source for a Progress Bar control. Also includes a helpful example.15 , progress.zipThis is an example on how to use the Progress Bar included with Microsoft's Visual Basic.16 , slider.zip"This is a sample of the Slider control that is part of the Microsoft Windows Common Controls(COMCTL32.OCX). "17 , statusbar.zip"This is a sample of the StatusBar control that is part of the Microsoft Windows Common Controls(COMCTL32.OCX). "18 , tabstrip.zip"This is a sample of the TabStrip control that is part of the Microsoft Windows Common Controls(COMCTL32.OCX). "19 , uncommondialog.zipThis is an alternative to Microsoft's (tm) Common Dialog control by Nick Mancini.20 , ucmdex.zipThis is the example to go with Uncommon Dialog OCX.21 , scroll.zipThis demonstrates how to create an auto-scrolling textbox.22 , splitter.zipThis demonstrates how to "split" controls. This is an excellent example, and I reccomend this file for everyone. 23 , mtymse.zip"This project is a fully working ActiveX control, with code, that allows you to control almost every aspect of the mouse. You can move the mouse, click the buttons and adjust the click time from your application."24 , ucmdsrc.zipThis is the source to my OCX. This demontrates how to create a basic OCX. This will aid anyone who wants to create an OCX.25 , avb-systray.zipThis is a good example to add your programs' icon to the Systray. This Zip also includes a helpful example.26 , cmdex.zipThis is an example of how to use the Common Dialog. This demonstrates most of the event procedures of the CM Dialog control.27 , campbell-reg.zipThis demonstrates how to write and retrieve information from the registry.28 , basChangeCursor.zipThis module demonstrates how to animate your cursor through Visual Basic, and Win32.29 , hdcat.zipThis will grab every file on your hard drive and add its path to a listbox.30 , vbo_bump.zipThis DLL allows programmers to easily draw 3D grippers and lines on Device Contexts (DC). 31 , vbo_user32_bas.zipThis BAS file contains many functions to ease the process of using the USER32 DLL. 32 , vbo_gdi32_bas.zipThis BAS File conatains many functions to ease the process of using the GDI32 DLL. 33 , vbo_button_bas.zipThis bas contains functions to manipulate Button class objects34 , LPT_Port.zipRead/write to LPT parallel port35 , DancingBaby.zipA Dancing Baby Screen Saver Which Dance on A Famous Song Macarena ( With Sound ) A Very Cute Screen Saver ,with source code, If you want more avi files then please mail me.36 , superwriter.zipA complete Wordprocessor, with source code. You can save, open files, print them out, copy, cut, paste, well you know the concept!37 , LogOff.zipThis conveniently placed program allows you to log off from your system tray.38 , ChPass.zipChanges NT Domain Passord. This program has two compenants... a server and a a client. The Server must run on a Domain Controller.39 , Reboot.zipThis conveniently placed program allows you to restart your computer more easily, from your system tray. 40 , analogclock.zipThis is a very good demo OCX for an analog clock. Although quite big in size, this is due to the very good background to the clock face. The analog click itself is very accurate and looks very impressive.41 , edge.zipThis program uses a few API calls/functions to set 3D, sunken and etched effects to an image inside an image control. It also has an example of how to change a label control to a 3D command button.42 , splitpanel2.zipA re-written version of the SplitPanel that David originally put onto this site about a year ago. It basically is a control that you place on a form and you can put other controls on the form and by dragging the splitpanel bar around, it does the resizing for you. 43 , avcontrol.zipThis control takes care of many audio and visual functions needed for game and graphical programmers. You can easily retrieve or change the screen resolution and color depth, play audio CDs and standard wave files 44 , fsocontrol.zipThis demonstration version of this control is a wrapper around the FileSystemObject - and makes using the FSO much easier.45 , slidingtoolbar.zipThis project shows how to implement a sliding toolbar in an application using one quick Kernel32 API function "Sleep". The application is fairly simple and easy to implement. 46 , dcsize.zipWhen this control is put onto a form, it ensures that all other controls retain the correct aspect-ratio from the design time view. Basically, it resize all controls on a form when the form resizes. This code is 100% free.47 , colorchooseocx.zipThis great OCX allows you to have a drop down list of colors to allow your user to choose from. The control itself has all the events and properties that you need.48 , xgraphmeter.zipThis is XGraphMeter, a bargraph/meter control good for displaying constantly changing values such as CPU usage or DUN throughput.49 , dynlistmnu.zipWhile trying to come up with a Dynamic menu in VB, I decided that VBs menu object was just too much of a pain to work with This project contains a form to mimic the functionality that I was looking for.. Part of my design criteria was that the menu form 50 , runtime.zipSupposedly, what this code does cannot be done... But it works. Basically, its a demonstration of how you can change control properties at run-time. If you try it in VB, you will get a runtime error, but this code shows you how to do it. Gilbert says51 , ledbulb.zipThis is a first for this author. Its an OCX which represents a characters in the form of led bulbs.52 , textapiroutines.basContained here is a small set of routines can be used with a Rich Text box (RTF) control. It can be used for other controls as well with minor modifications. You are welcome to change, use and distribute the code as you see fit.53 , xflatbutton.zipFlatButton is an owner-drawn flat button that pops up when the mouse passes over it. This version is text-only, but has flexible color support.54 , urllabel.zipWith the development of the internet and intranet applications, this control could could in more and more useful. Its a hyperlink label which will change color or underline when the mouse goes over it 55 , progbar.zipThis is a great replacement for the standard VB progress bar. Its smooth, totally free (all the source code is here), and more versitile than the one that comes with VB.56 , splitpanel.zipThis little control with full source code is remarkably compact but does a lot of fancy things. It allows you to be able to split panels and handles all the resizing behind it. We couldn't think of how to describe it properly, but 下载 it and try it57,basicreg.zipBasic Save and Retrieve Functions58,proguse.zipKeep Track of a Programs Usage59,millisec.zipCount Time in Milliseconds 60,getday.zipGet the Day of Week that a Day Falls On61,shellend.zipNotify the User when a Shelled Process Ends 62,varlist.zipGet a List of Windows Variables 63,detdisp.zipDetermine Display Colors 64,ctrlntwk.zipControl Panel - Network65,ctrluser.zipControl Panel - User Properties66,ctrltwui.zipControl Panel - TweakUI67,ctrlthm.zipControl Panel - Themes68,ctrltele.zipControl Panel - Telephony69,ctrlsys.zipControl Panel - System Properties70,ctrlscrn.zipControl Panel - Screen Savers71,ctrlreg.zipControl Panel - Regional Settings72,ctrlprnt.zipControl Panel - Printers73,ctrlpwr.zipControl Panel - Power Management74,ctrlpw.zipControl Panel - Passwords75,ctrlodbc.zipControl Panel - ODBC3276,ctrlmm.zipControl Panel - Multimedia77,ctrlmdm.zipControl Panel - Modem78,ctrlkbd.zipControl Panel - Keyboard79,ctrlmous.zipControl Panel - Mouse80,ctrlpoa.zipControl Panel - Post Office Admin81,ctrlotlk.zipControl Panel - Outlook82,ctrljoy.zipControl Panel - Joystick83,ctrlie4.zipControl Panel - Internet Explorer 84,ctrlgame.zipControl Panel - Game Controllers85,ctrlfont.zipControl Panel - Fonts86,ctrlarmp.zip Control Panel - Add/Remove Programs87,ctrlanh.zipControl Panel - Add New Hardware88,ctrlanp.zipControl Panel - Add New Printer89,ctrlaccs.zipControl Panel - Accessibility90,ctrlbrf.zipControl Panel - Create Briefcase91,ctrlcdsk.zipControl Panel - Copy Disk92,ctrlcns.zipControl Panel - Create New Shortcut93,ctrldun.zipControl Panel - Dial-Up Networking94,ctrldisp.zipControl Panel - Display Properties95,RegControl.zipFree Registry ActiveX Control. Read/Write String/Binary/DWord values, Check if key/value exists, CreateKey, Delete key/value and enumerate keys/values!96,MouseEvent.zipThis is a Mouse Event procedure that is pretty cool. It can be used for Web designing. Check it out!97,ShellTrayIcon.zipThe CShellTrayIcon class allows your VB application to set, change and delete icons in the system's tray 98,Reboot2.zipReboot remotely. I wrote this to reboot selected PC's during off hours. It is a standalone application that will display a 10 second countdown. Any open data will try to be saved prior to the shutdown process.99,S-Secure.zipThis is S-Secure.....a security program I've coded for Windows. It has 4 modules each in a separate VB project. 100,DriveSpace.zipThis Program finds and displays the Drive's Space.101,Disable_X.zipThis user control allows you to disable the windows close "X" button. Example program included.102,SetParnt.zipShows how to assign controls to different forms at run time. 103,phone.zipA Cellular Phone Application Uses MSCOMM, Modem and normal telephone lines to make calls. You can use this application to make local as well as International calls. 104,Timer01.zipSimple program demonstrating how to create a stop watch using the Timer control. 105,Bubblesort.zipA simple Bubble Sort code that shows how the program works within a VB program. 106,systray.zipJust another Systray Utility, but worse than the others !!! static, flashing and animated Tray-Icons 107,FolderFiles.zipDemonstrates usage of progress bar and list box controls. Its purpose is to get all the files from a specified folder while showing the progress completed. 108,MultipleDataSets.zipThis is a simple, (1) form VB 6.0 program which demonstrates how to plot multiple sets of data on the same graph using the MSChart Control 6.0 (OLEDB). 109,MthVwPrj.zipMonthView control. Lets users view and set date information via a calendar-like interface. 110,calculator4.zipI know this is wierd but I made a calculator control. Just add it to your control bar, double click, and you can use the calculator when your project is at run-time. Source included.111,GradientButton.zipThis button was created to be an enhanced replacement for Visual Basic's standard command button by adding 2 more Border appearance schemes, 2 more button styles, and hover effects. 112,MSChart.zipMSChart. You can view MSChart in Line graph,Pie , Area, etc.. also you can update data provided in the Grid.. Very interesting must see it... 113,printing_tut.zipI made this for a freind to help him out with some basic Printing, i got the idea from a printing tut i found on the net, so the code is not mine. 114,treeview.zipThis code can as many child nodes to a tree view control and can save the data and structure of the treeview control in a text file. Later the data and structure can be retrieved from the text file and filled in the tree view control by clicking the load button. 115,alarm_clock.zipIt simulates an alarm clock. 116,DesktopByAlexDrankus.zipThis program hides/shows desktop, hides/shows taskbar, hides it self from the ctrl+alt+delete, uses pictures to create the forms (pretty cool forms) and many other functions just place this program and all components in a sub-folder 117,Label3D.zipLabel3D lets you change the Label Face Color Shadow Color ON/OFF Shadow. 118,HotLinks.zip Custom Control which acts like a text box, except the developer can specify hot links in the control which act like web page links allowing users to click them, while allowing the developer full control over the result of the click. 119,custbutt.zipThis application shows how to create non rectangular buttons. 120,grid.zipComplete grid coded in vb. supports : locked rows/columns , fg/bg colors , text alignment , cell-edge styles , different selectionstyles . texbox/dropdown cells , cell icons and lots more... 121,analogmeter.zipCreate your own analog meters using MSPaint. These .bmp or .gif files become your meter face. Use the (analogmeter) subroutine to automatically draw the meter needle over the meter face 122,wheel.zipSpinWheel control to be used in place of either the UpDown control or the ScrollBar control.123,ArielBrowseFolder.zipA browse folder control resembling a combobox. When the dropdown button is clicked, browse through a folder treeview to select a directory. Uses the SHBrowseForFolder function, amongst other APIs. A call back procedure is implemented showing the currently selected folder in the browse for folder dialog. 124,pp_prj.zipThis program shows you how to create a sample project that adds print preview capabilities to your Visual Basic program by using a generic object and the Printer object. 125,popup.zipPopUp buttons with only 4 lines of code. 126,adbevel.zipThe bevel control in Delphi is now available in VB. 127,rainbow.zipCool! Have a ProgressBar like in InstallShield!With free selectable fore- and backcolor and the percent value displayed in the middle!Check it out.128,gb12.zipWell folks. Another version of Gold Button is here. I've added a few things. Here they are: Property descriptions, MaskColor, UseMask, Base Address in OCX, picture will now automatically align with text and when you are in desing mode and OnUp property is bsNone, a Dash-Dot-Dot box is drawn over the button, so you can see th button's area. 129,gb11.zipA new version of Gold Button is here dudes.New version has Picture Property and Skin Support. 130,BIGDOGMEDIA.zipMEDIA PLAYER THAT SUPPORTS FORMATS LIKE MP3,AVI,MPEG,WAV ECT.EXAMPLE OF USING ANIMATION WHEN PLAYER IS LAUNCHED. 131,HTML.zipAn HTML editor with complete VB source code. 132,PrintPreview1.zipPrint Setup, and Print Priview application. 133,RTFEditor.zipRTF text editor, HTML text editor, web browser, and more...Try it. Note, make sure your printer is turned on before running the application. 134,VBExplorer-II.zipVBExplorer file utility application. This application uses the Visual Basic TreeView and ListView controls to create a file management application similar to Windows Explorer.135,resizepic.zipShows how to resize a picture box control on a form at run time.
6 , chunks.zip<br>This will open a file and read it in "Chunks" of a selected file.<END><br>7 , logging.zip<br>This is a bas that will log installation procedures so the file can be removed later.<END><br>8 , savetree.zip<br>This will save the info in a Tree View. "This technique allows a program to save hierarchical information like the data in a TreeView in a way that is easy to understand."<END><br>11 , OLE.zip<br>Demonstrates the use of OLE.<END><br>12 , gradtxt2.zip<br>"A program for drawing horizontal, rectangular or spherical gradient texts."<END><br>13 , sweepgl.zip<br>This example greatly demonstrates how to use OpenGL in Visual Basic.<END><br>15 , drawdemo.zip<br>This is an excellent example of how to make a paint program with a few extras.<END><br>16 , cube.zip<br>This example demonstrates how to rotate a cube in visual basic.<END><br>17 , sprite1.zip<br>This is an Excellent example on how to use sprites in your program.<END><br>18 , charcreate.zip<br>This is an example of how to assign "characters" to differant pictureboxes. This would be a good starting point for VB game developers.<END><br>19 , breakthrough.zip<br>This demonstrates a simple game in Visual Basic. An excellent example.<END><br>26 , openlib.zip<br>These are the type libs that go with OpenGL. This is used to make 3D text.<END><br>27 , basMath.zip<br>This module contains functions for various math equations. <END><br>28 , calc.zip<br>This is a basic calculator written in Visual Basic.<END><br>29 , stopwatch.zip<br>This shows how to count off time in a Stop Watch format.<END><br>31 , taskhide.zip<br>This will hide your application from the taskbar, Alt+Tab, and Alt+Ctrl+Del.<END><br>32 , newbie.zip<br>This is a nicely done help file for programmers that are new to Visual Basic.<END><br>33 , vbfaq.zip<br>This is AOL's PC Dev Visual Basic FAQ. This is an excellent starting point for begginners.<END><br>34 , Bas.zip<br>it is very good modual for activex<END><br>35, paraviasource.zip<br>This is
第一部分 Visual C++ 2010开发与新特性 第1章 Visual C++ 2010开发环境简介 1 1.1 Visual C++ 2010简介 1 1.2 Visual C++ 2010下载安装指南 1 1.3 Visual C++ 2010主要特点与新特性 3 1.4 Visual C++ 2010开发环境操作指南 6 1.4.1 创建Visual C++应用程序 6 1.4.2 Visual C++ 2010菜单介绍 9 1.5 Visual C++ 2010 MFC简介 12 1.6 Visual C++ 2010 clr简介 13 1.7 Visual C++ 2010 64位编程 14 1.8 支持新的C++语言标准 14 1.8.1 支持新的C++语言标准(C++ 0x) 14 1.8.2 Lambda表达式 15 1.8.3 静态断言static_assert 17 1.8.4 auto关键字 18 1.8.5 右值引用 19 1.8.6 安全数据类型 22 1.8.7 移动构造 23 1.9 支持开发并行程序 26 1.9.1 运行库支持native代码 26 1.9.2 调试和分析工具 29 1.10 对MFC的增强 31 1.10.1 任务对话框CTaskDialog 31 1.10.2 重启管理器(Restart Manager)支持 33 1.10.3 支持新的用户界面风格 34 第2章 MFC应用程序框架 37 2.1 用MFC向导生成应用程序 37 2.1.1 生成的程序框架 37 2.1.2 生成的应用程序类型 43 2.1.3 向导生成工程文件简介 46 2.2 应用程序框架分析 46 2.2.1 框架简介 47 2.2.2 MFC应用程序运行流程 50 2.2.3 应用程序窗口 51 2.2.4 消息机制与消息循环 59 2.3 文档与视图 65 2.3.1 文档类结构分析 65 2.3.2 视图类结构分析 65 2.3.3 文档与视图的关系 67 2.3.4 sdi应用程序分析 69 2.3.5 mdi应用程序分析 69 2.4 工具栏与状态栏 69 2.4.1 工具栏 70 2.4.2 状态栏 78 2.5 MFC新功能——Office 2007风格程序分析 85 2.6 MFC新功能——Visual Studio风格程序分析 90 2.7 MFC新功能——Windows资源管理器风格程序分析 98 2.8 应用程序框架类对象分析 100 2.8.1 视图类对文档类的调用 100 2.8.2 在框架类中获得当前的文档类和视图类对象指针 101 2.8.3 获得应用程序类对象的指针 101 2.8.4 从应用类对象中获得主框架类对象的指针 101 2.9 小结 102 第3章 Visual C++ 2010 MFC菜单编程 103 3.1 菜单编程 103 3.1.1 创建菜单 104 3.1.2 创建菜单热键 115 3.1.3 标记菜单 115 3.1.4 给菜单加入图标 119 3.1.5 禁用菜单 121 3.1.6 移除与加载菜单 127 3.2 菜单消息的传输机制 129 3.2.1 菜单消息的分类 129 3.2.2 菜单消息的传输路由 129 3.3 动态菜单操作 131 3.3.1 添加菜单 131 3.3.2 插入菜单 133 3.3.3 删除菜单 135 3.3.4 插入菜单的命令响应 136 3.3.5 修改菜单 137 3.4 小结 140 第4章 Visual C++ 2010 MFC对话框编程 141 4.1 对话框简介 141 4.1.1 对话框的控件简介 141 4.1.2 对话框的种类简介 149 4.1.3 设计对话框 150 4.2 创建与销毁对话框 153 4.2.1 模态对话框 153 4.2.2 非模式对话框 159 4.2.3 属性页对话框 163 4.3 消息对话框 173 4.4 通用对话框 175 4.4.1 文件打开对话框 176 4.4.2 文件保存对话框 178 4.4.3 颜色对话框 179 4.4.4 字体对话框 181 4.4.5 查找对话框 183 4.4.6 页面设置对话框 185 4.4.7 打印对话框 186 4.5 小结 187 第5章 Visual C++ 2010 MFC对话框控件 188 5.1 Visual C++ 2010 Button控件简介与开发 191 5.2 Visual C++ 2010 List Box控件简介与开发 193 5.3 Visual C++ 2010 Com boBox控件简介与开发 195 5.3.1 创建扩展组合框控件 196 5.3.2 在扩展组合框控件中使用 5.3.2 图像列表 197 5.3.3 设置各项的图像 197 5.3.4 处理扩展组合框控件中的通知消息 198 5.4 Visual C++ 2010 List控件简介与开发 198 5.4.1 列表控件和列表视图 199 5.4.2 列表项和图像列表 199 5.4.3 回调项和回调屏蔽 200 5.4.4 创建列表控件 200 5.4.5 创建图像列表 201 5.4.6 向控件添加列(报表视图) 204 5.4.7 向控件添加项 205 5.4.8 在列表控件中滚动、排列、排序和查找 205 5.4.9 在列表控件中实现工作区 205 5.4.10 处理列表控件中的通知消息 206 5.4.11 更改列表控件样式 206 5.4.12 虚拟列表控件 207 5.4.13 列表控件的消息映射 209 5.4.14 列表控件的风格选项及表头设置 210 5.4.15 销毁列表控件 210 5.5 Visual C++ 2010 Edit控件简介与开发 211 5.6 Visual C++ 2010 Rich Edit控件简介与开发 213 5.6.1 Rich Edit控件中的字符格式 215 5.6.2 Rich Edit控件中的段落格式 215 5.6.3 Rich Edit控件中的当前选定内容 215 5.6.4 Rich Edit控件中的分词 216 5.6.5 Rich Edit控件中的剪贴板操作 216 5.6.6 Rich Edit控件中的流操作 216 5.6.7 Rich Edit控件中的打印操作 216 5.6.8 无底的Rich Edit控件 217 5.6.9 来自Rich Edit控件的通知 217 5.7 Visual C++ 2010 Progress控件简介与开发 219 5.7.1 进度控件的样式 219 5.7.2 进度控件的设置 219 5.7.3 操作进度控件 220 5.8 Visual C++ 2010 Tree控件简介与开发 220 5.8.1 树控件样式 221 5.8.2 树控件父项和子项 221 5.8.3 树控件项位置 222 5.8.4 树控件项标签 222 5.8.5 树控件标签编辑 223 5.8.6 树控件项的状态 223 5.8.7 树控件图像列表 224 5.8.8 树控件项选择 224 5.8.9 树控件拖放操作 224 5.8.10 树控件项信息 225 5.8.11 树控件通知消息 225 5.9 Visual C++ 2010 DBgrid控件简介与开发 226 5.9.1 示例程序1 226 5.9.2 示例程序2 227 5.10 Visual C++ 2010 Rebar控件简介与开发 228 5.10.1 在Rebar控件中使用图像列表 230 5.10.2 在Rebar控件中使用对话栏 231 5.10.3 处理Rebar控件中的通知消息 231 5.11 Visual C++ 2010 Timer控件简介与开发 232 5.12 Visual C++ 2010 Tab控件简介与开发 234 5.12.1 选项卡和选项卡控件属性 235 5.12.2 选项卡控件的使用方法 235 5.12.3 创建选项卡控件的方法 235 5.12.4 处理选项卡控件通知消息 236 5.12.5 ctabctrl类简介 236 5.13 Visual C++ 2010 IP控件简介与开发 241 5.14 Visual C++ 2010 Picture控件简介与开发 241 5.15 Visual C++ 2010 Slider控件简介与开发 244 5.15.1 滑块控件样式 244 5.15.2 滑块控件成员函数 245 5.15.3 滑块控件通知消息 246 5.16 Visual C++ 2010 Scroll Bar控件简介与开发 246 5.17 Visual C++ 2010 Hot Key控件简介与开发 248 5.17.1 使用热键控件 248 5.17.2 设置热键 249 5.18 Visual C++ 2010 Animation控件简介与开发 249 5.18.1 使用动画控件 249 5.18.2 动画控件发送的通知 250 5.19 Visual C++ 2010 Spin控件简介与开发 250 5.19.1 数值调节钮的样式 250 5.19.2 数值调节钮成员函数 251 5.20 Visual C++ 2010 GroupBox控件简介与开发 251 5.21 Visual C++ 2010 Data Time Picker控件简介与开发 252 5.21.1 创建日期和时间选择器控件 253 5.21.2 访问嵌入的月历控件 253 5.21.3 在日期和时间选择器控件中使用自定义格式字符串 254 5.21.4 在日期和时间选择器控件中使用回调字段 254 5.21.5 处理日期和时间选择器控件中的通知消息 256 5.22 Visual C++ 2010 Month Canlendar控件简介与开发 256 5.22.1 创建月历控件 257 5.22.2 处理月历控件中的通知消息 257 5.22.3 设置月历控件的日状态 257 5.23 Visual C++ 2010 Custom控件简介与开发 258 5.23.1 使用MFC方法定制控件必备的几个基本概念 259 5.23.2 定制自定义控件的3种常见方法 260 5.24 Visual C++ 2010 SysLink控件简介与开发 260 5.25 Visual C++ 2010 Split Button控件简介与开发 261 5.26 Visual C++ 2010 Network Address控件简介与开发 262 5.27 Visual C++ 2010 Check Box控件简介与开发 262 5.28 Visual C++ 2010 Radio Button控件简介与开发 264 5.28.1 为单选按钮控件分组 264 5.28.2 获得被选中的单选按钮的文本 264 5.29 Visual C++ 2010 Mediaplayer控件简介与开发 265 5.30 小结 266 第二部分 Visual C++ 2010下MFC开发 第6章 计算机测控系统概述 267 6.1 Visual C++ 2010 SDI开发简介 267 6.1.1 建立应用程序基本框架 267 6.1.2 处理视图 267 6.1.3 处理文档 271 6.1.4 串行化处理 274 6.1.5 sdi应用程序编程思路 275 6.2 Visual C++ 2010 MDI开发简介 277 6.2.1 多文档接口 277 6.2.2 生成程序 278 6.2.3 程序类、文件和代码 279 6.2.4 自定义资源 281 6.3 Visual C++ 2010 View开发 282 6.3.1 生成源文件 283 6.3.2 初始化视图类数据成员 283 6.3.3 加入消息处理功能 285 6.3.4 设计程序资源 290 6.3.5 定制miniDraw窗口 292 6.3.6 程序清单 293 6.4 Visual C++ 2010 EditView开发 298 6.4.1 生成MiniEdit程序 299 6.4.2 修改程序菜单 300 6.4.3 编辑加速键 301 6.4.4 程序清单 303 6.5 Visual C++ 2010 FormView开发 306 6.5.1 自定义FormDemo程序 307 6.5.2 程序清单 314 6.6 Visual C++ 2010 ScrollView开发 319 6.6.1 加入滚动功能 319 6.6.2 坐标换算 319 6.6.3 限制图形大小 322 6.6.4 改变鼠标光标 325 6.7 Visual C++ 2010 HtmlEditView开发 328 6.8 Visual C++ 2010 HtmlView开发 331 6.9 Visual C++ 2010 ListView开发 335 6.10 Visual C++ 2010 RichEditView开发 335 6.11 VisualC++ 2010 TreeView开发 336 6.12 Visual C++ 2010 Office 2007风格文档视图开发框架 337 6.13 Visual C++ 2010 Visual Studio 2008风格文档视图开发框架 342 6.14 Visual C++ 2010 Windows资源管理器风格文档视图开发框架 346 6.15 小结 350 第7章 Visual C++ 2010 MFC应用程序界面与美化 351 7.1 应用程序窗口风格美化 351 7.1.1 借助ActiveSkin美化窗口 351 7.1.2 修改窗口外观 352 7.2 应用程序窗口图标与背景修改 359 7.2.1 修改窗口图标 359 7.2.2 修改背景 360 7.3 工具栏编程与美化 365 7.3.1 创建工具栏 365 7.3.2 在工具栏中添加、删除按钮 366 7.3.3 从对话框创建工具栏 368 7.4 状态栏编程与美化 370 7.4.1 创建状态栏 370 7.4.2 在状态栏中插入进度条 370 7.5 鼠标光标编程 371 7.5.1 鼠标光标编程步骤 371 7.5.2 鼠标的消息处理机制 373 7.5.3 示例 374 7.6 创建启动界面 376 7.7 创建特效窗口启动应用程序 378 7.8 创建特效窗口关闭应用程序 378 7.9 小结 383 第8章 Visual C++ 2010 MFC文本与字体 384 8.1 CFont字体类简介 384 8.1.1 CFont字体类成员介绍 384 8.1.2 CFont字体类初始化函数 385 8.1.3 其他成员介绍 390 8.2 创建文本插入符与图片插入符 391 8.2.1 创建文本插入符 391 8.2.2 创建图片插入符 394 8.2.3 创建随鼠标移动的插入符 396 8.3 输出文字与字体格式 397 8.3.1 输出固定文字 397 8.3.2 设定输出字体的格式 398 8.3.3 字符输入 399 8.4 输出彩色文字与变色文字 404 8.4.1 DrawText()函数和字符串资源 404 8.4.2 定时器和变色文字 408 8.5 小结 410 第9章 Visual C++ 2010 MFC图形图像编程 411 9.1 Windows绘图简介 411 9.1.1 设备描述表 411 9.1.2 绘图属性 412 9.1.3 元文件和路径 412 9.1.4 颜色和调色板 412 9.1.5 图形设备接口函数 413 9.2 Windows屏幕绘图简介 414 9.2.1 窗口客户区 414 9.2.2 映射模式 414 9.2.3 图形刷新 416 9.3 微软GDI绘图简介 416 9.3.1 GDI基础 416 9.3.2 GDI结构 417 9.3.3 GDI函数调用 417 9.3.4 GDI基本图形 418 9.4 GDI笔绘图 419 9.4.1 CPen类简介 419 9.4.2 使用GDI绘制线条 419 9.4.3 使用CPen类绘制指定的线条 422 9.4.4 绘制连续的线条 424 9.5 GDI画刷绘图 425 9.5.1 CBrush类介绍 426 9.5.2 CBrush类简单画刷的实现 429 9.5.3 CBrush类位图画刷的实现 430 9.5.4 透明画刷的实现 431 9.6 小结 433 第10章 Visual C++ 2010 MFC动态函数链接库 434 10.1 动态函数链接库简介 434 10.1.1 什么是动态函数链接库 434 10.1.2 动态函数链接库的优点 435 10.1.3 动态函数链接库的起源 436 10.1.4 动态函数链接库的原理 436 10.2 调用动态函数链接库 436 10.2.1 静态链接 436 10.2.2 动态链接 438 10.3 Dll的框架简介 439 10.3.1 DllMain()函数简介 439 10.3.2 Dll的导出函数 439 10.4 创建MFC Dll范例 440 10.4.1 建立MFC Dll工程 440 10.4.2 添加实现代码 442 10.4.3 编译并调用 443 10.5 创建Win32 Dll范例 443 10.5.1 建立Win32工程 443 10.5.2 添加动态链接库代码 444 10.5.3 编译工程 444 10.6 创建资源Dll范例 445 10.6.1 建立MFC Application工程 445 10.6.2 建立中文资源Dll 445 10.6.3 加载资源Dll 446 10.7 hook技术 446 10.7.1 hook函数类型 446 10.7.2 使用hook函数 449 10.7.3 hook鼠标 449 10.7.4 hook键盘 450 10.8 小结 452 第11章 Visual C++ 2010 MFC Activex控件 454 11.1 Activex控件简介 454 11.2 Activex控件测试与注册 455 11.2.1 Activex控件的测试 455 11.2.2 Activex控件的注册 457 11.3 MFC Activex控件向导 458 11.4 Activex控件属性开发 458 11.4.1 添加常用属性 459 11.4.2 添加自定义属性 460 11.4.3 高级属性实现 460 11.4.4 访问环境属性 461 11.5 Activex控件事件开发 461 11.5.1 添加常用事件 462 11.5.2 添加自定义事件 463 11.6 Activex控件方法开发 464 11.6.1 添加常用方法 465 11.6.2 添加自定义方法 465 11.6.3 从方法返回错误代码 466 11.7 完整Activex控件范例 467 11.7.1 创建工程 467 11.7.2 clock控件的实现 469 11.7.3 添加常用属性 470 11.7.4 添加自定义属性 473 11.7.5 添加方法 474 11.7.6 添加常用事件 475 11.7.7 添加自定义事件 476 11.8 调用Activex控件 477 11.9 小结 478 第12章 Visual C++ 2010 MFC文件与注册表操作 479 12.1 文本操作串行化 479 12.1.1 文档类serialize()函数 479 12.1.2 CArchive对文件进行读写 482 12.1.3 文档操作串行化代码分析 485 12.2 CFile类 492 12.2.1 打开文件操作 493 12.2.2 读写文件操作 494 12.2.3 定位文件操作 496 12.2.4 关闭文件操作 497 12.2.5 异常操作 497 12.2.6 文件管理操作 498 12.3 .ini文件读写操作 500 12.4 注册表读写操作 502 12.4.1 注册表简介 502 12.4.2 注册表API 504 12.4.3 访问并修改注册表 507 12.5 小结 509 第13章 Visual C++ 2010 MFC数据库开发 510 13.1 数据库基本知识 510 13.2 SQL语言的基础知识 511 13.3 ODBC访问数据库 512 13.3.1 注册ODBC数据库 512 13.3.2 创建一个MFC的ODBC程序 514 13.3.3 程序结构分析 515 13.3.4 在视图上显示数据库查询结果 520 13.3.5 对查询结果排序及设置查询条件 524 13.3.6 动态设置查询条件并更新查询结果 527 13.4 ODBC更新数据库 532 13.5 ODBC访问SQL server 540 13.6 ado数据库访问 543 13.6.1 ado数据库访问概述 543 13.6.2 在Visual C++中使用ado编程 546 13.7 ado访问SQL server数据库 556 13.8 小结 556 第14章 Visual C++2010 MFC多线程程序设计 557 14.1 进程和多线程的概念 557 14.2 线程的创建 558 14.2.1 创建工作者线程 558 14.2.2 创建用户界面线程 559 14.3 线程的终止 560 14.4 设置线程的优先级 562 14.5 暂停及重新启动线程 563 14.6 线程间的通信 571 14.7 线程的同步 572 14.7.1 临界区 572 14.7.2 互斥量 573 14.7.3 事件 573 14.7.4 信号量 574 14.8 小结 579 第15章 Visual C++ 2010 MFC网络程序设计 580 15.1 计算机网络的基础知识 580 15.1.1 TCP/IP协议模型 580 15.1.2 ip地址 582 15.1.3 端口 582 15.1.4 数据封装 582 15.2 Winsock简介 583 15.3 MFC对Windows Sockets的支持 583 15.3.1 Socket的定义 584 15.3.2 casyncSocket类介绍 584 15.3.3 cSocket类介绍 592 15.4 一个基于udp的聊天室示例 593 15.4.1 MFC对Windows Sockets的初始化 593 15.4.2 服务器端的实现 595 15.4.3 客户端的实现 599 15.5 一个基于TCP的聊天室示例 605 15.5.1 服务器端的实现 606 15.5.2 客户端的实现 609 15.6 小结 612 第16章 Visual C++ 2010 MFC进程通信 613 16.1 剪贴板通信 613 16.1.1 Openclipboard()函数 613 16.1.2 Closeclipboard()函数 614 16.1.3 emptyclipboard()函数 614 16.1.4 Setclipboarddata()函数 614 16.1.5 globalalloc()函数 615 16.1.6 globallock()函数 616 16.1.7 globalunlock()函数 616 16.1.8 Getclipboarddata()函数 616 16.1.9 一个利用剪贴板在不同进程之间交换数据的示例 616 16.2 邮槽通信 619 16.2.1 Createmailslot()函数 619 16.2.2 Getmailslotinfo()函数 620 16.2.3 Setmailslotinfo()函数 621 16.2.4 ReadFile()函数 621 16.2.5 GetFiletime()函数和SetFiletime()函数 621 16.2.6 CreateFile()函数 622 16.2.7 WriteFile()函数 623 16.2.8 Closehandle()函数 623 16.2.9 一个利用邮槽在不同进程间通信的示例 623 16.3 匿名管道通信 628 16.3.1 Createpipe()函数 628 16.3.2 Createprocess()函数 629 16.3.3 Getstdhandle()函数 631 16.3.4 ReadFile()和WriteFile()函数 632 16.3.5 一个利用匿名管道在父子进程间通信的示例 632 16.4 命名管道通信 637 16.4.1 Createnamedpipe()函数 637 16.4.2 connectnamedpipe()函数 639 16.4.3 disconnectnamedpipe()函数 640 16.4.4 waitnamedpipe()函数 640 16.4.5 利用命名管道通信的基本流程 640 16.4.6 一个利用命名管道在不同进程间通信的示例 641 16.5 共享内存通信 647 16.5.1 CreateFilemApping()函数 647 16.5.2 mapViewofFile()函数 648 16.5.3 unmapViewofFile()函数 649 16.5.4 OpenFilemApping()函数 649 16.5.5 利用共享内存通信的基本流程 649 16.5.6 一个利用共享内存在不同进程间通信的示例 650 16.6 小结 655 第三部分 Visual C++ 2010下MFC与clr进行开发 第17章 Visual C++ 2010 clr开发基础 656 17.1 什么是.net 656 17.2 .net框架 656 17.3 公共语言运行时(clr) 657 17.3.1 托管代码 659 17.3.2 代码验证 659 17.3.3 代码访问验证 659 17.3.4 垃圾回收 659 17.3.5 语言的互操作性 660 17.3.6 实时编译(jit) 660 17.4 通用类型系统(cts) 661 17.5 通用语言规范(cls) 663 17.6 程序集 664 17.6.1 元数据 664 17.6.2 程序集版本管理 665 17.6.3 微软中间语言(msil) 665 17.6.4 资源 666 17.7 .net开发应用程序的范畴 666 17.8 .net框架类库 667 17.9 C++/clr开发语法简介 668 17.10 小结 670 第18章 Visual C++ 2010 clr Windows窗口编程 671 18.1 创建Windows应用程序 671 18.2 类层次结构 677 18.3 control类 677 18.3.1 大小与位置 678 18.3.2 外观 679 18.3.3 用户交互操作 679 18.3.4 Windows功能 680 18.4 标准Windows控件使用指南 681 18.4.1 Button控件 681 18.4.2 checkBox控件 681 18.4.3 radioButton控件 682 18.4.4 comboBox控件、ListBox控件和checkedListBox控件 682 18.4.5 datetimepicker控件 684 18.4.6 errorprovider组件 685 18.4.7 helpprovider组件 686 18.4.8 imageList组件 686 18.4.9 label控件 686 18.4.10 ListView控件 687 18.4.11 pictureBox控件 688 18.4.12 progressbar控件 689 18.4.13 TextBox控件、RichTextBox控件与maskedTextBox 18.4.13 控件 689 18.4.14 panel控件 690 18.4.15 flowlayoutpanel控件和tablelayoutpanel控件 690 18.4.16 splitcontainer控件 691 18.4.17 tabcontrol控件和tabpage控件 691 18.4.18 toolstrip控件 692 18.4.19 menustrip控件 694 18.4.20 conTextmenustrip控件 694 18.4.21 toolstripmenuitem控件 694 18.4.22 toolstripmanager类 695 18.4.23 toolstripcontainer控件 695 18.5 窗体Winform 695 18.5.1 form类 695 18.5.2 多文档界面 700 18.5.3 定制控件 700 18.6 小结 707 第19章 Visual C++ 2010 MFC与.net交互编程 708 19.1 编写托管扩展应用程序 708 19.2 编写访问.net的MFC程序 709 19.3 混合模式编程问题 711 19.4 运用.net类型 713 19.4.1 定义和使用托管类型 713 19.4.2 将非托管对象作为托管类的成员 715 19.4.3 装箱和拆箱 716 19.4.4 指针 717 19.4.5 在非托管代码中使用托管数组 719 19.5 小结 720 第四部分 发布Visual C++ 2010程序 第20章 Visual C++ 2010应用程序部署 721 20.1 Windows installer介绍 722 20.2 一个简单的Windows应用程序 723 20.3 使用安装向导快速创建安装包 726 20.4 手动创建安装程序 728 20.5 使用安装编辑器 731 20.5.1 File system(文件系统编辑器) 731 20.5.2 registry编辑器 732 20.5.3 File types编辑器 733 20.5.4 user interface编辑器 734 20.5.5 custom actions编辑器 735 20.5.6 launch conditions编辑器 736 20.6 小结 736 第五部分 基于Windows 7平台用Visual C++ 2010开发 第21章 Visual C++ 2010基于Windows 7新特性开发 737 21.1 实现C++兼容开发 737 21.1.1 实现uac数据重定向 737 21.1.2 实现高dpi 741 21.1.3 实现安装程序检测 742 21.1.4 会话0隔离 743 21.1.5 用户界面特权隔离(uipi) 746 21.1.6 版本检查 748 21.2 Windows 7系统专题 750 21.2.1 实现超级任务栏 750 21.2.2 实现shell库 759 21.2.3 实现后台服务 762 21.2.4 开发基于Windows 7的 21.1.5 设备与性能应用 763 21.3 开发基于Windows 7的新特性 769 21.3.1 实现多点触摸 769 21.3.2 实现获取传感器与位置 771 21.3.3 实现Windows 7 ribbon界面开发 774 21.3.4 基于Visual C++ 2010开发基于Windows 7的语音识别与语音合成 776 21.3.5 基于Visual C++ 2010与Windows sdk for Windows 7开发Windows 7平台的tablet pc应用 787 21.3.6 开发Windows 7的安全体验cryptoAPI加密 804

16,547

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • AIGC Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧