|
relate
[^]
and
[^]
&m_i = &* (this + offset of m_i) which is (this + offset of m_i) its not dereferencing and your printf format specifier is %d (0(this) + 0(offset of m_i)) is quite enough to work printf.
It is not accessing the value.
|
|
|
|
|
Actually, while the second really uses the data member, the first one use only the supposed address of the data member itself. Try a debugger session on the following code
class ABC
{
public:
int m_i;
int m_i2;
void MyFunc() { cout<<"hello atl";}
};
void main()
{
ABC *c= NULL;
int * p = &(c->m_i);
int * p2 = &(c->m_i2);
}
BTW I agree, we're on the funny (or weird, depending on taste) side of the things.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
CPallini wrote: BTW I agree, we're on the funny (or weird, depending on taste) side of the things.
Eight years ago, I wrote my ADO wrapper library at work. The whole thing was written in this taste.
ADOxxxClass* p = NULL;
p->SomeFunction(...);
Maxwell Chen
|
|
|
|
|
Maxwell Chen wrote: Eight years ago
wow, you are too experienced buddy.
|
|
|
|
|
Rajkumar R wrote: wow, you are too experienced buddy.
Maxwell Chen
|
|
|
|
|
Thanks.
|
|
|
|
|
Thank you, buddy!
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Hello everyone,
I can not find precise definition for typed argument for template and non-typed argument for template.
My understanding is,
code like
template <class T, int size> class Foo {
}
T is typed template argument, and size is non-typed template argument. My understanding correct?
thanks in advance,
George
|
|
|
|
|
|
Thanks Rajkumar,
Question answered.
regards,
George
|
|
|
|
|
I am to extract 1000's of records from database. since it takes quite some time I want play the avi file on the status bar of main frame, but the call will be made from the dialg. say on button click event I am extracting records form DB and need to play avi on the status bar, but ...
The instruction at "0x00402150" referenced memory at "0x00b9004c". The memory could not be "written".
void TestPb::OnButton1()
{
thpbar=AfxBeginThread(thPrgbar,THREAD_PRIORITY_NORMAL,0,0,NULL);
//Get 1000's records from DB ..verytime consumming process...
}
UINT TestPb::thPrgbar( LPVOID pParam )
{
CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
pFrame->StartAnimation( IDR_AVITEST ,1);
return (1);
}
void CMainFrame::StartAnimation( UINT id, int nPane /*=1*/ )
{
StopAnimation();
m_pAnimate = new CStatusbarAnimate; // FLASHING ERROR
m_pAnimate->Create(id, nPane);
}
void CMainFrame::StopAnimation()
{
delete m_pAnimate;
m_pAnimate = NULL;
}
bool CMainFrame::IsAnimationActive()
{
return (m_pAnimate != NULL);
}
// needed to ensure original text not visible
void CMainFrame::OnUpdateAnimate(CCmdUI* pCmdUI)
{
pCmdUI->SetText(_T(""));
modified on Tuesday, March 11, 2008 8:29 AM
|
|
|
|
|
As you are stucking in this for a long time, i just looked in to the CStatusbarAnimate class.
Actually you don't need to start a thread to start the animation.
void TestPb::OnButton1()
{
// start animation here
CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
pFrame->StartAnimation( IDR_AVITEST ,1);
thpbar=AfxBeginThread(thPrgbar,THREAD_PRIORITY_NORMAL,0,0,NULL);
}
UINT TestPb::thPrgbar( LPVOID pParam )
{
//Get 1000's records from DB ..verytime consumming process...
// just before returning you may post message to Main frame to stop the animation.
return (1);
}
void CMainFrame::OnStopAnimation()
{
StopAnimation();
}
|
|
|
|
|
Thanks you very much, Yes it is true. I really got strucked up here for a while... thanks for understanding my problem
I am modifying code of very large application, which has the same case number of times, so I looking for a simply way to do this, with out change much in the existing code, So I planed to have a thread that plays avi and call it when every required from all the dialog boxes...Am I going the right way...or is there any other work around...pls advice...
|
|
|
|
|
Have you tries as my suggestion?
|
|
|
|
|
ptr_Electron wrote: so I looking for a simply way to do this
I suggested only to add one statement of postmessage. And move your startanimation within the thread to before creating the thread which is in the button event, And its matter of 5 minutes. If this is not simple for you, then its difficult for you my friend.
|
|
|
|
|
Hello,
does anybody know how to convert char** to char array?
here is my code
<br />
#include stdio.h<br />
<br />
splitString(char** aString)<br />
{<br />
char[10][10] localstring;<br />
.....<br />
.....<br />
.....<br />
<br />
.....<br />
<br />
}<br />
<br />
int main<br />
{<br />
char[10][10] arraystring;<br />
splitString(arraystring);<br />
return 0;<br />
}<br />
Thanks
It is never late to learn
|
|
|
|
|
You can't!
See the Section 2.10[^].
Maxwell Chen
|
|
|
|
|
Hello,
thanks for your reply.
I think i can,
here is what i did
<br />
memcpy(localstring,aString, sizeof(localstring));<br />
But, I want localstring to point aString's address.
<br />
It is easy if<br />
char *aString, then address of aString -> &aString,<br />
if it is<br />
char **aString, then address of aString -> ??????<br />
that is the problem i dont know.
How do we get aString's address?
thanks
It is never late to learn
|
|
|
|
|
splitString(char localstring[][10])
{
.....
.....
Is it acceptable?
|
|
|
|
|
Hello,
thanks for your reply.
But it is not acceptable,
Because sometimes
i call splitString() function with char** parametr.
thanks
It is never late to learn
|
|
|
|
|
Gofur Halmurat wrote: i call splitString() function with char** parametr.
with char**, you mean simply typecast type of multidimentional array of characters or array of pointers to array. Both cannot be interchanged.
char aString[10][10] = {"Test1", "Test2", "Test3"};
char *aString2[10] = {"Test1", "Test2", "Test3"};
former uses contigious buffer while later stores pointers to some other location. So you have to be sure what kind of data the function expects.
in your example any way you can type cast like this.
char (*localString)[10][10];
localString = reinterpret_cast<char (*)[10][10]>(aString); note astring should be a multidimentional array as in your example.
if you are really expecting the muldimensional array, restrict the user by using the array in function argument.
|
|
|
|
|
Gofur Halmurat wrote: How do we get aString's address?
Its address is the same (i.e., &aString ) no matter how many * precede it. The address(es) it points to is a different matter altogether.
"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,
For my application, i used one image from a folder to display in View window.
But I can show only one image.
But if i have three bitmaps,then i have to show these three images continuosly(like slide show) while running my EXE.
Is there possible to do this?
My code is like this
bmpFilePath = gsInstallPath + "Esim\\Pic\\" + szModelName + ".bmp" ;
hBmp = (HBITMAP)::LoadImage(NULL,bmpFilePath,IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_CREATEDIBSECTION);
Anu
|
|
|
|
|
well you can do that...this is to diaply each imag at intervel of Sleep() time...
CFileFind Finderff
if(SetCurrentDirectory("GIVE UR PATH")
{
BOOL bWorkingff = Finderff.FindFile("*.bmp");
bWorkingff = Finderff.FindNextFile();
strFileName = Finderff.GetFileName();
while(bWorkingff)
{
//open BITMAP from strFileName;
//Code to DIAPLay bitmap//
Sleep(100); //as per ur need
bWorkingff = Finderff.FindNextFile();
strFileName = Finderff.GetFileName();
}
}
Good Luck!!
|
|
|
|
|
It seems you are using MFC, CImage is easy to use.
Have a look into CImage::Load, CImage::Draw.
And May be Timer messages can be used to change the image. have look at CWnd::SetTimer() and make the view to update the new image in its paint message. For that set a flag and call CWnd::InvalidateRect or CWnd::RedrawWindow() or CDocument::UpdateAllViews in the timer handler. And in your paint handler check whether image change (check flag) and draw changed image otherwise the current image.
Always try to draw only in paint handlers.
modified on Tuesday, March 11, 2008 8:20 AM
|
|
|
|