mfc

after writing the code to add a toolbar to a dialog-based mfc the dialog doesn't run

让人想犯罪 __ 提交于 2020-01-22 02:36:09
问题 here's the code that I have used to create a toolbar on my dialog and I am in the early stages of the tutorial just added these codes to my program: InitialJobProject2Dlg.h CToolBar m_FirstToolBar; InitialJobProject2.cpp BOOL CInitialJobProject2Dlg::OnInitDialog() { CDialogEx::OnInitDialog(); // Add "About..." menu item to system menu. // IDM_ABOUTBOX must be in the system command range. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX < 0xF000); CMenu* pSysMenu =

Visualisation of uft-8 (Polish) not working properly

ぐ巨炮叔叔 提交于 2020-01-22 00:37:25
问题 My software supports multiple languages (English, German, Polish, Russian, ...). For this reason I have some language specific files with the dialog texts in the specific language (Encoded as UTF-8). In my mfc application I open and read those files and insert the text into my AfxMessageBoxes and other UI-Windows. // Get the codepage number. 65001 = UTF-8 // In the real code this is a parameter in the function I call (just for clarification) LANGID languageID = 65001; TCHAR szCodepage[10];

How to make a modeless dialog always on top within the app

微笑、不失礼 提交于 2020-01-21 20:21:52
问题 I have a modeless popup dialog in my app. I want to make it topmost only within the app it belongs to, not always topmost on the desktop. I have tried to set the first parameter to wndTopMost, but this way the dialog will remain on top on the desktop, which is very bad user experience. I have also tried wndNoTopMost with SWP_NOZORDER parameter, but this only put the dialog in front when its displayed. If I move another dialog/window to the dialog location, the dialog will be buried under the

convert CString to CTime

血红的双手。 提交于 2020-01-21 12:13:27
问题 In smart device MFC application : I have successfully converted CTime to CString . Now I want to convert it back, CString to CTime . How can I do that? 回答1: Use COleDateTime::ParseDateTime(CString) and then convert it to CTime. 回答2: Check out the example mentioned in this MSDN doc page: COleDateTime::ParseDateTime 来源: https://stackoverflow.com/questions/3411967/convert-cstring-to-ctime

CPP + Regular Expression to Validate URL

无人久伴 提交于 2020-01-21 07:25:07
问题 I want to build a regular expression in c++{MFC} which validates the URL. The regular expression must satisfy following conditions. Valid URL:- http://cu-241.dell-tech.co.in/MyWebSite/ISAPIWEBSITE/Denypage.aspx/ http://www.google.com http://www.google.co.in Invalid URL:- http://cu-241.dell-tech.co.in/\MyWebSite/\ISAPIWEBSITE/\Denypage.aspx/ = Regx must check & invalid URL as '\' character between "/\MyWebSite/\ISAPIWEBSITE/\Denypage.aspx/" http://cu-241.dell-tech.co.in//////MyWebSite

Exporting a MFC Dialog from a DLL

China☆狼群 提交于 2020-01-21 04:52:07
问题 21st July: Updated, see bottom In VC++ 2005 I have 2 projects. Firstly, a MFC DLL project (not an extension DLL) which has a simple dialog: TestDlg.h #pragma once #include "afxwin.h" #include "resource.h" // CTestDlg dialog namespace Dialogs { class __declspec(dllexport) CTestDlg : public CDialog { DECLARE_DYNAMIC(CTestDlg ) public: CTestDlg (CWnd* pParent = NULL); // standard constructor virtual ~CTestDlg (); // Dialog Data enum { IDD = IDD_TEST_DLG }; } } Then I have a Win32 console app,

How Can I Monitor Which Window Currently Has Keyboard Focus

浪子不回头ぞ 提交于 2020-01-19 11:00:07
问题 Is there a way to track which window currently has keyboard focus. I could handle WM_SETFOCUS for every window but I'm wondering if there's an alternative, simpler method (i.e. a single message handler somewhere). I could use OnIdle() in MFC and call GetFocus() but that seems a little hacky. 回答1: So from the way you worded the question I'm inferring that you want to have an event handler which is invoked whenever focus switches between windows. You want to be notified, rather than having to

MFC 生成可执行的exe

青春壹個敷衍的年華 提交于 2020-01-19 00:02:39
1.工程右键选择属性: 2.【配置(C)】选择<Release>,【配置属性】-》【常规】-》【项目默认值】-》【MFC的使用】选择<在静态库中使用MFC>: 3.【配置属性】-》【C/C++】-》【代码生成】-》【运行库】选择<多线程(/MT)>: 4.点击应用,再点击确定: 5.解决方案配置选择Release: 6.生成解决方案,然后再工程文件夹的Release目录下会有生成的可执行的exe。 来源: CSDN 作者: 火柴棍mcu 链接: https://blog.csdn.net/professionalmcu/article/details/104028014

MFC创建内存映射文件二

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-17 17:39:03
知道了原理,现在开始编写具体的函数 1、首先要通过CreateFile()函数来创建或打开一个文件内核对象,这个对象标识了磁盘上将要用作内存映射文件的文件 2、通过CreateFileMapping()函数来创建一个文件映射内核对象以告诉系统文件的尺寸以及访问文件的方式。 3、通过MapViewOfFile()函数通过系统管理将文件映射对象的全部或部分映射到进程的地址空间。 4、操作文件Read/Write,对内存映射文件的使用和处理同通常加载到内存中的文件数据的处理方式基本一样。 5、在完成了对内存映射文件的使用后,还要通过一系列的操作完成对其的清除和使用过资源的释放。 void CMFCApplication1Dlg::OnBnClickedOk()//点击OK { CreateFileMappingEx(); } void CMFCApplication1Dlg::CreateFileMappingEx()//创建映射文件 { DWORD timebegin = ::timeGetTime(); HANDLE fp = CreateFile(TEXT("E://Config.ini"),//这里输入复制的源文件 sourcc GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE

WMI returns information in different formats

爷,独闯天下 提交于 2020-01-17 11:17:52
问题 I want to read the hardware configuration to check if a license for my software is valid. Currently, I tried using WMI . This works fine on many machines for several weeks but sometimes, without an obvious reason, WMI returns the hardware configuration in a different format. For example, the serial number of the primary hard disc is converted from characters to a hex string, with all character hex values being swapped pair wise. I figured out that different Windows user types (admin/normal)