|
Did you see flags on PlaySounds function ?
|
|
|
|
|
I'd used it before, and thought I knew them all. Sigh....
Thanks!
Iain.
|
|
|
|
|
HI
can anybody give me a good reference to a site where i can learn
advenced C, and MFC
THNKS
kobkob
|
|
|
|
|
See here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Interesting your link returned 2,530,000 address of codeproject does he must see these addresses
|
|
|
|
|
Take a look around at the MFC articles on this site...
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
You didn't post a link...what site?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
This one[^] and
this other one[^]
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
|
1.I created some ownerdrawn controls and put them on a dialog.
2.I want to use a custom gradient as the background of the dialog.
3.I override OnEraseBkgnd :
BOOL CDlgButtons::OnEraseBkgnd(CDC* pDC)
{
return TRUE;
}
4.I leave OnPaint without any changes.
Problem: None of the buttons on the form draw correctly. I don't have any other control. Ownerdraw buttons are completely hidden. None ownerdraw, turn to white rectangles, no text, nothing.
if I draw my gradient without using pDC in OnEraseBkgnd , and instead use a new dc: CPaintDC dc(this); it's ok.
I am completely confused. Can any one please describe this strange behavior?
// "Life is very short and is very fragile also." Yanni while (I'm_alive) { cout<<"I love programming."; }
|
|
|
|
|
Something wrong is happening elsewhere.
I use this code in the main dialog of the app I use for quickly
testing code I post here on CP:
BOOL CMFCTesterDlg::OnEraseBkgnd(CDC* pDC)
{
CRect rect;
GetClientRect(&rect);
COLORREF c1 = RGB(64, 0, 64);
COLORREF c2 = RGB(0, 128, 128);
for(int i = 0; i < rect.Height(); i++)
{
int r, g, b;
r = GetRValue(c1) + (GetRValue(c2) - GetRValue(c1)) * i / rect.Height();
g = GetGValue(c1) + (GetGValue(c2) - GetGValue(c1)) * i / rect.Height();
b = GetBValue(c1) + (GetBValue(c2) - GetBValue(c1)) * i / rect.Height();
pDC->FillSolidRect(0, i, rect.Width(), 1, RGB(r, g, b));
}
return TRUE;
}
There's a potpourri of controls on the dialog and they all draw correctly.
What happens if you comment-out the ON_WM_ERASEBKNGD() entry in the message map?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Sorry for late response. I was out for a (long) while.
Thank you for your help. I have more time to find the problem, today. I think the problem is with clipping.
Thank you again for your help.
// "Life is very short and is very fragile also." Yanni while (I'm_alive) { cout<<"I love programming."; }
|
|
|
|
|
I would use the device Context given as parameter.
May this pDC has cliping areas defined.
CPaintDC is not useful here because it calls BeginPaint / EndPaint.
Beginpaint emit's an WM_ERASEBACKGROUND.
see MSDN documentation of BeginPaint.
You should also consider setting WS_CLIPCHILDREN style for dialog window.
|
|
|
|
|
Sorry for late response. I was out for a (long) while.
karle wrote: CPaintDC is not useful here because it calls BeginPaint / EndPaint.
Beginpaint emit's an WM_ERASEBACKGROUND.
However I'm not sure how it works exactly, but it was also strange to me that why it does not cause an infinite loop. It's more like every time OnPaint or OnEraseBkgnd is called, it's in a new thread!
I forgot clipping totally.
Thank you for your kind helpful answer.
// "Life is very short and is very fragile also." Yanni while (I'm_alive) { cout<<"I love programming."; }
|
|
|
|
|
I need to add two .cpp files, each containing a class with the same name, to a project. I use the #ifdef and #include directives to tell the compiler which instance of the files to include in a build session. the compile procedure terminates successfully
BUT then I get LINK ERRORs:
Error LNK2005 ... already defined in some .obj file.
Can any one help me to really exclude a .cpp and .h file from compile procedure AND LINK procedures?
Tnx a lot.
|
|
|
|
|
It's not very wise to include two classes of the same name to the project. Wouldn't it be easier to just change the name. However the link error you are getting is because one of the .cpp files has already been built. If you are sure you have removed the files from the project, then perform a 'clean solution' and then 'build' again. If you still get errors then you havent completely excluded the files.
|
|
|
|
|
if you are coding in c++, why don't you use namespace s?
put each class in a different namespace. Then when creating objects, you have to define namespace.
I never used it, but if I remember truely, it would be like this:
namespace a
{
class X
{
}
}
namespace b
{
class X
{
}
}
main()
{
a::X aXObj;
b::X bXObj;
}
-- modified at 11:05 Saturday 18th August, 2007
// "Life is very short and is very fragile also." Yanni while (I'm_alive) { cout<<"I love programming."; }
|
|
|
|
|
using namespaces is the best way, but another dirty way of doing it is make your #defines cover your entire .h and .cpp file
Header1.h
#ifdef INC_HDR1
/* Stuff */
#endif
Header1.cpp
#ifdef INC_HDR1
/* Stuff */
#endif
Header2.h
#ifdef INC_HDR2
/* Stuff */
#endif
Header2.cpp
#ifdef INC_HDR2
/* Stuff */
#endif
Your application
#ifdef INC_HDR1
#include "Header1.h"
#else
#include "Header2.h"
#endif
This works perfect
Arun Krishnan
|
|
|
|
|
Hello,
I have a dialog box made without resources.On the dialog box there are many windows controls with a certain font size say 10.
Now how can I derive a relation between dialog box units of DLGTEMPLATE and each of the windows controls with a certain font size.
What is the meaning of dialog box units ? Is there any docs for the same.
Thanks
Prithaa
|
|
|
|
|
I'm not sure exactly what you are asking, perhaps you could rephrase your question.
If you want all windows, including child windows, to have the same font size, then just use the WMSETFONT.
|
|
|
|
|
prithaa wrote: What is the meaning of dialog box units ?
Quote from MSDN:
"A DLU is based on the size of the dialog box font, normally 8-point MS Sans Serif. A horizontal DLU is the average width of the dialog box font divided by four. A vertical DLU is the average height of the font divided by eight."
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi all,
I have made a sdi application. In that i have made a worker thread in which i am taking out html code for websites. There can be thousands of websites whose html code i have to find out. I have made a for loop from which one by one thread is started accordingly. Now my problem is that the starting threads work fine but after some time all the pages start giving this page cannot be displayed.i tried to used semaphore(only 10 thread should start at a time) but it is also not working fine.
CSemaphore m_semaphore(10,10);
m_semaphore.Lock(60000);
m_semaphore.Unlock();
this code is written inside thread. But still same problem is coming. How to resolve this problem.
thanks in advance
|
|
|
|
|
All the threads should share a common semaphore object instead of
each of them having their own.
You can move your m_semaphore object outside of the thread proc
and it should work better.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
can u help me guys?? i got stuck with one problem in my project. Actually when i open a Excel or any file in web browser the file download dialog will popup. i dont want that dialog, i directly want to open the Excel file in web browser. please if anybody have its code kindly send me ...i will be very obiliged to u .
-- modified at 9:11 Monday 20th August, 2007
|
|
|
|