|
Ouch!
It may be fine if you use integers/whole numbers
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi 2 All!!!
When I install visual studio .Net 2003 in Windows Vista it does not installed why?
*****THANKS N ADVANCE****
Mathen.K
(I WILL TRY MY LEVEL BEST )
|
|
|
|
|
|
Probably because you suck at asking questions. It's been a long time, I am seeing you ask two different questions over and over. One is that your program will work in XP, but not on Vista. And the other is that you fail to install VS 2003 on Vista. And you won't ever give us a remotest clue to solve the problem.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
rowdy_vc++ wrote: why?
Maybe because it failed. Other than that, I'm unsure.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi all,
I have something like this in one of the header file:
VAL Val1[1];
where VAL is defined as:
struct VAL
{
LPWSTR pszVal;
LPWSTR pszEmailAdrVal;
ULONG ulVal;
SYSTEMTIME stVal;
BOOL fVal;
};
when I doing something like this in CPP file:
Val1[0] = {L"Jack", L"Jack@somewhere.com", 256, {2006, 3, 4, 9, 0, 0, 0, 0}, TRUE};
I got "missing ';' before '{'" compilation errors. What's the reason behind this?
Thanks,
|
|
|
|
|
LiYS wrote: Val1[0] = {L"Jack", L"Jack@somewhere.com", 256, {2006, 3, 4, 9, 0, 0, 0, 0}, TRUE};
You cannot do like this after the object has been constructed. The object gets contructed at the statement
VAL Val1[1];
So the only option is to do as follows
VAL Val1[1] = {L"Jack", L"Jack@somewhere.com", 256, {2006, 3, 4, 9, 0, 0, 0, 0}, TRUE};
|
|
|
|
|
LiYS wrote: VAL Val1[1];
HI, if you need only one object, why not you declare VAL Val1; instead of VAL Val1[1];
"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/codeProject$$>
|
|
|
|
|
In the default CAboutDlg, I just erase all controls. And I add a CStatic control. I just want to show a bitmap in the CStatic control.
And I also import a bitmap file to the resource.
my codes:
The header file
class CAboutDlg : public CDialog
{
CBitmap m_bitmap;
CStatic m_ctlPic;
}
The cpp file:
CAboutDlg::CAboutDlg()
{
m_bitmap.LoadBitmap(IDB_BITMAP1);
}
CAboutDlg::~CAboutDlg()
{
if (m_bitmap.GetSafeHandle())
m_bitmap.DeleteObject();
}
BEGIN_MESSAGE_MAP()
ON_WM_PAINT()
END_MESSAGE_MAP()
void CAboutDlg::OnPaint()
{
CPaintDC dc(this);
CRect rcWnd;
m_ctlPic.GetWindowRect(&rcWnd);
this->ScreenToClient(&rcWnd);
BITMAP bm = {0};
m_bitmap.SelectObject(&bm);
CDC dcMem;
dcMem.CreateCompatibleDC(&dc);
dcMem.SelectObject(&m_bitmap);
dc.StretchBlt(rcWnd.left, rcWnd.top, rcWnd.Width(), rcWnd.Height(), &dcMem, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
}
But when I open the CAboutDlg, the bitmap shows flash, and vanish immediately, Please tell me what's wrong in my mind?
|
|
|
|
|
fantasy1215 wrote: How to show a bitmap in a CStatic control?
Why dont you use a Picture control?
|
|
|
|
|
Use SetBitmap() method of static control.
|
|
|
|
|
I just want to try GDI, Please tell me what wrong with my code. When I first show the CAboutDlg I see the bitmap show as a flash in the right place.
|
|
|
|
|
fantasy1215 wrote: Please tell me what wrong with my code
You're drawing on the dialog window.
The static control, being higher in the z-order, is then drawn on top of your drawing.
You need to subclass the static control and paint on it instead.
With MFC, simply derive a class from CStatic and handle WM_PAINT just like you did on
the dialog, except you don't have to convert coordinates.
In the dialog class, use an object of your CStatic-derived class instead of a CStatic object.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery
Thanks very much for reply. You just unlock my mind. Before you give me the answer, I am so confused.
BTW, Except for subclassing a CStatic class, Can I draw the bitmap in the CStatic control just in the CAboutDlg class? And how?
|
|
|
|
|
fantasy1215 wrote: Can I draw the bitmap in the CStatic control just in the CAboutDlg class? And how?
You can, but there's a slight problem.
Getting a dc to the client or window area of the control is no problem.
That makes drawing simple.
The problem is when to draw.
You can draw any time you want to, but you also need to draw in response to WM_PAINT,
to refresh windows overdrawn in instances like when the user drags another window over
the top of yours then moves it away.
From the dialog (parent) window's WM_PAINT handler, there's no reliable way I know of to
know when the child windows are finished drawing themselves, at which time it would be safe
to draw on top of them.
MFC does subclassing for you, and makes handling the messages consistent regardless of
window/control class, so it's definitely IMO the easier way to go.
Besides, painting from the window class itself instead of from a window's parent class
just makes for a better object-oriented implementation.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Its better to use a picture control, but I would like to know how do you compiled the code,
fantasy1215 wrote: this->WindowToScreen(&rcWnd);
Is This function available.
fantasy1215 wrote: m_bitmap.SelectObject(&bm);
Is this compilable.
Part from these compilation errors, "m_ctlPic.GetWindowRect(&rcWnd);" already the screen coordinate and drawing on to Dialog DC which expects a client dc of dialog.
|
|
|
|
|
i have a static control in my application. when i click on a particular position i want to show the value in a static text. i need to show this on the static control itself. like (x1,y1).
take for example in excel when u make a graph and point to a location it reads out the value in a box. i want to do it the same way. what needs to be done for this?
|
|
|
|
|
WM_LBUTTONDOWN or OnLButtonDown will give you the mouse position either in lParam or a CPoint for MFC (check msdn).
Not sure what you're asking....
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Chandrasekharanp wrote: take for example in excel when u make a graph and point to a location it reads out the value in a box. i want to do it the same way. what needs to be done for this?
Handle click event on Mouse and GetCursorPos will return you exact cursor position with respect with screen!
"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/codeProject$$>
|
|
|
|
|
Hello,
can I play a piece of sound using DSound, while a stream file (.mp3 or .avi) plays with DShow?
with regards,
mwolf122
|
|
|
|
|
Yes. As long as nobody takes control of the primary buffer,
all secondary DirectSound buffers should be mixed by the
system.
Works fine on XP and Vista I know for sure.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I want my COleClientItem derived items to draw with the DVASPECT_OPAQUE flag but COleClientItem::Draw doesn't support the DVASPECT2 enumeration.
I think I need to check if my COleClientItem supports IViewObject2 and then call IViewObject2::Draw, but I don't really know how to go about it.
Can anyone help me?
Is this even the correct method?
Cheers
|
|
|
|
|
I have two questions. The first one is regarding the conversion from int to string. I can successfully convert a numeric string to int with the follwing code (particularly useful if you need to make mathematical operations on the numeric values contained in a string):
string VALUE_AS_STRING = "1234";
int VALUE_AS_INT = atof (VALUE_AS_STRING.c_str());
cout << "The numeric value of the string is: " << VALUE_AS_INT;
...but I am not able to do the opposite, eg convert an int into a string. Any help please?
Second question :
How come the condition below results in an error? How should it rather be written?
char CHARACTER = "1";
if (CHARACTER == "1") {cout << "True";}
Many thanks
|
|
|
|
|
J_E_D_I wrote: int VALUE_AS_INT = atof (VALUE_AS_STRING.c_str());
Should use atoi ().
J_E_D_I wrote: I am not able to do the opposite, eg convert an int into a string.
sprintf ()
J_E_D_I wrote: char CHARACTER = "1";
if (CHARACTER == "1") {cout << "True";}
Use single quote.
if(character == 'a') {
cout << "It is a";
}
Maxwell Chen
|
|
|
|
|
J_E_D_I wrote: but I am not able to do the opposite, eg convert an int into a string. Any help please?
Another method in addition to Maxwell's sprintf()...
#include <sstream>
...
int SomeInt = 5;
std::ostringstream NumericStringStream;
NumericStringStream << SomeInt;
std::string NumericString = NumericStringStream.str();
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|