I would like to suggest to add a Qt language sections. It is becoming a new phenomenon and from observing different forums I think there are quite a lot of cute(Qt) programmers over there ready to join the code project ;) regards,
Electronic75
Posts
-
Qt -
why I can't declaring a CArray object in a separate header file [modified]Well I use visual studio 2005 :(( danke anyway
-
why I can't declaring a CArray object in a separate header file [modified]KarstenK wrote:
why havent you tried it like i posted it you? Unsure
Hello :) I did but as I said it dose not work. you typed ypedef CArray<long,> CMyArray; struct { CMyArray m_array; } but I think there are many typos in it so I typed typedef CArray<POINT> CMyArray; typedef struct tag_compliance_info { LONG lModuleCode; LONG lModuleVersion; CString sModuleName; CMyArray aCompliance; } STRUCT_COMPLIANCE_INFO; still I get Error 1 error C2248: 'CObject::CObject' : cannot access private member declared in class 'CObject' c:\program files\microsoft visual studio 8\vc\atlmfc\include\afxtempl.h 272
KarstenK wrote:
And you NEED a Array because the is a lot and different count of pointsConfused
Exactly :)
-
why I can't declaring a CArray object in a separate header file [modified]dose not work. I even tried to inherit my struct from CObject but since the problem is accessing private members not protected couldn't solve the problem! typedef struct tag_compliance_info: CObject { LONG lModuleCode; LONG lModuleVersion; CString sModuleName; CArray<POINT> aCompliance; } STRUCT_COMPLIANCE_INFO;
-
why I can't declaring a CArray object in a separate header file [modified]I'm not sure I still clear but do you mean CArray constructor has written in away that can't be declared in a struct and other objects do not have this problem. I want to store an array of 2 long int so either
CArray<LONG,LONG>aMyarray
orCArray<POINT>aMyArray
Danke:rose: -
why I can't declaring a CArray object in a separate header file [modified]Hi KarstenK :) , You mean there is no way? but why? there should be a reason. what other objects you mean? Thanks
-
why I can't declaring a CArray object in a separate header file [modified]Hello :) I have no problem declaring a CArray variable inside a class definition but as I have a separate file that I place all my typedefs inside it have tried to define a struct that has a CArray member but compiler says: Error 1 error C2248: 'CObject::CObject' : cannot access private member declared in class 'CObject' c:\program files\microsoft visual studio 8\vc\atlmfc\include\afxtempl.h 272 this was my code inside TypeDefs.H typedef struct tag_compliance_info { LONG lModuleCode; LONG lModuleVersion; CString sModuleName; CArray<POINT> aCompliance; //Oh I forgot this board filters <> signs } STRUCT_COMPLIANCE_INFO; How can I solve this?
modified on Friday, October 24, 2008 3:12 AM
-
How to use CompletionPort to exchange data between two threadsHello, I read the MSDN but there were no example and I didn't completely understand how to use it. I have two threads that both send data to the other thread and receive data from it. Should I create IoCompletionPort in both threads and use ReadFileEx and WriteFileEx t read and write to/from the i/o completion port? I'm confused because in MSDN has said that one shuld not use ReadFileEx & WriteFileEx. It says "After an instance of an open file is associated with an I/O completion port, it cannot be used in the ReadFileEx or WriteFileEx function." Then How should I read and write to I/O Completion port? I'm confused:confused: can someone explain a bit please. thanks.
-
two dimensional pointer array casting (C question)Thanks Sandip It works fine:rose:
-
two dimensional pointer array casting (C question)Hello :) , I have defined a two dimensional array of type double in one of my MFC classes in class 1:
double m_aCoefficients[10][20];
and now I want to make a pointer to this variable in another of my classes and assign address of this double array to that pointer. so i have defined in class 2:double* m_pCoefficients[10][20];
and in my CMyDoc Class I have tried this:m_Class2.m_pCoefficients = (double*[10][20]) &m_Class1.m_aCoefficients;
but it gives error Error 4 error C2440: 'type cast' : cannot convert from 'double (*)[10][20]' to 'double *[10][20]' How can I resolve this? thanks -
How to see content of an array within an array in debug watch windowHi I have defined an struct which has an array within it and then I have defined an array of that struct how can I see a specific member of second array in debug time. the actual situation is even more complex and I have several levels of arrays nested within each other but I thing if I know how to do it following code then I can solve my problem...
typedef struct tag_myStruct
{
CArray <int> aInt;
CArray <MyClass> aMyClass;
.
.
.
}MyStruct;CArray<MyStruct> m_aMyStruct;//Let's Say I want to see m_aMyStruct[2].aInt[3]
thanks:rose:
-
Permanent Handle Map problemHi Mark, It took almost a day of my time but problem solved problem was in MSXML get_text when it tries to read a big chunk of data it was overwriting on m_pDefineSheet place so FromHandle() returned an erroneous address that already had been overwritten by evil get_text. One thing I still didn't understand is why windows wouldn't give a memory access violation error. cheers
-
Permanent Handle Map problemHello Mark, No it is in the same thread. I followed the stack more closely and with the help of a lot of breaking points and many hours I found out problem occurs in an XML class that tries to read an XML file. I have a MFC application and I used a MSXML wrapper class from this address http://www.codeguru.com/cpp/data/data-misc/xml/article.php/c8287/[^] (I don't know credit of this work goes to whom I later found out some people developed very similar codes earlier). Now I already had defined a pointer to my CPropertySheet in my CDocument class
m_pDefineSheet = new CDefineSheet;
and when I open a new document a new view is created and the property sheet will be created as its childCFormView::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
pDoc = (CMyoc*) GetDocument();
if(!pDoc)
return 0;pDoc->m\_pDefineSheet->AddPage(pDoc->m\_pDev1); pDoc->m\_pDefineSheet->AddPage(pDoc->m\_pDev2); pDoc->m\_pDefineSheet->AddPage(pDoc->m\_pDev3); if (!pDoc->m\_pDefineSheet->Create(this, DS\_CONTEXTHELP | DS\_SETFONT | WS\_CHILD | WS\_VISIBLE)) { DestroyWindow(); return FALSE; }
No problem thus far then CMyDoc::OnNewDocument()will be executed and there it loads an XML document using CXMLManager m_xmlManager
m\_xmlManager.Initlize(); m\_xmlManager.Load(sData); m\_xmlManager.GetRoot()->get\_childNodes(&pList1); n1 = m\_xmlManager.GetNoOfChilds(pList1) ; for(i1=0;i1<n1;i1++)> { pNode1 = m\_xmlManager.GetItemNode(i1,pList1); pList2 = m\_xmlManager.GetChildList(pNode1); n2 = m\_xmlManager.GetNoOfChilds(pList2) ; sName1 = m\_xmlManager.GetNodeName(pNode1); sData = m\_xmlManager.GetText(pNode1); }
Upon execution of this code it seems that something overwrites the m_pDefineSheet location and when I execute
AfxGetMainWnd()->FromHandle((HWND)x)
in immediate window x is the handle of m_pDefinesheet which was ok prior to execution of this code it returns error note that I receive no error of memory access violation that someone illegally has tried to write in memory This is first time I have encountered such problem! Thank you anyway. -
Permanent Handle Map problemHello, I have a view that has a property sheet and property pages. when I want start a new document an assertion error happens. I followed the call stack and found out that problem occurs at this function
CWnd* PASCAL CWnd::FromHandlePermanent(HWND hWnd)
{
CHandleMap* pMap = afxMapHWND();
CWnd* pWnd = NULL;
if (pMap != NULL)
{
// only look in the permanent map - does no allocations
pWnd = (CWnd*)pMap->LookupPermanent(hWnd);
ASSERT(pWnd == NULL || pWnd->m_hWnd == hWnd);//<<<< this ASSERT fails
}
return pWnd;
}I took the hWnd and searched it in spy++ windows list and I found out that this window is the property sheet. In spy++ I couldn't find any problem in properties of this window even its childs(property pages) seemed OK. but the problem is when windows look in its permanent handle map it returns an erroneous pointer. the pointer is not null neither the hWnd of the returned pointer but hWnd of returned pointer is 0x30203020 which is different from the FromHandlePermanent(HWND hWnd) supplied sane handle. of course the returned pointer is completely erroneous and this supposed to be a window has no sane owner, child, next window or prev window. How can I find the problem? thanks
-
How to create and array of structs that have their own arrays? [modified]Thanks a lot Cedric, It worked pretty much OK:cool::rose:
-
How to create and array of structs that have their own arrays? [modified]Hi! :) I guess you are right! you mean I have to derive my own CArray class? isn't another way I mean another array class that can do the trick! thanks
-
How to create and array of structs that have their own arrays? [modified]done :)
-
How to create and array of structs that have their own arrays? [modified]Hi :) , Sure, Error 36 error C2248: 'CObject::operator =' : cannot access private member declared in class 'CObject' c:\program files\microsoft visual studio 8\vc\atlmfc\include\afxcoll.h 593 Error 37 error C2248: 'CObject::operator =' : cannot access private member declared in class 'CObject' c:\program files\microsoft visual studio 8\vc\atlmfc\include\afxtempl.h 272 these errors do not appear when I remove
m_Mystruct.Add(a)
As I noted in the stuct definition I have both CArray and CStringArray thanks :) -
How to create and array of structs that have their own arrays? [modified]Hello :) , is there anyway that I can hold an array of structs that have their own arrays other than creating a new class
somewhere in the typedef.h ...
typedef struct mystruct
{
CStringArray aName1;
CStringArray aName2;
CArray aVal1;
CArray aVal2;
}MY_STRUCT;somewhere in the header of my MyDoc.h...
#include "typedef.h"CArray m_MyStructs;
somewhere in the header of my MyDoc.cpp...MY_STRUCT a;
...
m_MyStruct.Add(a);This code returns error that "=" operator is private and can't be accessed! Thanks :) PS-Oh I got that I can'tuse >< around my type specifier because it will be assumed as a tag so I use [] instead :) somewhere in the typedef.h ... typedef struct mystruct { CStringArray aName1; CStringArray aName2; CArray [int] aVal1; CArray [int] aVal2; }MY_STRUCT;
-
how to define global const class variable [modified]Hello :) , I'm trying to define a global const [Class] varibles in a MFC application. This class holds an array of variables that I like to assign at the beginning and I will use this variable [and its stored const values] in my program in different classes[]. Now what I'm doing is to add a blank cpp file to my project and then I define this class variable there.
#include "MyInfoArrayClass.h"
const CMyInfoArrayClass g_Info;
g_Info.Add(data1);
g_Info.Add(data2);
...but compiler dose not see the definition and intellisense shows the type of g_Info as int and returns SYNTAX error and redefinition of basic type. Even when I place class definition in a header file and include header file in the source file compiler returns same errors. [I have done this with an char type or int type, I mean I have defined a global char or int variable, and I had no problem but when I want to define a class type variable I encounter trouble.] Where I made a mistake:confused: thanks :)
modified on Saturday, August 30, 2008 4:13 AM