This is my first post, hope you will help me as soon as.
Thank alot for read my question.
I design a MFC's dialog in visual studio 2010.
My dialog's size is 500 x 397
In my code, I try to draw a line
dc.MoveTo(0,0)
dc.lineTo(500,397).
But it look like this
(Sorry I dont enough repuration to insert image)
http://img853.imageshack.us/img853/2353/erroryq.png
This code must be draw form left-top to right-bottom of dialog
But, it's not happen.
The size of dialog is change :( maybe larger ....
I actually don't know why #_#
Maybe becuz setting of screen in Visual Studio and my Desktop.
Hope you can help me fix that code
Thank alot
Dialogs are designed in "Dialog Units" which are not the same as pixels. To convert between the two, try MapDialogRect().
http://msdn.microsoft.com/en-us/library/windows/desktop/ms645502(v=vs.85).aspx
Related
I am coding a C++ project using MFC in Visual Studio (v16.5.4). The dialog editor seems badly broken on my HiDPI monitor (Lenovo ThinkVision 2880x1800 at 175%). It works fine on two other computers with standard monitors.
The dialogs get resized apparently randomly, and controls do not move correctly when I try to edit them. When I try to align controls the dotted selection rectangle may move, but the control often does not (in the editor). Sometimes, re-opening the editor shows that the control has in fact moved. When I build the project, the final display layout cannot be predicted from what appears in the resource editor.
I reported this to Microsoft using Visual Studio feedback, but they closed the report, saying it was "By design"!!!! They posted a link describing a feature which disables HiDPI awareness, but the link was for the Windows Forms Designer, not the MFC resource editor - there is no equivalent feature in the latter that I could find.
Does anyone else have this problem, or know of a decent work-around? At the moment I am transferring to my other computer with the standard display whenever I need to edit a dialog, which is monumentally inefficient for quite a large project.
I know this is an older post, but I thought what I found might help someone. I experienced the same issue today. It just happens that I have one monitor setup for 125% and one setup for 100%. The MFC dialog editor alignment operations do not work correctly on the 125% monitor but work fine on the 100% monitor. It would appear Microsoft isn't properly handling DPI in the dialog editor.
Edit:1 There have been a lot of good suggestions to help me out. The answer by Jeaninez has helped my Hello World stay on the screen instead of blinking for a microsecond.
But my initial question stands, why does Visual Studio 2019 default Hello World Console App not hold the Hello World open and instead open two windows. Here is a video with the fixed version and the one with the default template: https://www.youtube.com/watch?v=LVUsHp9K8Tw
Original Question
I'm sure this question has been asked a million times, but my issue seems to be quite different. I am using the
Console App Template which is by default a hello world, but when I Ctrl+F5 it to see how it works it blinks on the screen then shows this:
I tried putting in a return 0; and made sure my project was set to Console. The only thing that I've found that helps a tiny bit is `system("pause");
It's not closing. You know that - you took a picture of it.
It is, however, really small. And in addition VS 2019 (unlike earlier versions) adds this text about "press any key" to close the window. So you're not seeing your own output at all.
Here's what to do. Click the little icon in the title bar:
You will get a menu, choose Properties. This gets you a tabbed dialog: choose Layout. Change to a larger height and width and you'll be able to see what is going on.
When you like it, after you have finished running the app and closed the console window, close Visual Studio and re-open it. Now you'll consistently get that window size.
"system("pause");" is part of Windows API and so it won't work in other operation systems.You should try to use just objects from C++ standard library. I suggest you could try to use :
std::cin.get();
return 0;
This is my first question in this community. I always search a lot when having problems and I always find an answer. But not in this one. Maybe I am not asking Google correctly.
Anyways this looks like a bug to me but I might get it wrong.
Using VS2012 (or 2013) I create the default Multiple documents MFC application. I do not write a single line of code. I compile and run. Then as a user I dock the properties window which by default is at the right to the output window as shown below .
Then I close the application and restart. The window is where it should be but with different width as shown below
If you dock the window to the right (in the view and not in another window) then there is no problem. The position and width are restored just fine. Also this only happens if the main window is maximized. The behaviour, if the main window is not, is as expected.
Do you think it is actually how Microsoft wanted to make this work or they missed that? Is there a workaround for this?
Again forgive me if this question has been asked before but really...
I couldn't find anything.
Appreciate any kind of help.
I'm new at programming and I just downloaded C-free 5.0 software. I just compiled a program, it showed that the program has 5 errors. But I can't find a way to see what errors and where. Any help will be appreciated.
They will probably be in a dock window called "build". Like all other IDEs, you may need to use the menu to open that window first. If the window is already open, scroll up.
The build dock window is the one at the bottom, in this screenshot:
I have never used MFC so far. I'd like to learn how creating a simple tabcontrol in a SDI application. I'am looking for a very beginner guide or a tutorial? Could you help me?
Thanks
I've not installed it on this machine, but as far as i remember, there is a wizard alowing you to create a dialog-based TabCtrl-Application. You could get all you ned to know from htere. Also you may find this Link useful:
http://www.codeguru.com/cpp/controls/controls/tabcontrols/article.php/c5239/Creating-a-CTabCtrl-Application.htm
Please bear in mind that the TabCtrl is just the tabs, not the space they show – this is a window that you have to make visible, so the usual approach is a couple of windows with the same screen location and the tabctrl makes one visible and hides the others by clicking on it.