mfc

MFC树形控件加载Access数据库数据

不打扰是莪最后的温柔 提交于 2020-01-09 01:41:14
研究了好几天,今天终于弄好了,下面是代码 [dlg.cpp] 在初始函数OnInitDialog()中加 HICON hIcon[3]; HTREEITEM hRoot; //加载三个图标 hIcon[0] = theApp.LoadIconW(IDI_ICON1); hIcon[1] = theApp.LoadIconW(IDI_ICON3); hIcon[2] = theApp.LoadIconW(IDI_ICON2); m_imageList.Create(16, 16, ILC_COLOR16, 3, 3); for (int i=0;i<3;i++) { m_imageList.Add(hIcon[i]); } //绑定树控件与ImaageList m_webTree.SetImageList(&m_imageList, TVSIL_NORMAL); //初始化Ado环境 AfxOleInit(); hRoot = NULL; OpenConn(); //打开数据函数 LoadTreeCtrlData(hRoot,_T("0")); //递归加数据到树控件中 CloseConn(); //关闭数据库 //下面就是递归函数 void CMFCApp_CTreeCtrl_testDlg::LoadTreeCtrlData(HTREEITEM hItem,CString mid

MFC文件操作

我与影子孤独终老i 提交于 2020-01-08 05:03:51
第二步 读写文件操作:       (1) 文件类        CFile   (2) 构造方法       CFile::CFile();   CFile::CFile( LPCTSTR lpszFileName, UINT nOpenFlags );   lpszFileName      文件名   nOpenFlags        打开方式,有:               CFile::modeCreate:以新建方式打开,如果文件不存在,新建;                          如果文件已存在,把该文件长度置零,即清除文件原有内容。               CFile::modeRead:只读。               CFile::modeWrite:只写。               CFile::modeReadWrite:以读写方式打开文件。               CFile::modeNoTruncate:以追加方式打开,如果文件存在,打开并且不将文件长度置零,如果文件不存在,会抛出异常。                             一般与CFile::modeCreate一起使用,则文件不存在时,新建一个文件;存在就进行追加操作。   用例如下:     CFile ReadFile

VS MFC按钮控件的禁用与启用

≯℡__Kan透↙ 提交于 2020-01-07 22:05:40
1. 给这个按钮添加Control成员变量,如m_btnQuit,这时调用 m_btnQuit.EnableWindow(FALSE); //禁用按钮 m_btnQuit.EnableWindow(TRUE); //启用按钮 2. 如果没有添加成员变量,假设此按钮在一个对话框中,这时调用 ((CButton*)GetDlgItem(按钮ID))->EnableWindow(FALSE) //禁用按钮 ((CButton*)GetDlgItem(按钮ID))->EnableWindow(TRUE) //启用按钮 来源: CSDN 作者: PtaQ 链接: https://blog.csdn.net/qq_40969467/article/details/103881793

Implementing ActiveX Control for web browser

大城市里の小女人 提交于 2020-01-07 08:32:26
问题 My requirement is to develop a ActiveX control which can send the byte stream to serial port. The ActiveX control should expose only one function like SendData(char* data, int nLen, int nPort) This function should be able to be invoked by pressing a button developed in java rendered in Internet Explorer(both 32 and 64 bit). I am confused whether i should go with windowless ActiveX control using MFC/ATL or Browser Helper Objects. In future i may need to support Firefox also. Any help will be

MFC界面开发难上手?BCGControlBar v30.3帮你忙—工具栏和菜单

南楼画角 提交于 2020-01-07 08:29:24
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 亲爱的BCGSoft用户,我们非常高兴地宣布 BCGControlBar Professional for MFC 和 BCGSuite for MFC v30.3正式发布!此版本包含新的主题文件对话框、可视化主题轻松选择器、改进的脚本控件以及其他新功能和改进!本文将为大家介绍v30.3中发布的新功能!让您对BCG最新发布的版本有一个全新的认识和了解。需要最新版的可以点击这里【 BCG下载 】 工具栏和菜单 1. CBCGPToolBarImages :: AddImage和CBCGPToolBarImages :: UpdateImage方法现在具有2个可选参数:bFitImage — 使图像适合当前大小和bPremultiplyAlpha。 2. CBCGPToolBarImages:添加新方法Attach和Detach。 3. CBCGPStatusBar::SetPaneTextColor:添加新的可选参数'clrTextDisabled'。 4. CBCGPOutlookWnd::SetToolbarImageList:具有新的可选参数bAutoScale。 对话框和表单 1. CBCGPSplitterWnd:实现新的对话模式。默认情况下,CSplitterWnd

Exceptions raised running COM DLL

懵懂的女人 提交于 2020-01-07 06:47:49
问题 I will try again .... :) If I have this code: void CTestDlg::OnBnClickedButtonTest() { MSAToolsLibrary::IMSAToolsLibraryInterfacePtr p; HRESULT hr; hr = p.CreateInstance(__uuidof(MSAToolsLibrary::MSAToolsLibraryClass)); if (FAILED(hr)) { __int64 i; p->SetPathXML(m_strPublisherDatabaseXML.AllocSysString(), &i); p->ReadPublisherData(&i); } } And I run it, I get this silent exception: Exception thrown at 0x00007FFCD00B7788 (KernelBase.dll) in Test.exe: 0x04242420 (parameters: 0x0000000031415927,

How to split a Window dynamically in MFC without using CSplitterWnd::Create

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-07 06:20:15
问题 I create a MFC MDI application, and want to split a window into two parts at a time dynamically by right click and choosing a "AddSplitWnd" pop menu item. I try to use CSplitterWnd::CreateStatic to implement it, once the window is split, it need to create a new view, but I want to use the previous view instead, so does anyone know how to implement it. Thank you. 回答1: Here is a code snippet to exchange views in a splitter in a SDI environment. This should be adaptable to work in MDI as well.

Integrating paypal with c++ MFC app

陌路散爱 提交于 2020-01-07 05:03:49
问题 We are planning to integrate Paypal with one of our cpp application written using MFC. The question is shall we use Rest apis to accomplish this? or there is any other easier way to do achieve this? I have recently used Paypal REST Services via Postman and they look pretty easy. What I want to achieve is how can I use rest apis for paypal without launching the browser ? How can I achieve Login credentials from the user ? Can anyone point me to right direction ? Appreciate your help in advance

How to Convert char* to LPWSTR in VC++?

北战南征 提交于 2020-01-07 03:53:33
问题 How to Convert char* to LPWSTR in VC++ ? LPNETRESOURCEW nr = NULL; memset(&nr, 0, sizeof (NETRESOURCE)); nr->lpLocalName = strDriveLetter.GetBuffer(strDriveLetter.GetLength()); // this line giving me error "Cannot Convert char* to LPWSTR" Any help is appreciated. Thanks. 回答1: Use MultiByteToWideChar function; const char* msg = "foobarbaz"; int len = strlen(msg) + 1; wchar_t *w_msg = new wchar_t[len]; memset(w_msg, 0, len); MultiByteToWideChar(CP_ACP, NULL, msg, -1, w_msg, len); 回答2: memset(

MFC can't load error string resources in dbcore.cpp

随声附和 提交于 2020-01-07 02:22:26
问题 I have an old MFC application I've recently updated to include code that uses CDatabase to access an old MDB. This works, but when an internal error occurs, I get an assertion in dbcore.cpp that it could not load the error string resource. After some research, I added the following line to my application's RC file. #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // #ifndef APSTUDIO