mfc

Is it safe to use LPCTSTR in a structure with the WM_COPYDATA message?

谁说我不能喝 提交于 2021-02-19 08:37:05
问题 I have this structure: typedef struct tagCOPY_PACKET { TCHAR szFile[_MAX_PATH]; GUID guidSignature; } S_COPY_PACKET; I prepare to send data with WM_COPYDATA like this: CString strFile = GetFileToOpenFromFileExplorerPath(); S_COPY_PACKET sCopyDataPacket; _tcscpy_s(sCopyDataPacket.szFile, _MAX_PATH, strFile); sCopyDataPacket.guidSignature = CopyData_Signature; COPYDATASTRUCT cds; cds.dwData = COPYDATA_TYPE_MSA; cds.cbData = sizeof(sCopyDataPacket); cds.lpData = &sCopyDataPacket; DWORD_PTR

CMDIChildWnd look & feel on Windows-10

删除回忆录丶 提交于 2021-02-19 05:51:51
问题 I have an MDI application. It has been developed over the years. On Windows-7 everything looks native. When I start the application on windows-10, normal dialogs will have the windows-10 look & feel. But all child views still have the Windows-7 look & feel. I tried to change from CMDIChildWnd to CMDIChildWndEx but it made no difference to the window look & feel (except of another border style around the client rect). I do not want to change all child views to dock panes as it will change the

MFC: After applying a CSplitterWnd to my CChildFrame the main window title isn't updated any more

旧时模样 提交于 2021-02-17 05:37:51
问题 Still using VS 2008, I have split my MDI view class in my CChildFrame to facilitate a navigation sidebar (a CListCtrl ) next to my old CScrollView using a static splitter (source code). This however implied two side effects: Beside the mouse wheel no longer working (where I found a workaround for), the application window is no longer updated on SetPathName() . What do I need to do to bridge the splitter so the framework updates the application window again based on my CDocument ? 回答1: On your

MFC Menu Item remains grayed

守給你的承諾、 提交于 2021-02-13 12:53:21
问题 I have a CDialogEx Class called Properties in which I handle the ON_COMMAND message. Now, ON_COMMAND should get called when I click the menu item ID_EDIT_PROPERTIES (as a submenu from main menu). The event handler wizard wrote that code for me, but when I start the Application the menu item remains grayed out. I've tried to manually activate it by calling EnableMenuItem when ON_UPDATE_COMMAND_UI happens, but to no avail. Any help would be greatly appreciated. 回答1: You just need to understand

MFC Menu Item remains grayed

别等时光非礼了梦想. 提交于 2021-02-13 12:53:11
问题 I have a CDialogEx Class called Properties in which I handle the ON_COMMAND message. Now, ON_COMMAND should get called when I click the menu item ID_EDIT_PROPERTIES (as a submenu from main menu). The event handler wizard wrote that code for me, but when I start the Application the menu item remains grayed out. I've tried to manually activate it by calling EnableMenuItem when ON_UPDATE_COMMAND_UI happens, but to no avail. Any help would be greatly appreciated. 回答1: You just need to understand

MFC Change CMFCToolBar button to Toggle instead of press/release?

ぃ、小莉子 提交于 2021-02-11 16:16:30
问题 I found an article online that said to setup the toolbar button to be a type that stays pressed you just set a style TBBS_CHECKBOX on the button but it doesn't work for me (it still acts like a normal button). I confirmed the style is set, just after created and the SetWindowText() MFC wizard setup of CMainFrame::OnCreate() . What am I doing wrong? for (int i=0; ; i++) { int id=m_wndToolBar.GetItemID(i); if (id==0) { break; } if (id == ID_THE_ID) { m_wndToolBar.SetButtonStyle(i, TBBS_CHECKBOX

MFC Change CMFCToolBar button to Toggle instead of press/release?

自古美人都是妖i 提交于 2021-02-11 16:13:53
问题 I found an article online that said to setup the toolbar button to be a type that stays pressed you just set a style TBBS_CHECKBOX on the button but it doesn't work for me (it still acts like a normal button). I confirmed the style is set, just after created and the SetWindowText() MFC wizard setup of CMainFrame::OnCreate() . What am I doing wrong? for (int i=0; ; i++) { int id=m_wndToolBar.GetItemID(i); if (id==0) { break; } if (id == ID_THE_ID) { m_wndToolBar.SetButtonStyle(i, TBBS_CHECKBOX

How to manually show CMFCToolBarComboBoxButton sub-menu?

你。 提交于 2021-02-11 13:59:50
问题 Standard behaviour for CMFCToolBarComboBoxButton is to have a clickable button plus a drop-down arrow for displaying a submenu. I want to show the submenu independently of where the click was made. How can I do it? My code to create the button is, more or less, the following (it has been extracted from a larger project, so I apologize for any missing not-too-important piece of code): // In class declaration: CMenu m_menu; CMFCToolBar m_toolbar; // Where toolbar initialization takes place: m

How to manually show CMFCToolBarComboBoxButton sub-menu?

余生长醉 提交于 2021-02-11 13:57:31
问题 Standard behaviour for CMFCToolBarComboBoxButton is to have a clickable button plus a drop-down arrow for displaying a submenu. I want to show the submenu independently of where the click was made. How can I do it? My code to create the button is, more or less, the following (it has been extracted from a larger project, so I apologize for any missing not-too-important piece of code): // In class declaration: CMenu m_menu; CMFCToolBar m_toolbar; // Where toolbar initialization takes place: m

How to show text in a form edit box that is being send to a static function from DLL? [duplicate]

柔情痞子 提交于 2021-02-11 12:50:33
问题 This question already has an answer here : “a value of type ”void (exeCallback::*)(int)“ cannot be assigned to an entity of type ”void (*)(int)“” [duplicate] (1 answer) Closed 6 days ago . I am new learner and developing an MFC application and MFC shared DLL. Main application has a static function that is being called by dll as a callback and it returns a text string. I need to show this text in a edit box in form view. Please advise how to do it. PlotterDoc.h class PlotterDoc : public