mfc

c/c++, mfc: Not passing open files / handles to a spawned process

In unix I know the routine: between fork() and exec() in the child I close everything except stdin/out/err, so that all the open ports or files are not passed to the program I want to run. But how do I do this in windows? In my case I'm implementing a DLL in C/C++, and I need to close both some files I opened (indirectly via some object...

How to force AfxMessageBox to center on mainframe and not whatever child window that currently has focus.

I'm developing an MDI application, the primary document is maximized in the MDI frame. I create a non-modal dialog pop-up to display secondary information to the user while they work in the main window. However, when the user moves the pop-up it takes focus which is expected. The problem occurs when this window has focus and an event ...

How Can I pass message from DLL to Application

I have a ATLCOM Shell Extension which adds Right Click Extension to Windows Explorer. How Can I pass a message from my DLL to another MFC application. To Sumarize, I want to pass a Message from DLL to MFC application. ...

Customize Title Bar (Colored,Text,icon etc) in dialogBox foe WinCE 6.0

Hey i am new bie in winCE and working on 6.0 version, is there anyway to change the look and feel of dialog title bar in wince , i have tried with WM_NCPAINT message but it is not there in wince.... So is that any other way to do the same...?? Thanks, Mukesh ...

how to use ribbon category to switch view?

Hi ! I want to use two ribbon category buttons to switch between two different views, but I found it can't add event handler to the button. Is there any hint to solve this problem? Better if there is some sample, actually I'm new to MFC. ...

Disable aero fade-in effect on dialog

I have a modal dialog I'm creating with MFC. When it appears, the Aero theme does it's fade-in transition for a new window appearing. In my particular case I'm switching immediately from one dialog to another and the fade effect is distracting. Is there a way it can be disabled so the window immediately appears, like it does when Aero...

Create new category section for property when bulding ActiveX component in MFC

Hi everyone. I'm building ActiveX component in MFC. The problem is that all properties automatically added to miscellaneous section. I want to unite some new properties with new category. I haven't found it in any microsoft samples. However in some advanced ActiveX controls like Component One controls there are new categories, so it is...

How to use the Context Category control ?

Just like the title , I don't know how to use the ribbon's ContextCategory control. And I hope anyone can told me how to use it,or give me some examples.Thank a lot!!! ...

the dialog desn't show correctly when it's created in sub-thread

I'm trying to add a pop-up message function in my project.And I make it run in a subthread since I need a realtime notification.But I find if the notification dialog is created in my subthread(started by AfxBeginThread),all the elements(buttons,urls....) of the dialog are not shown.The message box is just a blank dialog.If I extract the ...

Is it possible to manipulate the menu of my CMDIFrameWndEx's CMFCMenuBar?

My main frame has a CMFCMenuBar member, which contains the menu of the current document type. I would like to add/remove a sub-menu dynamically. For example, if the user chooses to display a map pane, I want to add a map submenu next to the "File" menu. Vice versa, if the map pane gets closed, I also want to remove the map menu items. ...

Problems with MFC link control wrapping

I'm using a CMFCLinkCtrl in my custom dialog that inherits from CDialog. The CMFCLinkCtrl is set dynamically using data that is set by the user in another part of the application, so I have to handle long urls. Is there a way to have the link control truncate what is displayed in the dialog and add an ellipse to the end? Currently the c...

Is there any way to speed up frequent file write operations? CFile.

My task is to write small parts of data to file frequently and guaranteed. It's a some type of logging system, that must provide a guaranteed safety and speed of saving data to disk. I found that brakes appear in the Flush() function that is called too often. So, I decided to get rid of it. I used flags, that prohibit buffering and cach...

Get a process Owner Name in mfc

Hi All, I want to get the user name who has launched the given application. For Example if Outlook or IE is launched I need to get the Name of the user who has launched it. This should be generic across all Windows OS . But the solution given below is failing in Windows 2003 user ,in both ADMIN and Standard User. ...

How to get HANDLE for an application

How to get HANDLE for an application say Outlook from my program ...

how to transfer a binary file through serial port in vc++

Hi i have to read a binary file from the disk and i have to transfer the file over serial port, i am using mscomm in vc++ 6.0 . how to transfer a binary file through serial port. Thanks in advance. ...

Adding AES encryption to VC++ application

Hi, I created a GUI application in VC++ and now I wanted to do a AES128 encryption to the data, I am writting to it. Can anyone please let me know how can I do that in VC++. ...

How to make a dialog as same size as another dialog in MFC?

I am in process of creating a dialog IDD_DIALOG2 which i want to be in the same size as existing dialog IDD_DIALOG1, what would be the easiest way to do this in VC++? ...

Use wildcards with FindWindow api call with mfc.

I am using FindWindow in an mfc application. HWND hWnd = ::FindWindow(NULL, _T("foobar v5")); I would like to use FindWindow with wildcards so that I can match just foobar. Thanks ...

CSpinButtonCtrl drawing problem with small CEdit control

Hi, I'm trying to draw a CSpinButtonCtrl as a buddy of an edit box in Windows 7. When my CEdit window is 12 dialog units high, the spin buttons are scaled really badly and the top border is clipped off. This looks pretty ugly. How can I get around this, or must I restrict my CEdit controls to be 14 dialog units high? My controls are...

MFC drawing hatched CBrush leaving the background unchanged

Hi, I want to draw a hatched brush but leave the background unchanged. I tried : CBrush m_HatchBrush(HS_BDIAGONAL,RGB(255, 0, 0)); p_DC->SelectObject(&m_HatchBrush); p_DC->SetBkMode(TRANSPARENT); p_DC->FillRect(m_DepartureRect, &m_HatchBrush); It draws the hatched square but the background is not showing it is always white. How do...