|
Thanks for that but I forgot it from the post not the code! message actually reads:-
Parsing Error: Expected ")" Input Line:"DDX_Control(pDX,IDC_TINY1,m_Tiny[0]);"
Sorry!
|
|
|
|
|
put the above code after like this //}}AFX_DATA_MAP
<blockquote class="FQ"><div class="FQA">stevepqr wrote:</div>DDX_Control(pDX, IDC_TINY1, m_Tiny[0]);
DDX_Control(pDX, IDC_TINY2, m_Tiny[1]);
DDX_Control(pDX, IDC_TINY3, m_Tiny[2]);
.
.
.
DDX_Control(pDX, IDC_TINY12, m_Tiny[11]);</blockquote>
in DoDataExchange Function. It should work.
|
|
|
|
|
Thanks but the code is already included inside the '//}}AFX_DATA_MAP' I didn't change this part just added lines inside the markers.
|
|
|
|
|
i had the same problem and this was solved by adding the code outside the markers.
|
|
|
|
|
ClassWizard only parses the lines inside its comments.
You should place your custom lines outside the class wizard's special comments. Just below the comment line //}}AFX_DATA_MAP, for example.
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_TINY1, m_Tiny[0]);
DDX_Control(pDX, IDC_TINY2, m_Tiny[1]);
You should also take definitions into account in header file.
enum { IDD = IDD_DIALOG1 };
CStatic m_static1;
CStatic m_Tiny[12];
The lines added manually in that way, won't be parsed by ClassWizard.
|
|
|
|
|
I thought of this already - when I try it I get 'Cannot Add New Member' when I try to add a new member but otherwise it works ok. I'm getting round this by commenting out the above lines adding new members and then uncommenting them, PITA!!
|
|
|
|
|
The problem may be with <your project="" name="">.clw file. Close project then rename that file. ClassWizard will re-create it. Or you may edit yourself if you know what you do.
|
|
|
|
|
Thanks! Deleting the .clw and regenerating it did the trick - strangely, after recreating it I had to exit VS and restart but now all is good.
Thanks to everyone else too for their suggestions.
Apathy Rules - I suppose...
Its not the things you fear that come to get you but all the things that you don't expect
|
|
|
|
|
I am trying to Saving and Restoring Toolbars status by sending TB_SAVERESTORE message. MSDN says if you don't have user data to store with the toolbar buttons, you don't need to handle TBN_SAVE or TBN_RESTORE notification. So, now, the saving and restoring are fine, the program restores toolbar buttons correctly. However, if I try to kill that toolbar control restored, Visual Studio gives a warning message "Unhandled exception at 0x7c901230 in win32tst.exe: User breakpoint." This warning only shows if the program is launched inside the Visual Studio. It just runs fine if launched outside of Visual Studio. So I tried to debug with WinDbg.exe, and it gives a more detailed description of that user breakpoint warning "Invalid Address specified to RtlFreeHeap". Anybody knows what's wrong with the restoring? Thanks.
case WM_NOTIFY:
{
switch (((LPNMHDR)lParam)->code)
{
case TBN_GETBUTTONINFO:
{
LPTBNOTIFY lpTbNotify = (LPTBNOTIFY)lParam;
// Pass the next button from our array. There is no need to
// filter out buttons that are already used; they will be
// ignored.
int buttonCount = sizeof(tbButtons) / sizeof(TBBUTTON);
if (lpTbNotify->iItem < buttonCount)
{
lpTbNotify->tbButton = tbButtons[lpTbNotify->iItem];
return TRUE;
}
else
{
// No more buttons.
return FALSE;
}
}
break;
case TBN_QUERYINSERT:
case TBN_QUERYDELETE:
return TRUE;
case TBN_ENDADJUST:
{
TBSAVEPARAMS tbSave;
tbSave.hkr = HKEY_CURRENT_USER;
tbSave.pszSubKey = "Software\\key";
tbSave.pszValueName = "tbsave";
SendMessage(GetDlgItem(hWnd,ID_TOOLBAR),TB_SAVERESTORE, TRUE, (LPARAM)&tbSave);
}
return TRUE;
}
}
break;
|
|
|
|
|
We have a huge C++ code, developed on Microsoft Visual Studio 6.0. This contains but server and client code. Now the requirement is to add a support for memory leak detection.
So can any one help me to code, which should check the existing whole code base for memory leaks.
Thanks,
Nandu
|
|
|
|
|
|
Thanks, But the above mentioned will not support VS6.0, I need a similar solution for VS 6.0
-Nandu
|
|
|
|
|
See Visual Leak Detector [^].
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Help me with these program
/* program to illustrte read function with pointer */
//this program may not work properly because of memory problems in read
#include<stdlib.h>
#include<stdio.h>
#include<unistd.h>
#include<string.h>
int main()
{
char *buf,c;
int nread;
memset(buf,0,0);
buf=malloc(1024);
nread=read(0,&buf,100);
printf("characters read: %d\n",nread);
if(nread == -1)
{
write(2,"An error occured in read function\n",27);
}
else
{
if(nread==0)
write(2,"Data is not written to the filedescriptor\n",27);
else
write(1,&buf,nread);
}
free(buf);
}
output:
sandeep@sandeep $ ./a.out <x
characters read: 75
this is Kead program
which is throwing lots of errore
lets correct them
Segmentation fault
|
|
|
|
|
sandeep_dhruwa wrote: char *buf,c;
int nread;
memset(buf,0,0);
buf=malloc(1024);
You have to call malloc before calling memset. Otherwise, you will try to write into an invalid pointer.
|
|
|
|
|
still I am getting the error
|
|
|
|
|
And for the read and write functions, don't pass the address of your buffer variable: it is already a pointer. Pass the pointer directly:
read(...,buffer,...);
(apply that for every read and write).
|
|
|
|
|
thanks it solved
thankyou
|
|
|
|
|
sandeep_dhruwa wrote: nread=read(0,&buf,100);
sandeep_dhruwa wrote: write(1,&buf,nread);
You should use buf , not &buf .
For instance
nread = read(0, buf, 100);
BTW your code is a mess, you really need a good C tutorial.
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
[My articles]
|
|
|
|
|
class CA{
private:
int m_Var;
public:
CA(int x=0): m_Var(x){cout<<"1";}
bool operator < (const CA &obj2) { cout<<"2"; return (m_Var < obj2.m_Var) ? true : false;}
};
int main(void) {
CA obj1=2;
if(obj1 < 3){cout << "In If block" << endl;}
}
the output of this code is 112In If block .. i can understand the reason behind the first 1 and "2In If block" .. i dont understand when the second 1 is being called?
as per my understanding when (obj1<3) executes it may call obj1.operator<(3)
But constructor is being called but whats makes it to call?
kindly explain why the second 1 is being displayed?
|
|
|
|
|
Member 3974347 wrote: as per my understanding when (obj1<3) executes it may call obj1.operator<(3)
Not actually. It is actually called like
obj1.operator<( CA(3));// A local temporary object is created here.
Here the integer 3 is automatically converted to a CA object by involking the constructor. Such conversions are called implicit conversions. You can prevent such conversions using the explicit keyword[^]
|
|
|
|
|
You are so fast!
|
|
|
|
|
Well, I borrowed some monkeys[^] from Rajesh.
|
|
|
|
|
Thanks.
|
|
|
|
|
Member 3974347 wrote: But constructor is being called but whats makes it to call?
Because constructor accepts a int .
Member 3974347 wrote: as per my understanding when (obj1<3) executes it may call obj1.operator<(3)
Your operator overload accepts const CA & but you specified the expression obj1<3 , since type CA has a constructor which takes int, a temporary will be created by passing 3 to the constructor of CA and this is the reason for the second time constructor call.
Use explicit keyword to avoid the confusion.
|
|
|
|