I am expecting it to return a negative value, not a zero. What do you think?
Returns zero if the strings are identical. Returns a positive value if the string pointed to by lpStr1 is greater than that pointed to by lpStr2. Returns a negative value if the string pointed to by lpStr1 is less than that pointed to by lpStr2.
Is there anyway to open a console window, where cout/cin can be used, from within a a Windows forms project? For example, I have a typical GUI interface and would like the option to use a command line interface instead. Using cout/cin does not work because there is no console window to output to or input from. How do I open this window without having to create a completely separate Win32 Console application?
When you create a windows app that has a WinMain entry point, there isn't an easy way to create a console. That said, if you want to go the other route (create a console app that spawns your window at some point), it isn't too difficult, but does require some work as far as setting up message loops and such.
Basically, yes, you can have a window with a console. No, it isn't easy to set up.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Is there no way that I can just open a console and use cout/cin?
Sure, if you are creating a simple console application. However, since you have a GUI application, the rules change.
seems like quite a complex process just to write to a console.
So just wrap it all up into a nice little class, and whenever you want something to be displayed in a console window, instantiate your class, and invoke a few methods. You could even skip the class part, and just put it all in a function (or three). Just call the functions whenever you want something to be displayed in a console window.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
Is it possible to prevent the user of an application to use mouse & keyboard for certain operations? Im mean disabling mouse & keyboard for some parts of the program and after that re-enablig that. In VC++, please
I'm having a problem using tile view in my listview control.
It works alright if I'm not using owner data, but if I do use owner data, the listview doesn't draw the label text properly. It looks like it's not bothering to calculate the offset for the label based on the additional lines and just draws at the same spot.
We have a C++ MFC application GUI that in the user thread, posts a user message using "PostMessage(SET_DLG_DATA_EVENT, 0, (LPARAM)pMsg)" to the GUI's message queue. We've also added a PreTranslateMessage method which gets called by the AFX message pump (CWnd::RunModalLoop) in the GUI thread before it dispatches the message it has removed from the queue; if this PreTranslateMessage method sees the message extracted from the queue is the user message posted in the user thread, it handles it and blocks winproc from seeing the user message.
However, whenever the user message is posted while left mouse button is clicked and held in the menu bar, the posted user message somehow gets routed to the winproc and PreTranslateMessage is not called. The stack trace from CWnd::WindowProc when it gets the user message shows no CWnd::RunModalLoop (the message pump): instead I get
> mfc71d.dll!CWnd::WindowProc(unsigned int message=1234, unsigned int wParam=0, long lParam=3320176) Line 1744 C++
mfc71d.dll!AfxCallWndProc(CWnd * pWnd=0x0012fcd0, HWND__ * hWnd=0x00200610, unsigned int nMsg=1234, unsigned int wParam=0, long lParam=3320176) Line 241 + 0x1a C++
mfc71d.dll!AfxWndProc(HWND__ * hWnd=0x00200610, unsigned int nMsg=1234, unsigned int wParam=0, long lParam=3320176) Line 389 C++
mfc71d.dll!AfxWndProcBase(HWND__ * hWnd=0x00200610, unsigned int nMsg=1234, unsigned int wParam=0, long lParam=3320176) Line 209 + 0x15 C++
mfc71d.dll!_AfxMsgFilterHook(int code=0, unsigned int wParam=2083117216, long lParam=2098704) Line 817 C++
mfc71d.dll!CWnd::DefWindowProcA(unsigned int nMsg=1241808, unsigned int wParam=2082654585, long lParam=274) Line 1024 + 0x20 C++
mfc71d.dll!CThreadLocal<_AFX_THREAD_STATE>::GetData() Line 177 + 0xd C++
If the mouse button is not held down, everything works fine.
Any ideas why the user message posted to the queue is routed differently while the mouse button is held down in the menu bar (non-client area?)
Hello, perhaps someone can answer this for me without me having to display my entire program.
I am having issues with one of my cin statements getting read in by a user's keyboard input. I am using the debugger in Visual C++ and it appears as though the compiler is skipping this cin statement and moving to the next cout statement. This seems to happen when the program is moving from one function call to another in main(). I found a fix to this by adding 2 consecutive cin statements but I know this is not the correct way to program. Has anyone had a similar experience. If so, how did you handle it.
-- modified at 12:56 Monday 24th July, 2006
Last Visit: 31-Dec-99 19:00 Last Update: 19-Jan-22 23:15