mfc

Simple Thread Synchronization

I need a simple "one at a time" lock on a section of code. Consider the function func which can be run from multiple threads: void func() { // locking/mutex statement goes here operation1(); operation2(); // corresponding unlock goes here operation3(); } I need to make sure that operation1 and operation2 alwa...

How to conditionally compile VC6 resources

Hi, depending on a compile switch (values are COMPILE_A or COMPILE_B), which is set in the form of an envorinment variable, I want to compile my application with different settings, like application name and splash screen. I got this far: In "Project / Settings / C/C++ / Preprocessor Definitions" I added $(COMPILESWITCH) (results in...

How do you disable CBitmapButton?

How do you disable CBitmapButton? I tried using m_bitmapbutton.EnableWindow(false); but it doesn't work. It still fires an event. What I'm trying to do is prevent Button A from firing Event A if Event B is executing (from Button B). So in Event B, I want to disable Button A. ...

What is the maximum number of files limit?

What is the maximum number of files limit in this code? FIX: Common File Dialog Multiple Selection File Limit http://support.microsoft.com/kb/179372 ...

How to determine if mouse is moving clockwise or counterclockwise?

Hi, I have an MFC appplication where the user have to move the mouse around a circle circonference with a dragging mouvement. I need to retrieve the number of degrees during this mouse drag "rotation" and I need to know if it's clockwise or counterclockwise. At first, to determine the rotation direction, I was comparing x-coordinnate be...

How to inhib "Delayed Write Failed" message?

Hi, I have a Windows service running in a specified user account with write permission on a shared drive on another computer. The service is logging on that shared drive. I allow the user to enter mapped path or network path (e.g. z:\MyRemoteFolder or \RemoteComputer\MyRemoteFolder) as the log destination. As I am in an unstable netw...

Profiling each thread in a multithreaded environment

Is there any way to find out the actual time spent by a thread inside the CPU using MFC/Win32? By actual time, I mean I don't want to count the time the thread spent in states other than "Running". I tried GetThreadTimes() method in Win32 SDK but couldn't get the proper values. I want to do this because I want to check effect of setting ...

Why won't MFC::CHttpFile 'PUT' for me?

My code talks to a little Java application provided by a vendor. This Java app sets up a web server at localhost:57000 which is used to control the state of 'the machine'. For the purpose of this question, I need to change the state of 'the machine' from 'off' to 'on'. To make this happen I'm supposed to HTTP PUT the following string ...

Pointer to a MFC dialog class

Hello, Can someone please guide me on how to pass the reference pointer to the dialog class so that it can call DoModal? e.g. EditorSvr.cpp -- implementation of the interface class (which is also located in a DLL) CDialogClass1.cpp -- Dialog class that will receive the pointer from EditorSvr.cpp I tried to search the whole google bu...

Converting MFC/ATL code to Windows Form App.

I have a large amount of code for an MFC/ATL program that I would like to use in a windows form appllication. What is the easiest way to "convert" this code so that it compiles with /clr enabled and finds the basic classes, e.g. CObject, CString, CFile and the templates? ...

Dealing with obsolete versions of RTF

Summary questions: Do you know of a lightweight application that can save files in RTF Version 1.6 format? Do you know what version of RTF Abiword's "Rich Text Format for old apps" corresponds to? Do you know a way to inspect an RTF file and determine what version of RTF it's encoded under? Do you know which DLL describes the RTF forma...

php mcrypt_encrypt to C/C++/MFC equalivilent

Hello I have a PHP script that generates a product key for an application written in c++/MFC. The product key is email to the user and the user copy and pasts it in to my application. function EncryptData( $data ) { $key = "abcdefghijklmnopqrstuvwxyz"; // This encrypt method is described here // http://ca3.php.net/mcrypt $val =...

Choosing between a Dialog Based Vs SDI Projects

I am new to MFC well not entirely new but wanted to ask experts on this forum as why one would choose one project over the other. I hope this is not a stupid question as I am relatively new to MFC. Thanks so much ...

Moving an engineering application from standalone to internal to CAD

I have a large MFC C++ application that I would be very keen to port into AutoCAD and IntelliCAD. AutoDesk offer Object ARX for this purpose, which replaces the older and slower ADS technology. IntelliCAD, afaik only supports ADS. Has anyone out there done this, and if so which tools did you use and what pitfalls did you encounter? I...

Removing a control in Visual C++ 2005 (MFC)

I have a MFC dialog in Visual C++ 2005, (MFC Application) and I have added several controls to it. But Visual Studio has no option for deleting a control if I no longer need it. Is there any easy way to do that except modifying all the code where a reference to the control appears? ...

Adding drop down arrows to CMFCToolBar buttons

Can anyone explain how to add dropdown arrows to CMFCToolBar toolbar buttons - like for undo/redo buttons. We had this with CToolBar by using the TBSTYLE_EX_DRAWDDARROWS style and TBN_DROPDOWN notification. This doesn't seem to work with CMFCToolBar. These dropdown arrows i believe are added to the VisualStudioDemo MFC feature pack de...

Stopping a thread in Win32/MFC

I was reading through some threading related code and found this piece of code: MyThread::start() { //Create a thread m_pThread = AfxBeginThread(/*some parameters*/) //Create a duplicate handle for the created thread m_hDuplicateHandle = DuplicateHandle(/* some more parameters*/) } MyThread::stop() { //Set some variables so ...

How can you allow a window in an MDI app to leave it's parent container w/Win32?

I have an MDI app. I would like to add an icon to the non client title bar of the child window that allows the window to float separately from the parent MDI container, allowing the user to take the child windows and arbitrarily place them around the desktop, outside of the MDI window. I have seen it done so I know it's possible, but I'...

Forcing my MFC app to run as Administrator on Vista

I have an MFC app built using Visual Studio 2008 and it needs to run on W2K, XP, 2003 and Vista. The application writes to HKLM in the registry and will only work on Vista if you run it as Administrator. My question is: can I force the app to run as Adminstrator automatically? Does it involve creating a manifest file? At the moment I...

ListView with LVS_OWNERDATA flag

Hello I want to make a CListView that will read his rows from e remote server using socket. The rows may be more than a million that's why i need to read rows only when I need them and may be read them in a groups (with more that 1 row per request). I also need to support sorting by rows. May be I have to use List Control with LVS_OWNE...