|
The workarea is the rectangle that a window is the desktop window - any appbars that may be present.
So if you have your Windows Taskbar viewable without autohide, that would account for your few pixels of discrepency. Otherwise, if that is not the case could you give some more details.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Yes, I have the taskbar on without autohide...
but I still don't really understand where those few missing pixels come from... could you explain it?
|
|
|
|
|
What is your current screen resolution, and what are the values that are returned from the call to SystemParametersInfo?
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
I've refied the problem a bit.
It returns 0, 0 and the other one is right too.
However, GetWindowRect() on a maximized window returns negative values(-4, -4 i belive) for the first corner
Why?
|
|
|
|
|
How can I get the active view(or document)?
I need a window to access the active document, but I didn't find any clues about doing it anywhere...
|
|
|
|
|
Try this:
CFrameWnd::GetActiveView()
Gero
|
|
|
|
|
Whee thanks! I always miss the obvious :p
|
|
|
|
|
Need Nice OSDesktop!
I wrote the follwing code to write a sample text everywhere of desktop so on clock. But I can not delete it by my program!!!
You can test this in a simple DialogBase program.
Please guid me
void CMyProgDlg::OnShowResolution() <br />
{<br />
CString sTempMsg;<br />
<br />
hWnd = GetDesktopWindow()->GetSafeHwnd();<br />
hdc = ::GetWindowDC( hWnd );<br />
nSDC = SaveDC( hdc );<br />
<br />
DEVMODE dd;<br />
ZeroMemory(&dd, sizeof(dd));<br />
dd.dmSize = sizeof(dd);<br />
EnumDisplaySettings( NULL, ENUM_CURRENT_SETTINGS, &dd);<br />
<br />
CFont oldFont,newFont;<br />
LOGFONT lfA;<br />
ZeroMemory( &lfA, sizeof( LOGFONT ) );<br />
lstrcpy( lfA.lfFaceName, "Comics Sans MS" );
int nSize = 10;<br />
<br />
lfA.lfWeight = FW_DEMIBOLD;<br />
lfA.lfHeight = 2 * nSize;<br />
lfA.lfWidth = 1 * nSize;<br />
newFont.CreateFontIndirect( &lfA );<br />
<br />
SelectObject( hdc, newFont );<br />
<br />
<br />
SetBkMode(hdc, TRANSPARENT);
SetBkColor( hdc, NULL );
COLORREF oldColor = SetTextColor(hdc, RGB(170,255,50) );
SetTextAlign( hdc, TA_RIGHT);<br />
<br />
TEXTMETRIC tm;<br />
GetTextMetrics( hdc, &tm );<br />
<br />
int x = dd.dmPelsWidth-5 , y=35;<br />
int FarNextLine = tm.tmHeight;<br />
<br />
sTempMsg.Format( "My Display Setting..." );<br />
TextOut( hdc, x, y, sTempMsg, strlen( sTempMsg ) );<br />
<br />
<br />
<br />
y += 2*FarNextLine;<br />
sTempMsg.Format("Resolution : [%4d , %4d]",<br />
dd.dmPelsWidth, dd.dmPelsHeight );<br />
TextOut( hdc, x, y, sTempMsg, strlen( sTempMsg ) );<br />
<br />
y += FarNextLine;<br />
sTempMsg.Format("Color=%2dBits", dd.dmBitsPerPel );<br />
TextOut( hdc, x, y, sTempMsg, strlen( sTempMsg ) );<br />
<br />
y += FarNextLine;<br />
sTempMsg.Format("RefreshRate=%3d Hz", dd.dmDisplayFrequency );<br />
TextOut( hdc, x, y, sTempMsg, strlen( sTempMsg ) );<br />
<br />
SetTextColor(hdc, oldColor );<br />
<br />
}<br />
|
|
|
|
|
|
when i call this dll funciton in vb ,it is saying cant find dll entry point.i have only one cpp file which has code as below.
what is the error.what should i do.
i want to call createwindow function .
#include "stdafx.h"
#include "Shellapi.h"
extern "C"__declspec(dllexport) void __stdcall CreateWindowFunction(void);
extern "C" __declspec(dllexport) BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
hModule=hModule;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
extern "C" __declspec(dllexport) void __stdcall CreateWindowFunction()
{
MessageBox(NULL,"Called","CreateWindowFunction",MB_OK);
}
|
|
|
|
|
I wrote a new program and distributed it freely to my user.
I upgrade my program frequently. But I can't email it to my user frequently.
Therefore, please someone write me a simple code that how can my program has the following option: "Check for newer version every x day".
|
|
|
|
|
anata wrote:
Therefore, please someone write me a simple code that how can my program has the following option
I'm pretty sure that noone is goint to write the program for you, but I'll bet that a lot of people is going to answar your questions if you ask "How can I do this", instead of "write it for me"...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Ok Anders and other programmers,
"How can I do that ... ?", please.
That job must be hide until detect new version.
|
|
|
|
|
Please help to find a source for bitmap editor like used in MFC
and by the way, does anyone know how to serialize CDC with all its components together wist other info like ints, chars, etc.
my mail is:alex_kuleshov@hotmail.com
|
|
|
|
|
Will loading a bitmap that is part-of RC using resource ID render? Have bug in OnDraw. In debug, the data bits in the HBITMAP are null. Hence, a BitBlt transfers nothing to DC. Any code clips or thoughts on how to render a CBitmap loaded from resouce ID would be appreciated? Note: The bitmap is > 256 bits, so IDE claims it can't render it in editor. In any other editors, the image renders.
michael
|
|
|
|
|
Hi All:
I have 3 questions on using MFC to do some GUI stuff. I am currently building a simulation, thus, I need to show some feedback to the user once the simulation starts. For example, I could be simulating a bouncing ball. Once the user clicks "Start", the simulation will run based on certain changing parameters (like speed of ball, height of ball etc) and feedback graphically to the user through a display window.
Qn1. May I know how can I make the display window refresh from my application? I understand that WM_PAINT should not be called from our own application.
Qn2. May I know what is the most efficient way of refreshing a device context? Currently, I am only updating a portion or pieces of the device context every timestep. What I am doing now is to "draw" the background first (so as to erase), then followed by going through what needs to be drawn onto the device context every timestep. I feel that there should be a better approach. The refresh needs to be pretty fast so that the user will not see any fickleness.
Qn3. I would like to write some sentences onto the device context. I am using "CDC::TextOut" in this case. May I know how then can I control the size and type of the font?
Due to company policy, I am not using the Doc/View approach in VC++ 6. I am manually coding in the various stuff like menus etc. Sorry if some of the questions is a bit naive as I am really new to MFC. Urgently needing help due to tight schedule.
Thank you very much in advance.
|
|
|
|
|
tanuki22 wrote:
May I know how can I make the display window refresh from my application?
Use CWnd::Invalidate() to schedule repainting of the window. Call CWnd::UpdateWindow() then if you want to repaint the window immediately.
tanuki22 wrote:
The refresh needs to be pretty fast so that the user will not see any fickleness.
Use double buffering - draw to the memory DC first and then switch the content from memory DC to display DC using BitBlt - see this[^].
tanuki22 wrote:
May I know how then can I control the size and type of the font?
Use CDC::SelectObject().
Pavel
Sonork 100.15206
|
|
|
|
|
hi everyone,
how do you manually highlight a node in a tree control? say i have a treectrl with 5 nodes.. if i want to have node 4 get highlighted everytime i start the program, how do i do it?
|
|
|
|
|
Use the TVM_SELECTITEM message to select an item.
--Mike--
"alyson hannigan is so cute it's crazy" -- Googlism
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Hi folks
How do i add new folder button in browse for folder dialog box...need help????
Sansingh
|
|
|
|
|
|
I am working on an Application and would like to have a picture as the background. Is this possible using AfxRegisterWndClass()?
-- Steve
|
|
|
|
|
The background of what ? If the background of the program, then you need to handle WM_ERASEBKGND, the details are in the FAQ.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Hi.
I am a C++ programmer with experience with MFC and Winsock. I am working on project that utilize MFC, Winsock, and more advanced C++ like that found in Modern C++ Design. I have a question about writing commends.
I hate writing comments! Before you go off and post about responses, please consider my reasons. I understand the importance of comments from in terms of team project. In a team project where hundred and even thousands of programmers study and modify each other's code, comments are imperative. Comments are essential even in individual projects. Experienced programmers understand that we will one day read code we worked on six months ago. The bottomline is that comments are imperative to software implementation especially with C++ where some section of a code can be abstract and different to decipher.
Nonetheless, comments are tedious! For example, let say you spend an hour on an algorithm. Now, you have to spend another ten, twenty, even thirty minutes commenting the class or a collection of classes. In the end, you have less time solving other problems.
I want to know how do you programmers deal with commends in real-world team projects. Real-world projects vary from a simple simulation for NASA to an operating system. I know I am developing a bad habit that will hurt me in the end, but sometimes I get so caught up in solving problems that I ignore the comments. I remember all my code. Somethings I take a few minutes to see what goes on, but I always recommend it. Again, I understand the reason is because I am the person who wrote it.
Lastly, is there an art to writing good comments? How do you know where, when, and what to write such that the comment is elegant and takes up little time and effort because it becomes natural?
Thanks,
Kuphryn
|
|
|
|
|
There was a time not too long ago that I would have agreed that comments are tedious and at best a "necessary evil".
kuphryn wrote:
Nonetheless, comments are tedious! For example, let say you spend an hour on an algorithm. Now, you have to spend another ten, twenty, even thirty minutes commenting the class or a collection of classes. In the end, you have less time solving other problems.
One thing I have learned that helps me quite a bit is this. Anytime I have need to write a new class, start by commenting the class and then writing the code with inline comments. (By inline comments, I mean comments on important lines.)
kuphryn wrote:
get so caught up in solving problems that I ignore the comments
I might add that by not commenting you are only introducing future problems.
kuphryn wrote:
Lastly, is there an art to writing good comments? How do you know where, when, and what to write such that the comment is elegant and takes up little time and effort because it becomes natural?
For me it has taken a very long time (years) to get to the point where I comment first and then code. I have learned that this helps me in several ways not the least of which is it helps me to remain focused on the implementation I have chosen and not to try and gold-plate it or (wing it) as I go. The key to doing this, though is knowing in advance what I am going to write and not writing it until I have it figured out in my head or sometimes in a testbed.
Once I made the leap from the "code a solution" to "design a solution and then code it" it became clear that commenting had to come first.
Anyway, that's just my 2 cents.
|
|
|
|
|