For those new to message boards please try to follow a few simple rules when posting your question.
Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
Keep the subject line brief, but descriptive. eg "File Serialization problem"
Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode HTML tags when pasting" checkbox before pasting anything inside the PRE block, and make sure "Ignore HTML tags in this message" check box is unchecked.
Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
Please do not post links to your question in one forum from another, unrelated forum (such as the lounge). It will be deleted.
Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
No advertising or soliciting.
We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
I am experimenting with Microsoft Visual c++ 2015, for quick tests of console only program I just edit .cpp files with an editor then I call the "developer Command Prompt for VS2015" and compile source using:
cl /EHsc mysource.cpp
then run executable.
My question is, how can I manually now set breakpoints in mysource.cpp file and step through them in a same command line environment?
I agree there must be a way, but any particular reason as to why you don't want to just use the IDE? VisualStudio is actually a pretty darn good product, so why not use it?
If you prefer command line tools, why not use gcc tools on Linux instead? ...I'm on Linux as I type this btw, I just really like what MS has done with VS overall (some of the incremental releases were a bit ridiculous but it's still a good product).
I do a lot of work in VS2008. It's the editor I have to use for WEC 7 development. I must have 7 different device SDKs installed in my laptop. Recommendation - if you have to do multi-target development, I'd install each in their own VM. Anyway...
So I'm trying to fix some things in a source repository. Made a few changes and tried to save the cpp file. It tells me the fail is locked. okay, Save As... send it to src1.cpp.
Exit VS2008. Nope, there is a phantom dialog window open, I cannot leave. Well, FU VS2008, I kill off the process.
Go to the source folder, try to delete src.cpp. This is what I get:
"The action can't be completed because the file is open in Microsoft C/C++ Compiler Driver"
Now this is completely new to me.
Anyone else seen this error? I know how to ultimately make it go away, but I don't want to reboot just yet.
Charlie Gilley Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Then execute handle again with the -c and -p options to close it:
handle -c 98C -p 2328
Using Process Explorer (for the friend of mice)
To close the handle using the ProcessExplorer, search for the file name (Ctrl+F or the Find menu), double click on the found item so that it is selected in the main window, right click on the item in the main window to open the context menu, and choose 'Close Handle'.
The usual disclaimer:
Close only files of processes that are no longer working (has been killed or exited upon critical errors)!
I am creating a CListBox manually as part of a auto-complete editbox (CEdit) to display possible choices.
The complete UI is something like:
Subclassed CMFCPropertyGridProperty to use my own CEdit Class, AutoCompleteEditBox (override CreateInPlaceEdit).
I create my listbox in the AutoCompleteEditBox:
if ( !m_ListBox.GetSafeHwnd() )
UINT extendedStyle = WS_EX_CONTROLPARENT | WS_EX_TOOLWINDOW|WS_EX_WINDOWEDGE|WS_EX_TOPMOST;
UINT style = LBS_NOTIFY|WS_POPUP|WS_BORDER|WS_VISIBLE|WS_VSCROLL;
/// I tried setting the parent to different CWnd (The dialog, the CMFCPropertyGridCtrl...)
CWnd* parent = nullptr;
if ( m_ParentWindow )
parent = m_ParentWindow;
BOOL ret = m_ListBox.CreateEx(extendedStyle, _TEXT("LISTBOX"),NULL,style, CRect( 0,0,0,0), parent, 0 , this);
//// At this point the HWND of the list box is 0xFEEEFEEE.
And this gets called
int SuggestionListBox::OnCreate(LPCREATESTRUCT lpCreateStruct)
if (CListBox::OnCreate(lpCreateStruct) == -1)
//// At this point the HWND of the listbox is valid.
m_pEdit = (AutoCompleteEditBox*)lpCreateStruct->lpCreateParams;
For testing purpose, I created the AutoCompleteEditBox as a child of the top level CDialog and everything works as expected.
Any ideas, suggestions or things I might have missed ?
I finally fixed the creation issue.
The Edit box created was using the id AFX_PROPLIST_ID_INPLACE; I thought it was OK to continue use it, I replaced the id with a different one and now all is working nicely (well, it is not finished, but I can continue updating and upgrading the feature).
I am not familiar with the class 'CAutoCompleteEditBox' etc. I still use MFC42. This version does not have anything that fancy, but the nearest would be a CComboBox, with the Edit option set to True. Make sure that the Resource Template has the property 'USER_DRAWN' if you want to add your own options. You add these on an EN_CHANGE message.
The best way to investigate this is to open the Resource file in a Text Editor, and inspect and edit the values for the control.
In MFC42 you would be required to, as a minimum, implement the '(On)DrawItem()' virtual function, The Standard Implementation of (On)DrawItem() Asserts in MFC42!
I have in the mean time derived my own libraries for things like this.
Writing a Dialog Based MFC Program, where staff logs in with name and password. I want to implement automatic logging out, after a period of inactivity. (Mouse Moves or Clicks, Keyboard Activity)
I can handle the Internals of how to implement the Cascade Down upon Time_out
I need to monitor 'Activity' I reckon that the best place to do this in SDK is in the App Main Wnd Procedure, by kicking a Timer on WM_MOUSE_MOVE, WM_KEY_UP, etc Messages.
How do I handle this in MFC. Can I use an old fashioned WndProc() or is there no other way but using the MessageMap, with handlers for each message.
I have not used MFC for a number of years, but I would guess you can do it in the message map macro, by capturing the messages and writing your own switch handler. You can then reset your timer for each message that is caused by user interaction. Take a look at the source of the macros in the MFC libraries.
Good to hear of you after all this time. Yes, the Macro's is a solution I considered, and I suppose I can write One Handler, to tie to several message ID's, (I know how the Macro's work) with a Macro for each, Just in a standard WndProc() you have only One switch, to filter those out you need to use to kick the timer, before calling the Default in any case. Looks more elegant.
Maybe not feasible in MFC.
Hope you have not given up on MFC. It has a lot to offer compared to those 'Synthetic Languages'.
to filter those out you need to use to kick the timer, before calling the Default
I would do it with a simple flag. Each time you handle one of the messages in question, set the flag to true. Each time the timer code gets called set the flag to false. You can then see whether there has been any activity between timer 'ticks'.
Bram van Kampen wrote:
Good to hear from you again,
Thanks for your kind comments, I've not been away.
Maybe I went away!
I'm still working with MFC 42, and DevStudio98. Works fine for me and my Customers. Have no reason to change Dev Platform.
Have built my own MFC Extensions to keep up with the times. Anyways, my market is not cutting edge, and a User Interface with as few changes as possible is most appreciated by my customers. I am proud to say that our user interface has changed very little over the past 30 years, other than in Screen Cosmetics. (We started our enterprise in Win 3.3), and of course there have been many extensions. Our Software ran very well on XP, refused to run on Vista, but, runs with very minor mods, on Win7.
Win8 is a bit of a challenge, Our Software was really never intended to run on a Mobile Phone! (A Sophisticated Cash Register!!), We hope for the best for Win10.
I found a certain amount of hostility on the site against those, like me, who refused to move with the times, and invest large sums in yet another development suite, which would solve problems I did not have in the first place.
Also, there is a learning curve to get familiar with each new edition of the suite, which has a 'Pay-Back' Time only, if it can do things quicker or better.
We never found that to be the case!
The New, as I call 'Synthetic' languages,(C# etc) I as owner, and by vast majority of Staff, will never go for!
At my age, I am not looking for other projects, or chasing new developments, I have a market in which my product sells.
It was just good to hear a familiar voice again, from one who gave us much helpful advice in the past.
I totally agree with what you say about using particular versions of development software, although you do sometimes get forced to upgrade as newer versions of Windows appear. As long as it keeps working, satisfies your customers, and makes a reasonable profit, then there is no real reason to change.
The advantage of this solution is that all events for the current desktop are detected regardless which window has the focus and which application is the active one. But it depends on your requirements if you want to reset the timer upon all activities or only upon activities for your application. In the latter case you can still use hooks by checking if your application is the active one and that mouse events are on the application window.
Well Thanks for your reply.
In my case I only want to monitor Mouse and Key Events in my own application, and want the screens to die, in particular if the App does not have the focus, and Mouse and Key events occur which are sent to another application.
What currently happens is that an employee is performing a Mundane -Idle Task- like pursuing old invoices. The employee is called away, for other more urgent tasks, but remains signed on to an application. Someone else can than a week later resume the Idle Task, under the still open account. I am trying to put a stop to that.