|
|
How about WM_WINDOWPOSCHANGED[^]?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Hai!
I have a string pointer in my MFC application, a function assigns some strings to this pointer.
Now i want to extract the strings, i do it in following manner:
CString *strArray;
...
// Function call () that assigns some strings
...
// code to extract each string from the pointer
for (i = 0; strArray [i] != ""; i ++)
{
// i am extracting each string like strArray [i]
}
but the problem is when it comes to end of the pointer, assume that there are 4 strings, when the loop checks for 5 th string(which is not present), it gives an unhandeled exception error.
when i debbugged, strArray[5] was pointing to "Bad Pointer"
How to resolve this problem.
Is there any better way to extract each string from a string pointer?
Thanks!
|
|
|
|
|
If you don't know how many strings will be stored in your array, I suggest you use a dynamic container, like a std::vector for instance. It will make your life much easier when working with a dynamic array.
If you still want to stick to your solution, then you will need an extra variable which counts the number of strings in the array (and the array should be large enough also).
|
|
|
|
|
As per Cedric's suggestions, or, surely there's an upper limit on either the number of strings strArray was defined to hold, or, this
// Function call () that assigns some strings
knows how many strings were assigned...
This being the case, why dont you run your loop to [max_elements-1], and inside the loop check if
strArray[n] == null
'g'
|
|
|
|
|
/*Function call () that assigns some strings*/
CString * GetstrArray(int len)
{
CString *re;
re=new CString[len];
//input your string
return re;
}
CString *strArray;
int len=4;
strArray=GetstrArray(len);
for(i=0;i<len&&strArray[i]!="";i++)
{
::AfxMessageBox(strArray[i]);
}
delete []strArray;
or
/*Function call () that assigns some strings*/
CString * GetstrArray(int &len)
{
CString *re;
int inlen=1;
inlen=4;//you can change the value
re=new CString[inlen];
//input your string
len=inlen;
return re;
}
CString *strArray;
int i;
int len;
strArray=GetstrArray(len);
for(i=0;i<len&&strArray[i]!="";i++)
{
::AfxMessageBox(strArray[i]);
}
delete []strArray;
modified on Friday, March 13, 2009 7:01 AM
modified on Friday, March 13, 2009 7:19 AM
|
|
|
|
|
Hi,
I have a necessary small code in OnSelectionChange() for ListCtrl. The code is needy for tests row(s) in ListCtrl - switch on/off a few controls. These tests must be doing automatically after what all selected rows are selected.
If I selected 20 rows in ListCtrl then method OnSelectionChange() is running 20 times. I don't need this.
Does exists some way so I can call OnSelectionChange() only once?
Is possible handled procedure for selection of rows? When the rows' marking is done, which function is called? - maybe I could puts tests in there...
thx for help...
|
|
|
|
|
OnSelectionChange() will be get called but you can return without doing anything if row selection count in more than 1.
-@SuDhIrKuMaR@-
|
|
|
|
|
However, I need checks selected row(s) and depending on selected row(s) enable/disable a couple buttons at form.
Does exits some function that is calling after markings row(s)?
these row(s) user selected…
for example:
ListCtrl has many rows. User marks 15 rows (by mouse/keyboard) and I need checks these rows one by one. After this, I enable/disable a few of buttons depending on selected rows…
|
|
|
|
|
Hi All,
i have one com+ service in which i am asking for IID_IXMLDOMElement interface which is giving me error
xmlIgent->QueryInterface (IID_IXMLDOMElement,(void**)&pVoid);
error which i am getting is:-
error C2065: 'IID_IXMLDOMElement' : undeclared identifier
Please can anyone tell me how to resolve this one.
Thanks A Ton
Ash_VCPP
|
|
|
|
|
Do you import the MSXML lib?
Unless you've done something else as well, the import will bring things in into a namespace (possibly MSXML2) so you need to specify this too.
Ex:
#import "C:\WINDOWS\System32\msxml3.dll"
using MSXML2;
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Hi Anshuman,
i did import msxml stuff, but i dont have any idea, i also did google but didnt find anything useful, so please tell me some way to resolve this error.
Thanks A Ton
Ash_VCPP
|
|
|
|
|
See here[^]
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Did you include the header file in which 'IID_IXMLDOMElement' is declared ?
|
|
|
|
|
Hi Cedric,
i am not sure about it, please can you tell me how i can declare it.i think i am new to this COM world so i dont know how to do this so please can u give me some idea or code...
Thanks A Ton
Ash_VCPP
|
|
|
|
|
your not importing the right version of MS-XML. Get an update to V6.
#import "msxml6.dll"
Greetings from Germany
|
|
|
|
|
i am having msxml6.tlh in my debug folder and when i again try with importing msxml6.dll it have given me errors with redefinition....
Thanks A Ton
Ash_VCPP
|
|
|
|
|
You only need to make the posted import statement.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Hi Karsten,
i tried with the import directive statement which u posted but i am getting errors with dom interfaces redefinitions....
Thanks A Ton
Ash_VCPP
|
|
|
|
|
Are you prefixing the right namespace? At times it requires you to prefix it to avoid ambiguity from other versions.
like MSXML2::IID_IXML..
Also,"Redefinition", I guess you are facing some clash with particular names. Check which one creates the clash, and you could use attributes to solve it ,something like :
#import <msxml3.dll> named_guids rename("value","xmlvalue")
</msxml3.dll>
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
|
|
|
|
|
i tried with the same but it is giving me error.....
error C2039: 'IID_IXMLDOMElement' : is not a member of 'MSXML2'
Thanks A Ton
Ash_VCPP
|
|
|
|
|
#if !defined(AFX_UTI_H_INCLUDED_)
#define AFX_UTI_H_INCLUDED_
im seeing the above error when i add the above tag in my header file....
May i know what the below lines indicate..
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
Please help me out....pls ignore my innocense...as im a beginner...
modified on Friday, March 13, 2009 4:57 AM
|
|
|
|
|
p_1960 wrote: #if !defined(AFX_UTILITY_H_INCLUDED_)
#define AFX_UTILITY_H_INCLUDED_
Well the error message says it all: you should add an #endif :
#if !defined(AFX_UTILITY_H_INCLUDED_)
#define AFX_UTILITY_H_INCLUDED_
#endif // AFX_UTILITY_H_INCLUDED_
p_1960 wrote: #ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
See [^], [^].
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]
|
|
|
|
|
when im trying to use ..
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
in my Uti.cpp file.. im able to see below errors...
1)Uti.cpp(9) : error C2628: 'Uti' followed by 'char' is illegal (did you forget a ';'?)
2)Uti.cpp(9): error C2075: 'THIS_FILE' : array initialization needs curly braces
3)CheckListBox.cpp(105): error C2664: 'AfxAssertFailedLine' : cannot convert parameter 1 from 'Uti []' to 'LPCSTR'
at CCheckListBoxlg::OnInitDialog()
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
4)Uti.cpp(28): error C2665: 'operator new[]' : none of the 5 overloads can convert parameter 2 from type 'Uti []'
at
LPTSTR lpBuffer;
lpBuffer=new TCHAR[1000];
Please help me out..
|
|
|
|
|
Where 'Uti' comes from? Please post your code (i.e. the top part of you header file).
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]
|
|
|
|