Several reasons. For one I like it more than later versions and I don't use the features added in the later versions. Additionally I'm working on one project that will not compile in any compiler after VS 2010. The primary programmer on the project is the best self taught programmer I've ever seen. He wrote 99% of it after teaching himself C, but he's also a weirdo (I think he's on the spectrum) who only uses CRT monitors and Visual C 6. I was able to port the code to VC 2010 and it compiles OK with a few compiler directives, but it will not compile in anything newer. The project I'm working on the bulk of my time was started in 2010 and its one of those if it ain't broke don't fix it.
wdolson
Posts
-
Visual Studio 2010 Tab Order Grayed Out All the Time -
Visual Studio 2010 Tab Order Grayed Out All the TimeI have a number of dialogs set up in my project in multiple programs. I'm developing in C+ MFC VS 2010. The Tab Order control wasn't showing in the View menu. The Tools->Configure dialog showed it in the menu tree, but it didn't show at all. I was able to add it by going through adding a menu item. The dialog shows two Tab Orders, but the menu now only shows one, but it's always grayed out, even if I have the resource editor open showing the dialog I want to set the tab order for, but it's always grayed out. Anyone ever run into this and if so how did you fix it? I also had some trouble logging in. I've used Firefox with this site for years, but today when I went to Codeproject and clicked on the top "Sign in" link, nothing happens. I got the login on another browser and I got a login that work in Firefox when I went to the Lounge and clicked on the login in the center of the page. I made sure that Firefox had a popup exception for Codeproject and this is new behavior. It worked a few weeks ago when I was here.
-
Opening a Second File from ExplorerIt took me a few days to get back to this, then I ran into a few dead ends before hitting on the solution to get IDropTarget to work for my application. In the end Michael Dunn's article from here on CodeProject: was the best way forward. However once I got IDropTarget working, I ended up discovering my original problem had to do with locking my app down to one instance. A couple of years ago when this project was still in its infancy I used PJ Naughter's CSingleInstance class () to check and see if there was an instance of the program already running and if there was, switch to that instance. A second instance would start when I double clicked on a file associated with the program when an instance was already running. When the second instance is detected, it sends a message to the original instance to take focus and quits. PJ Naughter conveniently created a means to send the command line from the second instance to the first before quitting, so I took advantage of that and now the first instance loads the file correctly on double click. Implementing IDropTarget in the end turned out to not be necessary, but it will be a nice feature to allow users to drag and drop files into the program. It also expanded my understanding of COM, which I may need to understand better down the road. I need to do a lot of communication between programs as part of this project and I will need to do a lot more inter-program communication down the road. Just thought I would post an update for future reference if someone comes across a similar problem in the future and finds this thread. Thanks for the help!
-
Opening a Second File from ExplorerI'll look at IDropTarget next week. My customer found a bug this morning that is taking priority. This will be back on the front burner next week. Thanks
-
Opening a Second File from ExplorerI'm lost how would you use DDE from Windows Explorer and wouldn't something have to be installed in Windows Explorer for that to work. And what if the user is using some other type of file browser? And I thought IDropTarget was only for drag and drop operations. I'm talking about double clicking on a file in Windows Explorer. I know it works in programs like Word. Does that use DDE? That seems kind of odd.
-
Opening a Second File from ExplorerI'm working in MFC under Visual Studio 2010. I've got my program associated with a file extension and clicking on a file of that type in Windows Explorer will open the program and load that file. All's well so far. Now I need to be able to click on another file of the type from WE and load that file into the same instance of the program already running. What happens now when I click on another file is the focus just switches to the program and nothing loads. When the program isn't running and you click on a file associated with it, the program starts and in the loading of the App instance you check the command line, which is loaded into a CCommandLineInfo structure and the program deals with the command. I can't figure out how to get the second file to load when the program is already running by selecting it in WE (opening a file from within the program has been working fine from the start). I have looked at WM_ACTIVATE and WM_ACTIVATEAPP which are called when the program gets focus while running, but I don't know how you would get the information about the file just selected in Windows Explorer. I'm probably missing some key terminology in my searches. I can't find any information on how to do this. Maybe I'm slow kid in class today... Additionally if I select multiple files in Windows Explorer and open them at the same time, it opens multiple instances of the program instead of opening one instance any loading those files into that one instance. Is there any way to handle that? Thanks
-
Strange CListBox BehaviorThat's the problem! For some reason when setting the left box, the exclamation point was in there, but it was missing from the setting of the right box. That usually flags an warning on compile. I wonder why it wasn't. It appears SetItemData is doing something though. The value returned with GetItemData is always the last value on the list. The list redraws after a move, so all the items were probably getting set to the last value for some reason I don't understand. It works now. I think I need glasses... Thanks!
-
Strange CListBox BehaviorThe box isn't sorted, but that's how I assign data to the list box:
int idx;
idx = m_lstRight.AddString(szStr);
if(idx = LB_ERR)
{
m_lstRight.SetItemData(idx, (DWORD)val);
}I looked at the data being assigned to the list box and everything was fine. I haven't figured out how to look at the data in a CListBox. I put a watch on it, but I didn't see where the data was stored when I inspected the control.
-
Strange CListBox BehaviorSetItemData allows you to associate a 32 bit value with the index and GetitemData retrieves that data. When I do the AddString to put the strings in the list box, if successful I load a float value associated with the string with SetItemData. When retrieved it has to be cast back to float because GetItemData returns a DWORD. In this particular dialog the data is stored as a float, but is always an integer. The program does this because the same data space can be used for float values too, but if you're in this dialog, the data will always be integers stored as floats.
-
Strange CListBox BehaviorSorry about the formatting, it was the first time I posted anything with code here. The value is not always the same, it's whatever is last on the list. If the right list has the following strings: "1" "2" "4" "7" "10" "11" Selecting "2" and clicking on the move left button will get the "11" and it will be moved to the left. If you then select the "2" again (or anything else on the list) and click on the move left button, the "10" will be selected and moved. What gets selected is whatever is last on the list. The code for moving from the left box to the right is identical except for the control name and selecting the "2" would actually fetch the "2" from index 1 and move it. The index fetched in both cases is correct. What isn't working is the code that gets the value for the index. I'm completely baffled. The two are coded the same.
-
Strange CListBox BehaviorI have a bizarre problem with a dialog. I created a dialog to move items between two lists. The left list box has the pool of possible items that are unused on the left and the items being used on the right. In between the two are a bunch of buttons to move selected items left or right, or move the entire list from one box to the other. The boxes are defined as:
CListBox m\_lstLeft; CListBox m\_lstRight;
In the .RC file the boxes are defined as follows:
LISTBOX IDC_LSEL_LSTLEFT,7,25,115,186,LBS_MULTIPLESEL | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
LISTBOX IDC_LSEL_LSTRIGHT,178,25,115,186,LBS_MULTIPLESEL | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOPThe code for loading and handling the boxes is the same with just the names of the boxes changed. For example the move right button handling code extracts an item from the left box and puts in the the right and the move left button does the opposite. Moving an item from the left box to the right works as expected. The code to get the item from the left box is:
CArray aryListBoxSel; aryListBoxSel.SetSize(nCount); m\_lstLeft.GetSelItems(nCount, aryListBoxSel.GetData()); for(i=0; i
If idx 2, the third item in the list ends up in val as expected.
However, moving from right to left, using a mirror image of the same code:
idx = aryListBoxSel.GetAt(i); val = (float)m\_lstRight.GetItemData(idx);
val is always the last item in the list, no matter what idx is.
I compared the code and everything is a mirror image of the other. The two lists are defined the same way, loaded the same way, and accessed the same way.
What could possibly be wrong? As far as I can tell, I am setting up two identical list boxes and getting two different results.
-
CPropertyView Problems CompilingYes, the semi-colon was a typo. When I copied and pasted the code, it turned the arrow head into > and I didn't delete the semi-colon. It is also being debugged in debug mode. I was putting a breakpoint where it was changing unexpectedly. The underlying code appeared to be getting corrupted. This problem appears to have gone away when I fixed the order with which I created the tabs. I noticed I had two reversed and fixed it. That made the problem go away mysteriously. I'm not sure why having the tabs out of order caused the SetWindowText() function to get corrupted, but I have seen stranger things. I once spent two weeks trying to find a bug in some hardware I designed. The thing just would not work. One morning, it just started working. My lead predicted it would be back and I had to agree with him. The hardware went into production and nobody ever saw that bug again. The debugging gnomes is the only explanation I have. (I'm feeling old, I just realized that was more than 20 years ago...) Thanks anyway, Bill
-
CPropertyView Problems CompilingDECLARE_MESSAGE_MAP is there. I was tracking down another compiler error and stumbled across the problem. When I converted the class as derived from CFormView to CPropertyView, I had updated all the references to CFormView except 1. I don't know why the compiler didn't see that as a problem, but when I changed that, it compiled. I'm having some other problems now. It appears that something in the parent class is causing a memory corruption in the derived class. It was blowing up when I tried to call Clear() for a COleVariant class variable. When I looked at it in the debugger, it was set to something strange. In the class declaration, I moved the COleVariant to the end of the fire and it ran Clear() fine. However, it now blows up when calling SetWindowText() for a CEdit variable. Tracing down into the debugger, everything looks fine until m_pCtrlSite->;SetWindowText(lpszString); I try to trace into it, but I get an access violation reading location 0x00000000. The issue is almost certainly caused by something in CPropertyView because the program runs just fine through that point with the old TabView. What tools are available to figure out what's corrupting memory? Bill
-
CPropertyView Problems CompilingI have a project in which I was using a view using a CTabCtrl. I ran into some issues turning tabs on and off and my searching led me to the CPropertyView described here: Property Sheet View[^] I am writing here because the article is old and probably not being maintained. The original was written for VC 6. I have compiled the demo projects just fine under both VC 6 and VC 2005. When I included CPropertyView in my project and attempted to compile, I got three errors which are real head scratchers. In my class derived from CPropertyView, I get the following errors: C2248: 'CPropertyView::GetThisMessageMap' : cannot access protected member declared in class 'CPropertyView' C2352: 'CPropertyView::AssertValid' : illegal call of non-static member function C2352: 'CPropertyView::Dump' : illegal call of non-static member function The C2248 error comes up with the END_MESSAGE_MAP() macro. I tried commenting out everything in the message map and I still got the error. I have carefully checked the syntax and AssertValid and Dump are declared and called identically in this class as in all others. There is a slight variation between VC6 and VC2005 in that VC2005 has an extra #ifdef for Windows CE, but the error happens whether the ifdef is there or not. I found a Microsoft Knowledge Base article (Q243351) that talks about the C2248 error happening when the /Za flag is used in the compiler, but I'm not using that flag. I'm sure the answer is something simple, but I've run into a brick wall. Bill