VC6中怎样在对话框中使用状态栏,请附源程序!(MFC)

etoy 2000-08-25 08:08:00
...全文
215 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
jumpinwind 2001-03-26
  • 打赏
  • 举报
回复
think
panda_w 2001-03-07
  • 打赏
  • 举报
回复
Toolbars and Statusbars on Dialogs
:::
By default, MFC only allows you to add Toolbars and Statusbars on CFrameWnd subclassed objects. This is great, but if you want to add toolbars on dialogs, you're like an idiot, because you can't do this easily.

The first problem is that every handler function expect the parent to be a CFrameWnd subclassed object, and another one is that you can only show tooltips or statusbar message when the dialog is in IDLE state. In fact, for the control bars to function properly, you'll have to catch some of the messages that the frame window uses.

I'll have to dig a lot in the documentation to find something that helps me doing that. One issue was shown me by Mihai Filimon (see articles posted on Monday 16 march 1998), which was fine, but not very "clean" since you have to make room for the bar with an invisible static object. (I thanks a lot him for showing the light at the end of the tunnel).

Let me expose you what to do if you want a toolbar (fixed, there is no other way possible) and a menu which can talk with any StatusBar in the application (even in the dialog but I think it will be the subject of another article).

I’ll only expose you how to add a Toolbar on a dialog (the menu is obvious since you only have to define one and add it on the resource editor).

First, you’ll have to develop your dialog (with its object) without bothering the place of the ToolBar, and subclass the CDialog class to use this dialog template (nothing new here).

Then, add this code on the CDialog::OnInitDialog function (the m_wndToolBar variable is of type CToolBarEx) :


BOOL CMyDlg::OnInitDialog()
{
// TODO: Add extra initialization here
CDialog::OnInitDialog();

// Add the ToolBar.
if (!m_wndToolBar.Create( this ) ||
!m_wndToolBar.LoadToolBar(IDR_CORPS_EMIS) )
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}

// TODO: Remove this if you don't want tool tips or a resizeable toolbar
m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY );

// We need to resize the dialog to make room for control bars.
// First, figure out how big the control bars are.
CRect rcClientStart;
CRect rcClientNow;
GetClientRect(rcClientStart);
RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST,
0, reposQuery, rcClientNow);

// Now move all the controls so they are in the same relative
// position within the remaining client area as they would be
// with no control bars.
CPoint ptOffset(rcClientNow.left - rcClientStart.left,
rcClientNow.top - rcClientStart.top);

CRect rcChild;
CWnd* pwndChild = GetWindow(GW_CHILD);
while (pwndChild)
{
pwndChild->GetWindowRect(rcChild);
ScreenToClient(rcChild);
rcChild.OffsetRect(ptOffset);
pwndChild->MoveWindow(rcChild, FALSE);
pwndChild = pwndChild->GetNextWindow();
}

// Adjust the dialog window dimensions
CRect rcWindow;
GetWindowRect(rcWindow);
rcWindow.right += rcClientStart.Width() - rcClientNow.Width();
rcWindow.bottom += rcClientStart.Height() - rcClientNow.Height();
MoveWindow(rcWindow, FALSE);

// And position the control bars
RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);

return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}

You can see that it is not obvious (I found it in a more complicated sample called DLGCBR32, and I work a lot to find out the functions that are compulsory, and the others)

At that point, you have only a Toolbar in top of your dialog (you see that any toolbar can fit the requirements to be shown in a dialog, since the preceding code is generic enough). You can have many toolbars in your dialog, but you must manage the positions by yourself.

Now, if you want tooltips on your Toolbar, you must handle the following messages TTN_NEEDTEXTA and TTN_NEEDTEXTW (for both ANSI and Unicode characters sets), in the following way :

1. Add the message handlers declaration...

BEGIN_MESSAGE_MAP(CMyDlg, CDialog)
...
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipText)
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipText)
END_MESSAGE_MAP()

2. Declare the function in your header file that way :

// Generated message map functions
//{{AFX_MSG(CMyDlg)
afx_msg BOOL OnToolTipText(UINT, NMHDR* pNMHDR, LRESULT* pResult);
//}}AFX_MSG

3. And finally code your OnToolTipText function that way (comes from MFC Sample) :

BOOL CMyDlg::OnToolTipText(UINT, NMHDR* pNMHDR, LRESULT* pResult)
{
ASSERT(pNMHDR->code == TTN_NEEDTEXTA || pNMHDR->code == TTN_NEEDTEXTW);

// allow top level routing frame to handle the message
if (GetRoutingFrame() != NULL)
return FALSE;

// need to handle both ANSI and UNICODE versions of the message
TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR;
TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
TCHAR szFullText[256];
CString cstTipText;
CString cstStatusText;

UINT nID = pNMHDR->idFrom;
if (pNMHDR->code == TTN_NEEDTEXTA && (pTTTA->uFlags & TTF_IDISHWND) ||
pNMHDR->code == TTN_NEEDTEXTW && (pTTTW->uFlags & TTF_IDISHWND))
{
// idFrom is actually the HWND of the tool
nID = ((UINT)(WORD)::GetDlgCtrlID((HWND)nID));
}

if (nID != 0) // will be zero on a separator
{
AfxLoadString(nID, szFullText);
// this is the command id, not the button index
AfxExtractSubString(cstTipText, szFullText, 1, '\n');
AfxExtractSubString(cstStatusText, szFullText, 0, '\n');
}

// Non-UNICODE Strings only are shown in the tooltip window...
if (pNMHDR->code == TTN_NEEDTEXTA)
lstrcpyn(pTTTA->szText, cstTipText,
(sizeof(pTTTA->szText)/sizeof(pTTTA->szText[0])));
else
_mbstowcsz(pTTTW->szText, cstTipText,
(sizeof(pTTTW->szText)/sizeof(pTTTW->szText[0])));
*pResult = 0;

// bring the tooltip window above other popup windows
::SetWindowPos(pNMHDR->hwndFrom, HWND_TOP, 0, 0, 0, 0,
SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE);


return TRUE; // message was handled
}

Now you have a toolbar with tooltips (the text shown in the tooltip box is defined the classic way, with the resource editor). (pheeew ;-) ).

Now, if you want the mainframe's status bar to display the text that would normally be prompted, the only line (right, the ONLY one) of code you have to add is in the above function (it is useful for System modal dialog boxes since they are usually small), just before the return statement (it also assume that m_wndStatusBar is public) :


// Display the text in the mainframe's status bar (assumes the Help pane text
// is at the index zero.
((CMainFrame*)GetParent())->m_wndStatusBar.SetPaneText(0, cstStatusText);

That's all for today.

No, let me tell you just one more thing, if you want your dialog menu to display text in the mainframe's status bar (on in any other status bar you have created) you can add the following code to the handler of WM_MENUSELECT (window-type handler) :


void CMyDlg::OnMenuSelect(UINT nItemID, UINT nFlags, HMENU hSysMenu)
{
CDialog::OnMenuSelect(nItemID, nFlags, hSysMenu);

TCHAR szFullText[256];
CString cstStatusText;
// TODO: Add your message handler code here
// Displays in the mainframe's status bar
if (nItemID != 0) // will be zero on a separator
{
AfxLoadString(nItemID, szFullText);
// this is the command id, not the button index
AfxExtractSubString(cstStatusText, szFullText, 0, '\n');
((CMainFrame*)GetParent())->m_wndStatusBar.SetPaneText(0,cstStatusText);
}
}


Note that you can't use the ON_UPDATE_COMMAND_UI message on this toolbar, since it can only be refresh when the dialog enters in idle state. To do so, you must subclass the CToolBar (or CStatusBar) class - in CMyToolBar for instance -, add the message handler for WM_IDLEUPDATECMDUI, and write the following code in this function :


/////////////////////////////////////////////////////////////////////////////
// CMyToolBar::OnIdleUpdateCmdUI
// OnIdleUpdateCmdUI handles the WM_IDLEUPDATECMDUI message, which is
// used to update the status of user-interface elements within the MFC
// framework.
//
// We have to get a little tricky here: CToolBar::OnUpdateCmdUI
// expects a CFrameWnd pointer as its first parameter. However, it
// doesn't do anything but pass the parameter on to another function
// which only requires a CCmdTarget pointer. We can get a CWnd pointer
// to the parent window, which is a CCmdTarget, but may not be a
// CFrameWnd. So, to make CToolBar::OnUpdateCmdUI happy, we will call
// our CWnd pointer a CFrameWnd pointer temporarily.

LRESULT CMyToolBar::OnIdleUpdateCmdUI(WPARAM wParam, LPARAM)
{
if (IsWindowVisible())
{
CFrameWnd *pParent = (CFrameWnd *)GetParent();
if (pParent)
OnUpdateCmdUI(pParent, (BOOL)wParam);
}
return 0L;
}


In order to have the toolbar updated you MUST override the ContinueModal() function that way:


BOOL CMyDlg::ContinueModal()
{
m_wndToolbar.SendMessage( WM_IDLEUPDATECMDUI, WPARAM(TRUE), 0);


return CDialog::ContinueModal();
}


For AfxLoadString to compile you must Include the file "Afxpriv.h" at the beginning of the CPP file.
ufc 2000-09-10
  • 打赏
  • 举报
回复
我给你源程序,请给我加分
在对话框中加状态栏上如下实现
在OnInitDialog中或其它适当的位置加如下代码:

CStatusBarCtrl *m_StaBar=new CStatusBarCtrl;
RECT m_Rect;
GetClientRect(&m_Rect);
m_Rect.top=m_Rect.bottom-20;
m_StaBar->Create(WS_BORDER|WS_VISIBLE|CBRS_BOTTOM,m_Rect,this,3);
m_StaBar->ShowWindow(SW_SHOW);

这样就行了,至于向里面加别的,就可以参考CStatusBarCtrl类参考了.





etoy 2000-08-29
  • 打赏
  • 举报
回复
该问题已经通过查阅官方资料解决!
Ideal 2000-08-26
  • 打赏
  • 举报
回复
在对话框中加入 ToolBar 你会吗?方法或许一样(我没试过,我只试过加入 ToolBar)。
第一课: Windows程序运行原理及程序编写流程,窗口产生过程,句柄原理,消息队列,回调函数,窗口关闭与应用程序退出的工作关系,使用VC++的若干小技巧,stdcall与cdecl调用规范的比较,初学者常犯错误及注意事项。我们通常不必要知晓每一个函数和消息。但另一方面,也不得不记住其的一部分,否则很难将VC++运用自如。到底该记住哪些,这在我们的课程都会涉及到。 第二课: C++经典语法与应用,类的编写与应用,构造与析构函数,函数的重载,类的继承,函数覆盖,基类与派生类的构造函数、析构函数先后调用顺序,如何在派生类构造函数向基类的构造函数传递参数,this成员变量,类型转换的内幕,虚拟函数与奇妙多态性。VC工程的编译原理与过程,将工程不同的类拆分到不同的原文件,每一个类由一个.h和.cpp文件共同完成,然后解决头文件重复定义问题,培养了学员良好的编程习惯,也为以后分析MFC Appwizard生成的工程奠定了良好基础。 第三课: 讲述MFC AppWizard的原理与MFC程序框架的剖析。AppWizard是一个原代码生成工具,是计算机辅助程序设计软件,Winmain在MFC程序是如何从源程序被隐藏的,theApp全局变量是如何被分配的,MFC框架的几个类的作用与相互关系,MFC框架窗口是如何产生和销毁的,对窗口类的PreCreateWidow和OnCreate两个函数的着重分析,Windows窗口与C++的CWnd类的关系。 第四课: 讲述如何运用ClassWizard及对MFC消息响应函数机制的分析,理解发送给窗口的消息是如何被MFC框架通过窗口句柄映射表和消息映射表来用窗口类的函数进行响应的。掌握设备描述表及其封装类CDC的使用,CDC是如何与具体的设备发生关联的,融合具体的画图程序进行分析。如何设置封闭图形的填充刷子(位图画刷与透明画刷的使用)。 第五课: 掌握CDC的文字处理程序的编写,如何产生自定义字体和自定义插入符,熟悉对CString类的使用。通过对kala ok程序的编写,讲解定时器的使用和DrawText函数的巧妙运用。讲解如何使用CDC的裁减功能。 第六课: 菜单的工作原理及编写应用,菜单命令消息在MFC框架程序的几个类的传递顺序和处理过程。标记菜单的实现原理、图形菜单的实现及常犯错误的分析,GetSystemMetrics的应用,快捷弹出菜单的实现方式及其命令响应函数有效范围(与弹出菜单时所指定的父窗口有密切的关系,最底层的子窗口具有最优先的处理机会)。 第七课.: 动态菜单的编写,如何让程序在运行时产生新的菜单项及如何手工为这些新产生的菜单命令安排处理函数,如何在顶层窗口截获对菜单命令的处理,更进一步掌握CString类的应用。 第八课.: 对话框用户界面程序的编写,如何向对话框控件联接数据成员及其实现机理,如何向对话框控关联控件类,如何利用对话框类的成员函数向控件发送消息和获取对话框控件的类指针,如何直接利用对话框控件类操纵对话框控件(发送消息和直接调用成员函数)。如何在程序运行时产生和销毁控件。对话框控件的几种操作方式的优劣比较分析。 第九课: 如何让对话框上的文本框在程序启动后立即获得焦点,如何利用SetWindowLong改变窗口的回调函数,通过改变文本框的默认回车处理方式进行演示。实现多个输入文本框间通过回车逐一向下传递焦点的另一种巧妙方法(用缺省按钮来处理)。利用SetWindowLong和定时器轮回改变窗口的图标。如何实现对话框的部分收缩和展开。如何在主对话框程序启动时立即隐藏对话框的巧妙实现方式与精妙思想(不能直接在OnInitDialog处理。包括自定义消息的实现) 第十课: 如何制作属性页对话框和向导对话框,融合讲解组合框(如何调整组合框的大小)、列表框、单选按钮、复选按钮 等常用对话框控件的多种使用方法。如何限制用户在不满足设定的条件时切换到其他属性页和向导页。 第十一课: 如何修改MFC AppWizard向导生成的框架程序的外观,包括修改标题栏的多种方式及原理,修改图标、光标、背景的两种方法。如何给应用程序增加工具栏和删除工具栏按钮。定制状态栏,在CView获取状态栏对象的几种方式,在状态栏添加时钟显示(掌握CTime类和静态成员变量和函数的用法),鼠标坐标显示,进度条(主窗口产生后立即产生进度条的巧妙思想,不能在OnCreate函数直接处理,要用到自定义消息的方法)。如何为窗口添加背景位图。 第十二课: 如何使用自定义画笔(颜色,线宽,线形),画刷(形状,颜色)。如何为程序添加选项菜单和选项设置对话框,如何使用标准颜色对话框,窗口重绘原理,在选项对话框实现预览功能。实现选项对话框和窗口类的数据交换。 第十三课: 如何让CDC上输出的文字、图形具有保持功能,元文件设备描述表的使用,CpaintDC与CClientDC的区别与应用,OnPaint与Ondraw在CView的关系及实现内幕,集合类CObArray的使用,滚动窗口的实现,设备坐标与逻辑坐标的转换。 第十四课: 文件读写,CFileDialog,CFile,fstream,CArchive类的使用与比较。在应用讲解const char *与char * const的区别,字符串的使用原理,如何使用CString的内存缓冲区。注册表与win.ini文件的读写方式及相关知识点。 第十五课: 如何利用CDocument类的串行化存储功能及MFC框架程序提供的文件打开与保存功能的实现原理。如何实现类对串行化的支持,CObArray的串行化实现内幕。MFC框架程序的几个主要类之间如何获得相互的指针引用。 第十六课: 网络程序的编写,Socket是连接应用程序与网络驱动程序的桥梁,Socket在应用程序创建,通过bind与驱动程序建立关系。此后,应用程序送给Socket的数据,由Socket交给驱动程序向网络上发送出去。计算机从网络上收到与该Socket绑定的IP+Port相关的数据后,由驱动程序交给Socket,应用程序便可从该Socket提取接收到的数据。网络应用程序就是这样通过socket进行数据的发送与接收的。UDP与TCP的工作原理与编写过程,包含如何在程序连接库文件,telnet工具软件在编写网络程序的用途 第十七课: 多线程程序的编写,如何通过互斥来保证多线程的安全。如何利用命名互斥保证只有一份程序实例被运行,结合多线程,网络编程,自定义消息,数据类型转换,如何改变文本框对回车的默认处理方式等技术编写网络聊天程序。 第十八课: 动态连接库程序的编写,库函数的两种输出方式。调用程序对动态连接库的静态连接与动态连接方式,如何利用工具查看动态连接库里的函数,C/C++连接规范的命名转变问题分析,如何获得动态连接库里的函数 的指针,如何用typedef声明指向函数的指针类型。如何调试动态连接库。 第十九课: ActiveX控件的应用与工作原理,ActiveX控件的编写,如何为控件安排属性,方法,事件,属性页,持久性存储。如何注册控件与取消控件注册。如何测试与调试控件。 第二十课: 综合答疑与一些高深主题的介绍,包括如何安装系统钩子函数,dll连接库里的全局变量数据共享问题分析,ADO数据库编程,如何将数据库记录显示在Clistview网格。 以上内容为作者对课件的初步整理,还有很多课堂上要讲到,但在本大纲还没有被撰稿的内容,以后将逐渐完善本大大纲。
VC实例精通一书的源码。 第2章(\Chapter02) 示例描述:本章介绍常用Win32控件的使用方法。 01_EditDemo 演示静态文本、文本框、按钮控件的使用方法 02_CheckBoxDemo 演示复选框和单选按钮控件的使用方法。 03_ComboBoxDemo 演示组合框和列表框控件的使用方法。 04_ScrollBarDemo 演示滚动条控件的使用方法。 05_SpinDemo 演示数值调节按钮的使用方法。 06_ProgressDemo 演示进度条控件的使用方法。 07_SliderDemo 演示滑块控件的使用方法。 08_HotkeyDemo 演示热键控件的使用方法。 09_ListCtrlDemo 演示列表控件的使用方法。 10_TreeCtrlDemo 演示树形控件的使用方法。 11_RichEditDemo 演示格式文本框的使用方法。 12_TabCtrlDemo 演示属性页的使用方法。 13_AnimateDemo 演示动画控件的使用方法。 14_DateTimeDemo 演示日期时间选择控件的使用方法。 15_CalendarDemo 演示日历控件的使用方法。 16_IPCtrlDemo 演示IP输入框的使用方法。 第3章(\Chapter03) 示例描述:本章介绍高级Win32控件的使用方法。 01_MenuDemo 演示窗体菜单的使用方法。 02_PopMenuDemo 演示弹出式菜单的使用方法。 03_ToolbarDemo 给窗体添加标准工具栏。 04_Toolbar256 使工具栏支持256色位图。 05_StatusBarDemo 在窗体的状态栏区域输出信息。 06_ColorStatusBar 在状态栏添加彩色渐变进度条。 07_ToolTipDemo 使用ToolTip显示即时提示。 第4章(\ Chapter04) 示例描述:本章介绍窗体的使用方法和使用技巧。 01_WindowDemo 演示创建和显示窗体的方法。 02_TopMostWnd 让窗体保持在桌面最顶层。 03_TransparentWindow 创建半透明窗体。 04_EllipticalWindow 创建椭圆窗体。 05_TextPathWnd 创建文字异形窗体。 06_ImagePathWnd 根据图片创建异形窗体。 07_AnimatedWnd 以动画方式显示和隐藏窗体。 08_AutoSize 让窗体上的控件自动适应窗体大小。 09_AutoSizeEx 多个控件改变大小时防止闪烁。 10_LimitSize 限制窗体的最大和最小尺寸。 11_AutoPos 让窗体具有停靠效果。 12_EnumWnd 枚举系统的窗口。 第5章(\ Chapter05) 示例描述:本章介绍创建对话框以及通用对话框使用技巧。 01_ModalDlg 显示模式对话框。 02_ModallessDlg 显示非模式对话框。 03_OpenFileDemo 使用打开文件对话框。 04_SaveFileDemo 使用保存文件对话框。 05_FontDlgDemo 使用字体选择对话框。 06_FontDlgDemo_Color 使用字体选择对话框。 07_PreviewFileDlg_Demo 为打开文件对话框增加预览功能。 08_InputDlg_Demo 从内存创建对话框。 第6章(\ Chapter06) 示例描述:本章介绍Windows应用程序消息循环的原理和消息处理技巧。 01_PeekMsgDemo 传递并响应Windows消息。 02_SendMsg 发送Windows消息。 03_MsgInMfc 了解MFC的映射消息机制。 04_UserMsg 使用自定义消息。 05_DoubleEdit_Demo 拦截并处理Win32控件的消息。 第7章(\ Chapter07) 示例描述:本章介绍Windows系统和外壳编程的技巧。 01_TimerDemo 使用计时器。 02_RegDemo 访问系统注册表。 03_SuperPwd 用随机数生成强力密码。 04_ShellOpen 打开一个和程序相关联的文档。 05_ClipboardDemo 访问Windows剪切板。 06_ClipboardMonitor 监视剪切板内容变化。 07_TrayIconDemo 使用系统托盘图标。 第8章(\ Chapter08) 示例描述:本章介绍在应用程序使用Windows基本设备的方法和技巧。 01_MouseSample 处理鼠标消息。 02_KeyTest 处理键盘消息。 03_MouseMoving 利用客户区鼠标消息拖动无边框窗体。 04_NCMsg 利用非客户区鼠标消息控制无边框窗体。 05_LockMouse 限制鼠标移动区域。 06_MyEvent 模拟键盘鼠标消息。 07_ClipboardHelper 使用系统热键消息使后台程序得到通知。 第9章(\ Chapter09) 示例描述:本章学习Windows进程的创建和管理方法。 01_StartProcess 创建和结束进程。 02_RedirectStdio 用匿名管道获取控制台程序的输出。 03_CatchError 拦截并处理外部进程的错误。 04_SingleInstance 防止应用程序运行多个实例。 05_ProcessMsg 用消息在进程间通讯。 06_MappingFile 用内存映射文件在进程间通讯。 07_ProcessList 枚举并得到系统所有进程信息。 第10章(\ Chapter10) 示例描述:本章学习Windows线程的创建和管理方法。 01_PrimeNumberFinder 主线程和用户界面。 02_PrimeNumberFinderEx 创建和结束线程。 03_PrimeNumberFinal 用临界区对象同步线程。 04_BigPrimeNumber 用事件对象同步线程。 05_SemaphoreDemo 用信号量对象同步线程。 06_ThreadPriority 调整线程优先级。 第11章(\ Chapter11) 示例描述:本章学习使用VC6进行图形图像开发的技巧。 01_ZoomBitmap 用DC对象缩放位图。 02_DrawLine 用画笔对象画线。 03_BrushDemo 用画刷对象填充区域。 04_RollText 在屏幕上输出文本。 05_PicShow 使用GDI+读取不同格式的图片。 06_PicShowEx 使用GDI+保存不同格式的图片。 07_Snap 制作屏幕截图程序。 08_Watermark 给图片增加版权信息。 第12章(\ Chapter12) 示例描述:本章学习使用VC6进行文件IO开发的技巧。 01_BinaryView 用基本API编写二进制编辑器。 02_MyCompressor 用MFC类编写文件压缩软件。 03_DirMonitor 监控硬盘上文件的变化。 04_HddSpace 获取本机所有磁盘及其空间使用情况。 05_WideText 文本保存及编码方式。 06_XmlReader 读写XML文件。 07_SerialPort 读写串口数据。 第13章(\ Chapter13) 示例描述:本章学习使用VC6进行数据库开发的方法和技巧。 01_ODBC_Source 创建ODBC数据源。 02_ODBC_Demo 通过ODBC访问Access数据库。 03_ADO_Demo 通过ADO访问据库。 04_ExecProc 调用SQL Server的存储过程。 05_TransExec 事务处理SQL Server命令。 06_BinData 存取数据库的图片。 07_CreateMdb 在程序动态生成Access数据库。 第14章(\ Chapter14) 示例描述:本章学习使用VC6进行网络开发的方法和技巧。 01_UdpClient 建立UDP连接客户端。 02_UdpServer 建立UDP连接服务器端。 03_TcpClient 建立TCP连接客户端。 04_TcpServer 建立TCP连接服务器端。 05_MfcSock 使用MFC的SOCKET类。 06_MyWebProtocol 注册自己的浏览器地址栏协议。 07_GetHttpStr 抓取网页内容。 08_VisualPing 基于ICMP编写网络速度监控程序。 第15章(\ Chapter15) 示例描述:本章介绍一些Windows高级编程技术。 01_AppSnap 制作鼠标HOOK。 02_PasswordShow 用鼠标HOOK读取密码框的内容。 03_KeyVoice 制作键盘HOOK。 04_SysKey 用键盘HOOK屏蔽系统按键。 05_DlgSkinDemo 用HOOK技术给对话框换肤。 06_PeExport 分析DLL文件获取其导出函数列表。 第16章(\ Chapter16) 示例描述:本章介绍VC6在多媒体开发方面的应用技术。 01_BgMusic 用基本API播放声音。 02_MP3Player 用MCI播放音频。 03_MyReal 调用RealPlayer播放音频文件。 04_Recorder 制作录音机程序。 05_GifCtrl 在VC显示动态的GIF动画。 06_FlashWnd 在VC播放Flash动画。 07_MediaPlayer 在VC播放视频。 08_CaptureVideo 在VC实现视频采集及截图功能。 第17章(\ Chapter17) 示例描述:本章介绍VC6在ActiveX方面的应用技术。 01_MyActiveX 创建ActiveX控件。 02_MyActiveX2 为ActiveX控件增加属性和方法。 03_ActiveXInDlg 在应用程序使用ActiveX控件。 04_ActiveXInWeb 在浏览器使用ActiveX控件。 05_MyActiveX3 在VC显示动态的GIF动画。 06_RegOCX 在程序注册和注销ActiveX控件。 第18章(\ Chapter18) 示例描述:本章介绍如何将应用程序制作成完整的应用软件的技术。 01_MyHelp 制作帮助文件。 02_Setup 制作安装程序。 03_MultiLanguage 让应用程序界面支持多语言。 04_MultiLanguageEx 多语言的字符串常量。 05_SetupEx 制作多语言的安装程序。

16,467

社区成员

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

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

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