|
I think David is he not she, so he would not want to bare with you.
|
|
|
|
|
#hackC++ wrote: string *const cstr;
is the correct way.
You wanted to know what cstr was, not ptrstr . cstr is a const ptrstr , while ptrstr is a string* .
In any case, you are mistaken. While const string *cstr and string const *cstr are interchangeable, string* const cstr is completely different.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
HI all )
I included A class to my project ans when try to compile get this error :
c:\Documents and Settings\...\myprogrm.cpp(1381): fatal error C1010: unexpected end of file while looking for precompiled header directive
what can be wrong ?
thank you
-- modified at 14:15 Tuesday 25th April, 2006
|
|
|
|
|
move the #include "stdafx.h" statements in every .cpp files of your project at the top of the other includes...
|
|
|
|
|
|
What I was wondering is when i put.
const size_t array = 3;
int ca[array] = {0,1,2};
cout << ca << endl;
The program prints 0x75dfc0 (or something like that, I'm just guessing)
that output tells me nothing. Is it the memory address or what.
it all seems a little confusing.
|
|
|
|
|
#hackC++ wrote: const size_t array = 3;
int ca[array];
1. you cannot do this. you must use either macros or dynamic memory allocation.
#hackC++ wrote: cout << ca << endl;
this prints ca which is a pointer to the first int which compounds the array, so what you get is actually the address at which the array has been allocated...
if you want to print each elements in the array, iterate over it.
|
|
|
|
|
Would it be easier to use vectors in most cases?
|
|
|
|
|
#hackC++ wrote: Would it be easier to use vectors in most cases?
depends what you need to do with it.
if you need an array which size need to change often, then yes, vector is certainly a good choice.
please explain what you want to do with that array if you want me to advise you better.
|
|
|
|
|
#hackC++ wrote: const size_t array = 3;
int ca[array];
v2.0 wrote: 1. you cannot do this. you must use either macros or dynamic memory allocation.
Yes we can, because it is const.
At least my GCC compiles this code.
Maxwell Chen
|
|
|
|
|
v2.0 wrote: #hackC++ wrote:
const size_t array = 3;
int ca[array];
1. you cannot do this.
You can in C++ (not in C).
v2.0 wrote: #hackC++ wrote:
cout << ca << endl;
this prints ca which is a pointer to the first int which compounds the array, so what you get is actually the address at which the array has been allocated...
if you want to print each elements in the array, iterate over it.
'iterate' means a for-loop
|
|
|
|
|
Roland Pibinger wrote: 'iterate' means a for-loop
iterate means "go thru each element" by the way you like (for , do or while loop can do the job)...
|
|
|
|
|
mate you need an ebook about C or a tutorial about c arrays
Search in google and read it
|
|
|
|
|
i quite agree with that
|
|
|
|
|
Well i'm currently reading C++ Primer 4th Edition by Stanley Lippman.
just got done reading about vectors and went into arrays which is confusing me to say the least.
The complier I'm using is Bloodshed Dev C++. By the way, whats the best software for C++.
i'm guessing Visual Basic C++ 2003 but i could be wrong.
-- modified at 14:00 Tuesday 25th April, 2006
|
|
|
|
|
#hackC++ wrote: Well i'm currently reading C++ Primer 4th Edition by Stanley Lippman.
when you get stronger C++ programmer, i advise you to read The C++ Language by Bjarne Stroustrup (the C++ Creator).
#hackC++ wrote: By the way, whats the best software for C++.
i'm not sure about what you're saying here, but if you ask for an IDE, then i think most people here will tell you that Microsoft Visual C++ 2003/2005 worth it (because Codeproject is dedicated to microsoft technologies). you can get Visual Studio 2005 Express edition for free on MS web site.
|
|
|
|
|
#hackC++ wrote: just got done reading about vectors and went into arrays which is confusing me to say the least.
Technically, a vector is a one-dimensional array. Things get confusing because C++ has a vector type.
#hackC++ wrote: By the way, whats the best software for C++.
It depends on what you use to measure with. One person might like it for features A, B, and C, while the next person hates those features but likes X, Y, and Z instead.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
You can't output a whole array like that. What's happening is an implicit conversion from int[] to int* , and you're seeing the value of that pointer (the address of array[0] )
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
i Used RegNotifyChangeKeyValue for monitoring the changes all subkeys in the one of the selected Root Key(For Ex.HKEY_CLASSES_ROOT) .
But Am not getting how i can capture the changed registry key name,value,status(created/modified/deleted).
Can Any one tell about this...............
Kiran.V
-- modified at 13:32 Tuesday 25th April, 2006
|
|
|
|
|
Hello to all
I developed a DLL, to which I added a control to him OCX, but the dialog box called from dll function still does not show
Helpme
Thank
alferx
|
|
|
|
|
|
Hi,
If you can download the project, and help me in some way... is only a class and its goal es mainly:
* To have an image at the back (alphablended with AlphaBlend function), and if the window receive ScrollWindow() messages, to don't move.
It work all right, but if I've some controls on it, they will be drawn on the alphablended image, so if you move the window, later it will be visible.
Just open the zip, compile it (I've Visual Studio .NET 2003), and press "ACCEPT" to load the alphablended image, and you must press "CANCEL" several times to make the window scroll.
I'm new to GDI, and maybe there are lots of things very bad. I will appreciate a lot your comments, to learn more.
Here you can download the file !!
THANK YOU VERY MUCH !!!
|
|
|
|
|
Well if you're curious, here you are:
ImagenTransparente.cpp
<br />
<br />
#include "stdafx.h"<br />
#include "Transparencia.h"<br />
#include "ImagenTransparente.h"<br />
#include ".\imagentransparente.h"<br />
<br />
<br />
<br />
IMPLEMENT_DYNAMIC(ImagenTransparente, CStatic)<br />
ImagenTransparente::ImagenTransparente(int nID, BYTE transparencia )<br />
{<br />
bm.LoadBitmap(nID);<br />
<br />
bm.GetBitmap(&BitMap);<br />
m_nWidth = BitMap.bmWidth;<br />
m_nHeight = BitMap.bmHeight;<br />
<br />
bf.AlphaFormat = 0;<br />
bf.BlendFlags = 0;<br />
bf.BlendOp = AC_SRC_OVER;<br />
bf.SourceConstantAlpha = transparencia;<br />
<br />
this->nID = nID;<br />
}<br />
<br />
ImagenTransparente::~ImagenTransparente()<br />
{<br />
}<br />
<br />
<br />
BEGIN_MESSAGE_MAP(ImagenTransparente, CStatic)<br />
ON_WM_CREATE()<br />
ON_WM_PAINT()<br />
ON_WM_ERASEBKGND()<br />
ON_WM_MOVE()<br />
END_MESSAGE_MAP()<br />
<br />
<br />
<br />
<br />
<br />
int ImagenTransparente::OnCreate(LPCREATESTRUCT lpCreateStruct)<br />
{<br />
if (CStatic::OnCreate(lpCreateStruct) == -1)<br />
return -1;<br />
<br />
CRect rect;<br />
GetWindowRect(&rect);<br />
GetParent()->ScreenToClient(&rect);<br />
<br />
miPosicion.left = rect.left;<br />
miPosicion.right = rect.right;<br />
miPosicion.top = rect.top;<br />
miPosicion.bottom = rect.bottom;<br />
<br />
this->izquierda = rect.left;<br />
this->arriba = rect.top;<br />
<br />
CClientDC dc(this);<br />
<br />
CDC MemDC;<br />
MemDC.CreateCompatibleDC(&dc);<br />
CBitmap MemBmp;<br />
MemBmp.CreateCompatibleBitmap(&dc, m_nWidth, m_nHeight);<br />
CBitmap *pOldMemBmp = MemDC.SelectObject(&MemBmp);<br />
<br />
CDC MemDC2;<br />
MemDC2.CreateCompatibleDC(&dc);<br />
CBitmap *pOldbmp = MemDC2.SelectObject(&bm);<br />
MemDC.BitBlt(0, 0, m_nWidth, m_nHeight, &MemDC2, 0, 0, SRCCOPY);<br />
MemDC2.SelectObject(pOldbmp);<br />
<br />
dc.AlphaBlend(0, 0, m_nWidth, m_nHeight, &MemDC, 0, 0, m_nWidth, m_nHeight, bf);<br />
<br />
MemDC.SelectObject(pOldMemBmp);<br />
<br />
return 0;<br />
}<br />
<br />
void ImagenTransparente::OnPaint()<br />
{<br />
CPaintDC dc(this);
<br />
CDC MemDC;<br />
MemDC.CreateCompatibleDC(&dc);<br />
CBitmap MemBmp;<br />
MemBmp.CreateCompatibleBitmap(&dc, m_nWidth, m_nHeight);<br />
<br />
CBitmap *pOldMemBmp = MemDC.SelectObject(&MemBmp);<br />
<br />
CDC MemDC2;<br />
MemDC2.CreateCompatibleDC(&dc);<br />
CBitmap *pOldbmp = MemDC2.SelectObject(&bm);<br />
MemDC.BitBlt(0, 0, m_nWidth, m_nHeight, &MemDC2, 0, 0, SRCCOPY);<br />
MemDC2.SelectObject(pOldbmp);<br />
<br />
<br />
dc.AlphaBlend(0, 0, m_nWidth, m_nHeight, &MemDC, 0, 0, m_nWidth, m_nHeight, bf);<br />
<br />
MemDC.SelectObject(pOldMemBmp);<br />
}<br />
<br />
BOOL ImagenTransparente::OnEraseBkgnd(CDC* pDC)<br />
{<br />
return TRUE;<br />
}<br />
<br />
void ImagenTransparente::OnMove(int x, int y)<br />
{<br />
this->SetWindowPos(&CWnd::wndBottom, miPosicion.left, miPosicion.top, miPosicion.right - miPosicion.left, miPosicion.bottom - miPosicion.top, 0);<br />
GetParent()->Invalidate();<br />
}<br />
ImagenTransparente.h
<br />
#pragma once<br />
<br />
<br />
<br />
class ImagenTransparente : public CStatic<br />
{<br />
DECLARE_DYNAMIC(ImagenTransparente)<br />
<br />
public:<br />
ImagenTransparente(int nID, BYTE transparencia = 0x7f );<br />
virtual ~ImagenTransparente();<br />
<br />
protected:<br />
DECLARE_MESSAGE_MAP()<br />
<br />
private:<br />
CBitmap bm;<br />
BITMAP BitMap;<br />
BLENDFUNCTION bf;<br />
CRect miPosicion;<br />
<br />
int m_nWidth;<br />
int m_nHeight;<br />
int izquierda;<br />
int arriba;<br />
int nID;<br />
public:<br />
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);<br />
afx_msg void OnPaint();<br />
afx_msg BOOL OnEraseBkgnd(CDC* pDC);<br />
afx_msg void OnMove(int x, int y);<br />
};<br />
|
|
|
|
|
What to do use arrays for? please give an example. And why multi-demensions arrays.
|
|
|
|
|
|