|
Hello,
I have a project without document-view architecture. I added a (TableF)childframe derived from CMDIChildWnd and a (HeadView) childview derived from CView which is a member of childframe. When I execute, the childframe that is the window is been made properly with the view but the window gives debug assertion error while closing.
class TableF : public CMDIChildWnd
{
DECLARE_DYNCREATE(TableF)
protected:
TableF();
protected:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual ~TableF();
HeadView Heading ;
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
DECLARE_MESSAGE_MAP()
};
class HeadView : public CView
{
//protected:
public:
HeadView(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(HeadView)
public:
//Operations
public:
virtual void OnInitialUpdate();
//protected:
public :
virtual void OnDraw(CDC* pDC); // overridden to draw this view
public :
virtual ~HeadView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
}
The above are the view and frame classes.
|
|
|
|
|
To get better help, I strongly suggest you to read here before posting.
prithaa wrote: but the window gives debug assertion error while closing
Usually the error messages are quite informative: you should probably post the whole error message. Moreover it is a good idea to mark for us, in your code, the asserting line.
You should properly post code snippets using the code block button.
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]
|
|
|
|
|
Hello,
class TableF : public CMDIChildWnd
{
DECLARE_DYNCREATE(TableF)
protected:
TableF();
protected:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual ~TableF();
HeadView Heading ;
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
DECLARE_MESSAGE_MAP()
};
class HeadView : public CView
{
public:
HeadView();
DECLARE_DYNCREATE(HeadView)
public:
public:
virtual void OnInitialUpdate();
public :
virtual void OnDraw(CDC* pDC);
public :
virtual ~HeadView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
}
I am getting the error
Debug Assertion failed
Expression : CrtIsValidHeapPointer(pUserData)
Prithaa
|
|
|
|
|
Hello,
I have a project without document-view architecture. And I wanted to ask if ChildView member of the Childframe can be derived from CView.I am deriving a childview from CView and this childview is a member of childframe . When I execute the window is opened but while closing I am getting the above error.
Thanks for your reply
Pritha
|
|
|
|
|
I have an MDI app with a docking property pane using CMFCPropertyGridCtrl. The property pane is updated with document and multiple modeless dialog property data using OnSetFocus() to populate the appropriate data depending on which document or dialog has the focus.
The problem is if I have the focus on a dialog with a document also open and want to change a property by selecting the property pane the focus is changed to the document first thus changing the property pane data to the document data.
Basically what is happening is whenever the main frame (i.e. docking pane) is selected the last document view also receives the focus (first). Is there any way to prevent the document view from receiving the focus when the docking property pane is selected?
Thanks
JC
|
|
|
|
|
WAVEFORMATEX structure is said to replace the old WAVEFORMAT structure. With WAVEFORMATEX for waveInOpen , the Subchunk1Size is set as 18 somewhere by the API ( ? ). And it is treated as non-PCM when Subchunk1Size is not 16. How to set the value of Subchunk1Size to 16 when I am creating a wav file? Thanks.
Reference: WAVE PCM soundfile format [^]
Maxwell Chen
|
|
|
|
|
I have a very basic MFC Dialog Program and a Stack ADT.... My Question is where can i declare an instance of the Stack ADT in the GUI Program so that i can manipulate the members inside with the button clicks....
Thanks in Advance...
|
|
|
|
|
GUI Programming is not for the aliens. They still have classes & objects. Your STACK-ADT is just another class. So your dialog class is just going to "use" that class or "contain" an object of that class.
<br />
1.Open up the solution explorer, <br />
<br />
2.Select the headers folder, <br />
<br />
3.right click, add-existing-items, add your "Stack-ADT" header, <br />
the same way for the cpp files into the "source" folder.<br />
<br />
4.Include "stac-adt.h" in to your Dialog class (Your "GUI").<br />
<br />
5.Now everything's ready for use. <br />
<br />
6.You may create the stack object inside your dialog class, <br />
may be it a member or a temp object inside a function. <br />
<br />
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
my project is about DSL download organiser to limit the download and upload of a pc connected throught a server to the internet, i use the c++ code, and buffers to save data as bytes in it and test if the size < limit or = but i dont know how i can know if a pc download or upload, and how i can copy the data (downloaded) from the internet explorer to the buffer, to test if the size is ok or not.
so what is the function to know if the pc use the internet to download or upload.
what is the function to add the data downloaded to the buffer as bytes.
10x
the code:
if(download) ??????????
{
void downloadlimit( )
{ AnsiString IP;
For(int i=0; i<nbofpc;i++)>
Switch (IP)
{Case ‘10.15.1.157’: buffer[limitbypc] = fputs(data); ?????? how i can copy the data as bytes to the buffer
(If(sizeof(data)) == sizeof(buffer)
WriteString (“you can’t download more”); break;
Case ’10.15.1.158’: buffer[limitbypc] = fputs(data); break;?????????
If(sizeof(data)) == sizeof(buffer)
WriteString (“you can’t download more”); break;
……………
Case’10.15.1.164’: ……….; break;
}
}
Return 0;}}
if(upload) ??????????
{
void uploadlimit( )
{ AnsiString IP;
For(int i=0; i<nbofpc;>Switch (IP)
{Case ‘10.15.1.157’: buffer[limitbypc] = fputs(data); If(sizeof(data)) == sizeof(buffer)
WriteString (“you can’t upload more”); break;
Case ’10.15.1.158’: buffer[limitbypc] = fputs(data); break;?????????
If(sizeof(data)) == sizeof(buffer)
WriteString (“you can’t upload more”); break;
……………
Case’10.15.1.164’: ……….; break;
}
}
Return 0;}}
plz helps me
10x joseph
|
|
|
|
|
You need to hook the gateway and watch out for the incoming & outgoing packets, extract their IPs & make thing accordingly. I'm not sure about other ways of doing it, But I'm little surprised at people throwing requirements like these to freshers.
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
Hi,
I have developed one sample call player application in VC++ MFC using MCI.
I am able to play both MP3 calls and WAV calls, I am trying to implement volume controls to my application.
When i have given mp3 files as an input then Volume controls are working fine, but when i have given WAV files as an input the volume controls are not working , that to i am getting MCI error..
Can any one help me out on this problem...
Any help will be appriciated..
Thanks in advance...
Thanks
|
|
|
|
|
did u tried auxGetDevCaps()?
pls tell what was the MCI error code that you got
aks
|
|
|
|
|
I am trying to use radio buttons in Studio 2008 and I don't find it as easy as it used to be in VC++ 6.0 or maybe even in Studio 2005.
Here is what I have. I have a group box that contains three sets of radio buttons.
Set 1: (altitude) meters or feet
Set 2: mach or velocity
Set 3: (if velocity, units) ft/sec, m/sec, mph, knots
I layed this out by creating a label for each set and then putting down the buttons for the current set I was building.
Static label 1: Altitude is: (then I put two radio buttons - meters, feet)
Static label 2: Specify: (then I put two radio buttons - mach, velocity)
Static label 3: Units for velocity: (then I put down 4 radio buttons....)
When I click a button in Set 1, i want it to update a variable - m_nAltitudeFormat.
When I click a button in Set 2, i want it to update a variable - m_nMachOrVelFormat.
When I click a button in Set 3, i want it to update a variable - m_nVelOptFormat.
Studio2008 doesn't do the simple things (??) that previous versions of Studio used to like create the message mapping.... help! (when i tried cut/paste old method, got into more trouble.)
Thanks,
John John
|
|
|
|
|
When you group your radio buttons, you can have only one control variable. Upon DDX the variable gets updated based on the option selected. 0,1 or 2. What do you miss here?
|
|
|
|
|
I would try three separate group boxes, but since I can't even see a listing of the IDC_ resource for any of these buttons, I'm totally infuriated with Studio 2008.
You all probably have a general idea of how I'm trying to tie each set of buttons to a single integer variable. So when I click a choice for altitude (either meters or feet), that variable will be set to 0 or 1. Likewise with the other sets of radio buttons.
I can't even assign a variable for the control itself so that I can disable/enable each of the 4 velocity units - enable them when velocity chosen, disable when Mach chosen.
Studio2008 gets my goat
|
|
|
|
|
john john mackey wrote: I can't even see a listing of the IDC_ resource for any of these buttons, I'm totally infuriated Mad
Stay cool . Select the control, right click, "properties". You will get it's ID from the ID property. Any control you drop on the dialog will have it's ID.
Also,you might know, you can enable/disable any control without creating a control variable.
GetDlgItem(RESOURCE_ID)->EnableWindow(true/false);
Also, I'm just noticing. The member variable for Radio button DDX is by default is BOOL! quite misleading. It should've been int rather. God only knows why they changed it to BOOL.
Also any beginners who would think BOOL as bool will have an excellent day
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
Thanks for this advice! I will try it out.
Regarding the single group box, I think I will create separate group boxes for the 3 sets of radio buttons I have, but just make them NOT VISIBLE (hide the group boxes).
Thanks again.
|
|
|
|
|
How can I write DllMain function in C language for Borland C++ 5.5.1 compiler
|
|
|
|
|
|
dataminers wrote: How can I write DllMain function in C language...
See here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi All,
Anyone have c code for Boyer-Moore or BMH? I don't want to take the time to translate (and debug) pseudo code from my Algorithm Analysis textbook. I'd like to paste and compile.
No wiki please. I already know their stuff is broken. How much crap can one site publish and claim it is fit for consumption?
Jeff
|
|
|
|
|
|
Hi David,
DavidCrow wrote: http://www-igm.univ-mlv.fr/~lecroq/string/node14.html[^]
I ran across these. Unfortunately, some assembly is required and there are no instruction on calling 'void* p = Find(needle, haystack)'. Perhaps I am asking for too much.
DavidCrow wrote: Specfically what?
Run it: Wiki's Boyer-Moore Horspool[^] implementation.
Here's one of the best examples. A fellow claimed Dr. Adler's ADLER-32 reference implementation was wrong because it did not agree with wiki: Need peer review: May have found mistake in Adler-32![^].
Jeff
|
|
|
|
|
This is from my bag-o-tricks library, but it's been a long time since I've tested or used them.
const char* CBTextSearch(const char* pSearchStr, const char* pStr, int textLen)
{
if (!pSearchStr || !*pSearchStr)
return pStr;
if (!pStr || !*pStr)
return NULL;
if (textLen < 0)
textLen = (int)strlen(pStr);
int searchStrLen = (int)strlen(pSearchStr);
int pSkipTable[256];
int i;
for (i = 0; i < 256; i++)
pSkipTable[i] = searchStrLen;
for (i = 0; pSearchStr[i]; i++)
pSkipTable[(BYTE)pSearchStr[i]] = searchStrLen - 1 - i;
register int right = searchStrLen - 1;
while (right < textLen)
{
int j;
for (j = searchStrLen - 1, i = right; j >= 0 && pSearchStr[j] == pStr[i]; j--)
i--;
if (j == -1)
return &pStr[i + 1];
right = max(i + pSkipTable[(BYTE)pStr[i]], right + 1);
}
return NULL;
}
const wchar_t* CBTextSearch(const wchar_t* pSearchStr, const wchar_t* pStr, int textLen)
{
if (!pSearchStr || !*pSearchStr)
return pStr;
if (!pStr || !*pStr)
return NULL;
if (textLen < 0)
textLen = (int)wcslen(pStr);
int searchStrLen = (int)wcslen(pSearchStr);
int* pSkipTable = (int*) _alloca(searchStrLen * sizeof(int));
int i;
for (i = 0; i < searchStrLen; i++)
pSkipTable[i] = searchStrLen - 1 - i;
register int right = searchStrLen - 1;
while (right < textLen)
{
int j;
for (j = searchStrLen - 1, i = right; j >= 0 && pSearchStr[j] == pStr[i]; j--)
i--;
if (j == -1)
return &pStr[i + 1];
for (j = searchStrLen - 1; j >= 0; j--)
{
if (pSearchStr[j] == pStr[i])
{
right = max(i + pSkipTable[j], right + 1);
break;
}
}
if (j < 0)
right = max(i + searchStrLen, right + 1);
}
return NULL;
}
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Hi Joe,
That was it. I did modify a bit to get a compile under boring old 'C': pSkipTable[(unsigned)pSearchStr[i]]
Thanks.
Jeff
|
|
|
|