|
yes, I can understand the window, but what is exactly the Device Context? what's this include? Dose it include the window, the button, the listbox....etc?
|
|
|
|
|
A data structure in Windows programming that is used to define the attributes of text and images that are output to the screen or printer. The device context (DC) is maintained by GDI. A DC, which is a handle to the structure, is obtained before output is written and released after the elements have been written.
RinuRaj
|
|
|
|
|
bloodwinner wrote: ...what is exactly the Device Context?
See here.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
It pointed at the first line -#include "stdafx.h" and report this error. How to solve this problem?
|
|
|
|
|
|
when using precompiled header (see in your project setting), the #include "stdafx.h" directive must be leading every other includes in a cpp file.
ps: delete your other duplicate post
|
|
|
|
|
Rebuild all to recreate the PCH file.
|
|
|
|
|
It points at the first line "#include "stdafx.h"" and gave this fatal error.
|
|
|
|
|
Just take a look in MSDN[^]
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
I tried running the sample provided with MSDN. It also fails with the same error code. Does anybody know why is the function call failing in my computer?
|
|
|
|
|
Hi guys,
I tried making my own timer application, where a number increments every second.
I just wonder how SetTimer() and OnTimer() works? My timer class really does not work! It can initialize the timer but then it does not get into the OnTimer() function even when the time is due. How does this really work? I would really appreciate it if someone can give me a simple but concrete example. Yes, there are some samples in the internet, but really, I could not understand the mechanics beneath them. Can someone provide me with simple steps on creating this simple timer class?
If I could only make this work.. my timer class is super essential to make everything in my application work.
To the person who could help me with this, kudos to you!
Many thanks,
Christina
|
|
|
|
|
waxie wrote: It can initialize the timer but then it does not get into the OnTimer() function even when the time is due.
Can you show how you have initialized it?
Simple example would be like this
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
ON_WM_CREATE()
ON_WM_TIMER()
END_MESSAGE_MAP()
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
SetTimer(1,1000,NULL);
return 0;
}
void CMainFrame::OnTimer(UINT nIDEvent)
{
CFrameWnd::OnTimer(nIDEvent);
}
|
|
|
|
|
For your using OnTimer() you need to inherit your class from CWnd base class.
// Header file should look like this
class CMyTimer: public CWnd
{
...
afx_msg void OnTimer(UINT nIDEvent);
DECLARE_MESSAGE_MAP()
};
// Source file should look like this
....
BEGIN_MESSAGE_MAP(CMyTimer, CWnd)
ON_WM_TIMER()
END_MESSAGE_MAP()
void CMyTimer::OnTimer(UINT nIDEvent)
{
//Todo
}
Do not forget to create a timer object after construction the object
i.e., any where in the program you should -
CMyTimer *pTimer = new CTimer;
pTimer->Create(......);
pTimer->SetTimer(.....);
Your Timer should then work.
|
|
|
|
|
Why would you create a whole class just for a timer? Seems to be overkill.
|
|
|
|
|
|
|
|
hIcon = (HICON)LoadImage(...)
should work
|
|
|
|
|
Try (HICON)LoadImage(NULL, "menu_two.ico", IMAGE_ICON, 32, 32, LR_LOADFROMFILE);
Thanks
|
|
|
|
|
try
<code>
(HICON)LoadImage(NULL, "menu_two.ico", IMAGE_ICON, 32, 32, LR_LOADFROMFILE);
</code>
Thanks
|
|
|
|
|
prefer C++ casts :
hIcon = static_cast<HICON*>(LoadImage(NULL, "menu_two.ico", IMAGE_ICON, 32, 32, LR_LOADFROMFILE));
|
|
|
|
|
Why you delete your post?
|
|
|
|
|
Sorry, I won't do it next time!
I just thought maybe I asked too much today. But it now apparently appears not.
|
|
|
|
|
When you ask a question you get many answers and if some one has like a question he gets his answer
|
|
|
|
|
Hi,
I am using VC++ 6.0. I have created a dialog based application using "MFC AppWizardExe". I have placed some edit boxes on it.
Now if I want to validate the data entered in the edit boxes then how can I achieve the same.
Suppose I have three edit boxes for entering name,age and salary respectively.
How can I make such a validation that user wont be able to entre other than character (A to Z) in name edit box.
Simillarly I dont want to allow the user to enter character / special characters in age / salary edit box.
How can I achieve the above mentioned validations?
|
|
|
|