|
I have a problem when calling a function existing in the principle dialog from another dialog in the same project.this call creates an assertion failure exception when executing the following instruction:UpdateData(true) which is necessary to send a message via a socket in the principle dialog.
please help me.
lilas23
|
|
|
|
|
Hi
The problem is concerned with expanding and collapsing the treview node.
Like I expanded c: and c: shows windows , document and settings , program files.etc.Like
c:
My Documents
Windows
Program Files
Then next time I Unexpand the C: node.
Finally Again I Expand the C: node.
It shows the following structure.
C:
My Documents
Windows
Program Files
My Document
Windows
Program Files
I mean It show duplicacy of the three nodes two times .
If i delete the sub node on openeng the C:
Please tell me the way.
I am using action == 2 function.
even then it is showing the same problem
Thanks
|
|
|
|
|
hi,all
i am a new comer to this group
While programming i got an error which is some reference error or some thing else
Anyways i will give u my doe pls help me
#include <conio.h>
#include <string.h>
#include <iostream.h>
char* rmstr(char *whstr, char *strm)
{
char *ptr,*rem;
char temp[20];
clrscr();
int k=0;
do
{
ptr=strstr(whstr,strm);
if (ptr==NULL)
{
break;
}
for (int i=0;i
|
|
|
|
|
Would you mind posting it again? But this time please check "Ignore HTML tags in this message (good for code snippets)" because the code you've posted is currently incomplete.
for instance:
>> for (int i=0;i{
>> temp[k++]=whstr[i];
>> }
btw. The line below is probably causing your trouble.
strcpy(rem,whstr);
The rem pointer has not been initialized before or to be more precise you haven't allocated any memory, even though you're applying strcpy on it.
cheers Tobias
|
|
|
|
|
oh........
thanks for this valuable help
its get ok when i initialised it as u suggest
thanks thanks thanks a lot
shamnar
|
|
|
|
|
sir
this time i met with another problem.
that is
if my input to the fn is "thisa" "is" then i am getting o/p "thisa" instead of "tha"
please help me.
now i am sending the code along with this mail
#include <conio.h>
#include <stdio.h>
#include <string.h>
char* rmstr(char *whstr, char *strm)
{
char *ptr,*rem="";
char temp[10];
clrscr();
int k=0;
do
{
ptr=strstr(whstr,strm);
if (ptr==NULL)
{
break;
}
for (int i=0;i<ptr-whstr;i++)
{
temp[k++]=whstr[i];
}
ptr=ptr+strlen(strm);
strcpy(rem,whstr);
rem=rem+strlen(strm);
strcpy(whstr,ptr);
}while(1);
temp[k]='\0';
strcat(temp,rem);
return(temp);
}
void main()
{
char *temp;
stcpy(temp,rmstr("thisa","is"));
cout<<temp;
}
shamnar
|
|
|
|
|
Hi,
as I said before, look at your memory allocation.
// this won't work unless you initialize *temp
char *temp;
stcpy(temp,rmstr("thisa","is"));
// for instance
char *temp = new char(256);
strcpy(temp,rmstr("thisa","is"));
Oh, and by the way this won't work either:
char *ptr,*rem=""
you have initialized that rem pointer, but with a reference to an empty string. As long as there is no memory assigned to it strcpy(rem,whstr); will fail. In addition I would really recommend you to have a look into a C/C++ tutorial, because this knowledge is essential.
regards Tobias
-- modified at 2:06 Monday 27th March, 2006
|
|
|
|
|
could you send me a function which accepts two strings as i/p and returns another string which doesnt contain the second string in first string
for eg if i call like this
rmstr("this","is")
it should return "th"
sir please dont use std::string because my compiler is not supporting it
anyways thanks for ur valuable help, let me acknowledge for ur kindness to spend time for this.
shamnar
|
|
|
|
|
Shamnar,
let me guess, that is your homework??? I mean it is a little obvious if you say that you cant use std::string due to your compiler. Well it might be or not, however those pointer stuff is essential. I do understand that it is quite weird stuff but it won't get you far if don't how to deal with it.
However, i've just programmed that function. But to make it not too easy i have removed some parts from it.
char* rmstr(char* searchstring, char* morphem)
{
char* tmp;
char* resultstring = new char(strlen(searchstring));
*resultstring = '\0';
while( ( tmp = strstr(searchstring, morphem)) )
{
int len ...;
char* result = new ...;
strncpy(...);
searchstring = (...);
*(result+len) = '\0';
strcat(...);
}
return resultstring;
}
Tobias
|
|
|
|
|
finaly i did it.
thanks for ur advices and clues u have given to me.
but i made one more instruction. i am sending it along with this
char* rmstr(char* searchstring, char* morphem)
{
char* tmp;
char* resultstring = (char *) malloc(strlen(searchstring));
*resultstring = '\0';
while( ( tmp = strstr(searchstring, morphem))!='\0')// )
{
int len=strlen(searchstring)-strlen(tmp); //...;
char* result = (char *) malloc(len);//...;
strncpy(result,searchstring,len);//...);
searchstring = tmp+strlen(morphem);//(...);
*(result+len) = '\0';
strcat(resultstring,result);//...);
free (result);
}
if (searchstring!='\0')
strcat(resultstring,searchstring);
free (resultstring);
return resultstring;
}
thanks for make me to study pointers.
shamnar
|
|
|
|
|
Is there any way in a nested class to access non-static members from the current instance of the enclosing class? ex.
class outer<br />
{<br />
public:<br />
int m_value;<br />
int m_value2<br />
<br />
class inner<br />
{<br />
int getAccess()<br />
{<br />
return (??)m_value;<br />
}<br />
}<br />
}<br /> Thanks
Doug
|
|
|
|
|
Make that...
__gc class outer<br />
{<br />
public:<br />
int m_value;<br />
int m_value2<br />
<br />
__gc class inner<br />
{<br />
int getAccess()<br />
{<br />
return (??)m_value;<br />
}<br />
}<br />
}<br /> ...forgot the managed qualifiers...
|
|
|
|
|
Hi Douglas,
I don't know exactly if this helps but I'll give it a try. Basically i have just converted the C# example of nested classes into C++/CLI. It seems to me that this is a way to get it working (it actually did work):
public ref class Container
{
public:
Container(void);
private:
int m_value;
public:
void SetValue(int pVal)
{
m_value = pVal;
}
public:
ref class InnerClass
{
private:
Container^ m_parent;
public:
InnerClass(void) {};
InnerClass(Container^ parent)
{
m_parent = parent;
}
public:
int getAccess()
{
return m_parent->m_value;
}
};
};
Container^ outer = gcnew Container();
Container::InnerClass^ nested = gcnew Container::InnerClass(outer);
Console::WriteLine(nested->getAccess()); // prints 4
outer->SetValue(5);
Console::WriteLine(nested->getAccess()); // prints 5
hope this helps,
best regards Tobias
|
|
|
|
|
Yeah, that's what I ended up doing. I wonder if there's a cleaner way, though...
|
|
|
|
|
|
Hi, I'm just starting to write my first application in C++ .NET with Windows Forms. Needing a vertical ProgressBar, I downloaded from CodeProject the ExtendedDotNET library, which features a nice looking ProgressBar written in C#. I correctly installed it in my toolbox and placed it on my Form, but when compiling my (C++) application I get a lot of errors, these are the very first ones:
error C3699: '^' : cannot use this indirection on type 'System::Drawing::Font'<br />
compiler replacing '^' with '*' to continue parsing<br />
This diagnostic occurred while importing type 'ExtendedDotNET::Controls::Progress::ProgressBar ' from assembly 'ExtendedDotNET.Controls, Version=1.0.2125.33876, Culture=neutral, PublicKeyToken=null'.<br />
<br />
error C3699: '^' : cannot use this indirection on type 'System::ComponentModel::Container'<br />
compiler replacing '^' with '*' to continue parsing<br />
This diagnostic occurred while importing type 'ExtendedDotNET::Controls::Progress::ProgressBar ' from assembly 'ExtendedDotNET.Controls, Version=1.0.2125.33876, Culture=neutral, PublicKeyToken=null'.<br />
<br />
error C2079: 'ExtendedDotNET::Controls::Progress::ProgressBar::m_EdgeColor' uses undefined class 'System::Drawing::Color'<br />
This diagnostic occurred while importing type 'ExtendedDotNET::Controls::Progress::ProgressBar ' from assembly 'ExtendedDotNET.Controls, Version=1.0.2125.33876, Culture=neutral, PublicKeyToken=null'.<br />
<br />
error C2664: 'void System::Windows::Forms::TableLayoutControlCollection::Add(System::Windows::Forms::Control ^,int,int)' : cannot convert parameter 1 from 'ExtendedDotNET::Controls::Progress::ProgressBar ^' to 'System::Windows::Forms::Control ^'<br />
No user-defined-conversion operator available, or<br />
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Now my question is: can I really use a DLL containing a WindowsForms control written in C# in a C++ application?
|
|
|
|
|
I recompiled the sources ot the library instead of using the published DLL, and now it works! For some reason, VS2005 doesn't like the DLL made by VS2003... so, it's not an issue of using C# controls in C++ (maybe this topic can be removed from here, I also posted in the article's comments)
|
|
|
|
|
The difference between both is:
VS2003 uses the .NET Runtime version 1.1, whereas VS2005 uses the .NET Runtime version 2.0.
Its not exactly 100% compatible. But, as you noticed, adapting and recompiling will work most of the times. I daresay, you will get 99% of all .NET assemblies to compile with no or minor adjustements.
OK, maybe more like 90%.
75 to 90.
50ish.
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
I want to add desktop node in treeview and further want to add the My Computer , Recycle Bin , My Documents etc in the Desktop node .For that I think SHGETDESKTOPFOLDER function should be used. I searched it's implementation in online MSDN . But no help given.
Please help me.
Thank You.
Pankaj Garg
|
|
|
|
|
hi,
When i try to build the VC++6.O workspace in VC++.NET environment iam getting the following linker error
LNK1104 : "Cannot open file msvcirt.lib"
I have tried in the NODefault option also. It didn't worked out.
Please help me in this context.
Thanks and regargds,
LaksshmiNarasiman
|
|
|
|
|
the error is explicit enough i find :
you are calling some functions in your progam than are located in msvcirt.dll, but the compiler needs the .lib to link to the functions. verify in the project settings the lib path...
|
|
|
|
|
As of my knowlegdge msvcirt.dll belongs to VC++ or microsoft library. But i don't know the path for the msvcirt.lib. I searched completely in .NET installation folder. But i couldn't able to locate.
I reckon the same linker error is posted by some body in some websites. Still they are also waiting for a solution.
I have converted many projects from VC++ to VC++.net solution. Only iam facing the problem in a particular workspace.
The project is a Multhreaded Dll which includes 2 libraries.
Please let me know if you can able to fix this problem.
Advance thanks and regards,
LaksshmiNarasiman
|
|
|
|
|
I have a simple application in VC6.0 and ported it to .NET 2003.
I set "Use Managed Extensions" to Yes from the Project Properties->Configuration Properties->General because am using #using <mscorlib.dll>.
i get the foll error
Command line error D2016 : '/RTC1' and '/clr:initialappdomain' command-line
options are incompatible
i saw a lot of articles on this which suggested to do the foll to solve this error: i.e.
Open the project's Property Pages dialog box. For details, see Setting Visual C++ Project Properties.
Click the C/C++ folder.
Click the Code Generation property page.
Modify one or both of the following properties: Basic Runtime Checks or Smaller Type Check
i tried changing options under Basic Runtime Checks but to no avail?
i still get the error?
How can I solve this command line error?
Pls help!
Sincerely
Giftsana
|
|
|
|
|
I do have following structure in VC++
struct Employee
{
int a;
char b;
float c;
};
i need to obtain the size of the above struct.
While using sizeof operator will it return the byte size(in this case 9) or padding will also be taken into account.
if so how the size can be obtained without padding
Thanks
sanggetha
|
|
|
|
|
The Almighty MSDN says:
"When the sizeof operator is applied to a class, struct, or union type, the result is the number of bytes in an object of that type, plus any padding added to align members on word boundaries."
If I am not wrong sizeof should return in your case:
10 bytes, because a word is 2 byte. But it might be even more, depending on your system and how the padding is done.
int = 4 bytes
char = 1 byte
float = 4 bytes
total = 9 bytes + padding to word boundaries (1 byte here)
Tobias
|
|
|
|