|
thank you Corazon.
but i have pasted my texture to a rectangle. in fact i want to some white circles as the background and load a texture in the front. of course, the texture is pasted onto a rectangle. but after displayed, the background color was changed!
|
|
|
|
|
try this:
draw circle
turn on texturing
draw rectangle
turn off texturing
it sounds like you are not disabling texturing after drawing the square, thus leaving the texture bound to every opengl call that follows.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
thank you Corazon for your kind. i will try it with your suggestion.
|
|
|
|
|
hi all
i want to get data from sharescope sofware.
it gives data to xls
but how can i get it in my program directly
thank you.
|
|
|
|
|
can anybody tell me how to change the color of the text appear in EditBox. I am using following code but nothing happen
<br />
if(SetTextColor(GetDC(GetWindow(hWndDlg,IDC_EDIT1)),<br />
RGB(255,0,0)) == CLR_INVALID)<br />
OutputDebugString(L"Error SetTextColor");
|
|
|
|
|
You have to map WM_CTLCOLOR in the dialog class. In that you have to check for the control type and window (if needed). Then set the color to the DC.
- NS -
|
|
|
|
|
If you want some independence from the dialog box, you can control it directly from within a derived control class. This is not the best or easiest way, but it's an option nonetheless...
Create a new class and derive it from CEdit. Create some member variable for text color, background color, background brush etc...
// .h file
class CEditControl : public CEdit
{
// ...
private:
COLORREF m_colorBack;
COLORREF m_colorText;
CBrush m_brushBack;
//...
}
When you choose your variable for the edit control using class wizard, choose category "control", and for the type choose your derived type instead of CEdit.
Also don't forget to include your derived class in your StdAfx.h file
// StdAfx.h
#include "EditControl.h"
Create a handler for the "=WM_CTLCOLOR" message in your derived edit class. It's important to note that there are two WM_CTLCOLOR messages in the wizard. Choose the one with the "=" in front of it. Set it up as described below.
// .cpp file
CEditControl::CEditControl()
: m_colorBack(RGB(255,255,0))
, m_colorText(RGB(255,0,0))
{
m_brushBack.CreateSolidBrush(m_colorBack);
}
CEditControl::~CEditControl()
{
m_brushBack.DeleteObject();
}
BEGIN_MESSAGE_MAP(CEditControl, CEdit)
//{{AFX_MSG_MAP(CEditControl)
ON_WM_CTLCOLOR_REFLECT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CEditControl message handlers
HBRUSH CEditControl::CtlColor(CDC* pDC, UINT nCtlColor)
{
// TODO: Change any attributes of the DC here
/*
This sets the text background to transparent. Works good
for single line edit controls but for multiline you will
need OPAQUE to prevent refresh issues with the text when
typing in the middle of a line in the string.
For example, when edit is multiline, use this instead:
pDC->SetBkMode(OPAQUE);
pDC->SetBkColor(m_colorCustom);
pDC->SetTextColor(m_colorText);
*/
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(m_colorText);
// Return a non-NULL brush if the parent's handler should not be called
return m_brushBack;
// return NULL;
}
|
|
|
|
|
You got a pair of MFC solutions. Are you using MFC or using Win32 directly?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Please confirm what are using.. in Win32 you have to handle WM_CTLCOLOREDIT and in MFC you have to handle WM_CTLCOLOR message for Coloring Edit Control
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi!
i want call api functions(LoadLibrary, GetProcAddress) in my driver code. but compiler of driver don't know this functions. this compiler just know DDK functions.
are there any function instead this functions (LoadLibrary, GetProcAddress) in DDK?
Zo.Naderi-Iran
|
|
|
|
|
Hi
How to change Use MFC in a Shared DLL to Use MFC Static Library in VC 8.0.
In VC6.0 , changed by
Project -> Settings -> Setting For :Win32 Debug Microsoft Foundation Class
But i dont Know in VC 8.0.
When the Programme was createing there was an option for this, in Application Type,but i developed the programme in Shared Dll So i want how to change after programme created.
Awaiting for the Reply
Regards
shakumar
shakumar
|
|
|
|
|
'Project properties' -> 'General' -> 'Use of MFC' and there select 'Use MFC in a static library'.
|
|
|
|
|
I want to learn DirectX.
So,I hope someone would like to introduce me a article lead me enter it.
Thanks.
GOOD LUCK
|
|
|
|
|
|
I have no exprience of DirectX programming.I only know that DirectX compose of Direct Draw(before 9.0c version),Direct2D,Direct3D,DirectPlay,DirectMusic and DirectSound. And I want to begin learning and using it now. I want to get a common guide of DirectX programming,besides anyone of these.I think ,if I understand a common DirectX programming way,I will learn every of it easily.
Would you like to help me?
Thanks.
|
|
|
|
|
hi every one
how can i write kernel mode dll?
please help me
|
|
|
|
|
2 problems:
1. The following code, has memory leak. (Not in m_pA and pStr , since I delete them later):
in .h
struct a
{
char* pStr;
};
a* m_pA;
in .cpp
m_pA = new a;
.
.
.
m_pA->pStr = new char[260];
CString szPath = m_pA->pStr;
...
delete[] m_pA->pStr;
.
.
.
delete m_pA;
unless I call szPath.Empty() before exiting. why?
2. Is it safe to use CString as a member of a struct and pass it to a function? with the un-predefined size of the CString how stack looks like in the function?
Thank you so much in advanced.
-- modified at 1:28 Saturday 8th September, 2007
-- modified at 10:13 Saturday 8th September, 2007
I added delete calls, since no one trusted me when at first line I mentioned I delete them later(or perhaps no one ever read the very first line;P)
// "Life is very short and is very fragile also." Yanni while (I'm_alive) { cout<<"I love programming."; }
|
|
|
|
|
hi
i dont suggest to use CString in a structure.
instead,
use some character array like,
char name[256];
in an array.
|
|
|
|
|
Thanks for quick reply.
chandu004 wrote: i dont suggest to use CString in a structure.
Why?
I thought when passing a structure that has a CString to a function(as a parameter), the size of the CString is unknown, if the function changes the data, things might get worst because needed size is more than amount of already allocated memory, so an overflow. But these are just some ideas and probably wrong, because the same thing can work fine in a class.
I was wondering what happens exactly in CString class.
// "Life is very short and is very fragile also." Yanni while (I'm_alive) { cout<<"I love programming."; }
|
|
|
|
|
chandu004 wrote: i dont suggest to use CString in a structure.
instead,
use some character array like,
char name[256];
That is complete non-sense. CString class (although I prefer the stl version) is a wrapper class for a string array. Its purpose is to ease you the live so that you don't have to bother with memory allocation for your string. Why wouldn't you use it in a structure ?
|
|
|
|
|
2. The class is always safer then pointer. The sizeof(CString) is always identically, that's why you can easy pass it as a function parameter. Because string data is containing somewhere in heap and CString just contain pointer to this data. That's why the sizeof(CString("short string")) == sizeof("very very long string"). One more thing thing you should know, that when you pass CString as a function parameter by value the copy constructor is caling, so the data can be copied or it can be reference counting system. Anyway while the CString constructor is calling the class is safe.
1.
char * c = new char[10];
CString s = c; // the data is not pointing to c, it is copied here, so you need to delete c
|
|
|
|
|
progDes wrote: 2. The class is always safer then pointer.
Thanks. So it's a pointer in fact. That's really good.
progDes wrote: // the data is not pointing to c, it is copied here, so you need to delete c
I understand it. My problem here is not c , it's s . If I don't call s.Empty() I'll have a memory leak. This really confused me.
// "Life is very short and is very fragile also." Yanni while (I'm_alive) { cout<<"I love programming."; }
|
|
|
|
|
>"If I don't call s.Empty() I'll have a memory leak."
Destructor must call it.
|
|
|
|
|
progDes wrote: Destructor must call it.
But it doesn't and memory leak is shown on my debug window. When I explicitly call Empty however it disappears.
// "Life is very short and is very fragile also." Yanni while (I'm_alive) { cout<<"I love programming."; }
|
|
|
|
|
I already know what the problem is from the first time I saw a ‘new’ statement. I finished a course on modern programming languages (MS Specific), so I assume you think it is magic. Wrong, it is only magic if the language supports automatic clean up! The ‘new’ operator allocates memory and it is up to you to free it; otherwise you will have a memory leak. In Microsoft’s new languages it is still a good idea to free them, because they go into a list somewhere, waiting to be released.
This is relates to a very old problem that I never understood. If you allocate the memory, then you need to free it. What is the problem?
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|