|
I am running into something of a problem when I open one too many documents with my application. The application no longer opens any dialogs such as the new or open dialog windows. I get a system ping whenever I try to open a document in VC++ if I am running under debug and windows explorer is almost completely locked. I can click folders but it quickly goes back to the folder selected therefore doing nothing. I think the CPU meter from the Windows Task Manager is peaked at 100% but I have no way of checking where in the code things seem to be hung up. The system ping sounds like an error window but there isn't an error window appearing.
Anyone have any ideas? May I be outextending the memory? I have Database ADO connections open but I have programmed them to only have the focused window have connections to the database. The other windows will close the database connections until focused.
Hopefully I have given enough info.
Thanks!
|
|
|
|
|
This looks more like resource exhaustion rather memory exhaustion; I’ve seen similar behaviour when applications create too many socket connections with dedicated threads serving such socket connections.
|
|
|
|
|
Can you elaborate a little? I'm slightly confused. Resource as in Dialogue resource? Database connection resource? There isn't any internet logic nor do I think I have coded thread logic. I'm just trying to figure out where I should be looking in my code for this issue. I stepped through and noticed that the OpenDocument method will parse through fine however when it returns from this method into whatever method called it, then it starts to act this way.
Thanks!
|
|
|
|
|
Hi all,
I am trying to write a driver for a USB device. I have taken the following steps:
> Built checked version of BulkUSB from DDK samples.
> Adapted the .inf file provided with the sample so that the vendor and product id match those of the device I'm writing the driver for.
> Installed the driver using the wizzard - this seems to work fine and the device is reported as working properly.
However, no debug messages come out of the system, no matter what I do with the device (unplug/insert/attempt to connect etc).
Can anyone see anything I may have missed?
Thanks in advance,
Simon
|
|
|
|
|
What about checking if the drivers was loaded?
Don't try it, just do it!
|
|
|
|
|
|
Where did you expect to receive debugger message? You have to have some debugging monitor. I used MONITOR (Vireo Software) before 5 years which displays of debug output from device drivers, and provides driver loading/unloading facilities for Windows 95, 98, and NT. On Windows NT, a supporting kernel mode driver (DBGMSG.SYS) captures debug output sent to DbgPrint.
Now, I think you can find something similar on www.osr.com or through a seek on internet.
|
|
|
|
|
I am strugling with how to send or recieve the SIP request and responses, I want to know how they are done in VC++.
Thank you
|
|
|
|
|
hiho@ll
i have a little problem with malloc and realloc! (i must use it! can't use new or delete)
i have a struct which holds some information of a url
struct info{
char *info1;
char *info2;
};
and i have a array of those structures:
struct info **myurlinfo;
ok now i want to dynamically allocate and expand the array with malloc, realloc.
my code:
myurlinfo=(info**)malloc(sizeof(struct info*));
and later
myurlinfo=(info**)malloc(sizeof(struct info*));
and then the array elements
myurlinfo[i]=calloc(1,sizeof(struct info));
this works 3 times and then i get a heap exception
why?
i'm sure i have an allocation bug in my code
but whats wrong?
thx@ll
|
|
|
|
|
I think you are messing up with pointers :
ThinkingPrometheus wrote:
and i have a array of those structures:
struct info **myurlinfo;
No, there you don't have an array of those structures but an array of POINTERS to these structure. Why do you want to use an array of pointers instead of an array of structure ??
You could simply do that:
struct info *myurlinfo;<br />
myurlinfo=calloc(3,sizeof(struct info));<br />
for example to allocate an array of three structures... Then to access one of these structures:
myurlinfo[0].info2 (or [1] or [2] depending of the structure you want to access to)
Notice also that the members (info1 and info2) of your structures are not initialized yet so they point to invalid memory locations. It would be easier to use fixed sized arrays:
struct info{<br />
char info1[255];<br />
char info2[255];<br />
};<br />
In this case you won't need to allocate and free the memory yourself (you need to be sure of course that the strings won't be longer than the size you provided...)
Hope this helps
|
|
|
|
|
ok
hmm
it works for the malloc,
but it doesn't for the realloc
the problem is that i don't know how big the array will be
and the reason why i used struct info **myurlinfo was that i give it to a function
which means out of my function i use struct info *myurlinfo;
and to change the array i have to use in the function struct info **myurlinfo
i try to allocate the memory first with malloc();
(*myurlinfo)=(struct urlinfo*)malloc(sizeof(struct urlinfo));
and if i need a bigger array
realloc(*myurlinfo,sizeof(struct urlinfo));
first i had
(*myurlinfo)=(struct urlinfo*)realloc(*myurlinfo,sizeof(struct urlinfo));
but realloc returns a pointer to the NEW allocated buffer
but i need to resize the array
so it must be
realloc(*myurlinfo,sizeof(struct urlinfo));
but it doesn't work
if i resize the *myurlinfo i get a memory exception
why!?
thx
|
|
|
|
|
Are you sure you don't need something like this:
struct info
{
char *info1;
char *info2;
} *myinfo;
void main( void )
{
myinfo = (struct info *) malloc(sizeof(struct info) * 100);
myinfo[0].info1 = (char *) malloc(256);
myinfo[0].info2 = (char *) malloc(256);
strcpy(myinfo[0].info1, "some text here");
strcpy(myinfo[0].info2, "some more text here");
myinfo[1].info1 = (char *) malloc(256);
myinfo[1].info2 = (char *) malloc(256);
myinfo[2].info1 = (char *) malloc(256);
myinfo[2].info2 = (char *) malloc(256);
...
myinfo[99].info1 = (char *) malloc(256);
myinfo[99].info2 = (char *) malloc(256);
}
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
well
i think i needed both
thx@ll
|
|
|
|
|
Hi,
How do I get the following info
1.Data packets in per second
2.Data packets out per second
3.Errors for receiving packets per second
4.Errors for sending packets per second
5.Collisions per second
Advace Thanks.
dadsadasd
|
|
|
|
|
|
I have created a property sheet with three property pages.
and i created a FormView?.How do i include a propert sheet into in a formview?
|
|
|
|
|
|
Hello hello,
does somebody know how to get the duration of a mpeg2 file ?
I am looking for hours on internet, there is no way to find out !
Please help, if you can ! Have a nice day,
alain
There is no way to happiness, happiness is the way !
|
|
|
|
|
i want to create program server\client
that has two client and one server
i want these clients to send message to server to gather and the server should send message to client too
|
|
|
|
|
Thats pretty simple if you use CAsyncSocket or CSocket in MFC. They have all the functions you need. If you are a total newbie, then look up for the book Sams'Teach yourself VC++ in 21 days (easily available on net for download). One of the chapter has a sample program just as you described, plus you can learn the concepts too. It can work both as a client or a server and you get to chose the option. Run this application as a server first, then again for the two clients, run the same application twice as client, I guess that should work pretty fine.
long live the dEvIL
|
|
|
|
|
|
|
Hello Friends,
In the program given, the destructor is called Explicitly
#include <iostream.h>
class A
{
public :
A()
{
cout <<"Class A:Constructor()" << endl;
}
virtual void show()
{
cout <<"in the base class" << endl;
}
~A()
{
cout <<"Class A:Destructor()" << endl;
}
};
class B : public A
{
public:
B()
{
cout <<"Class B:Constructor()" << endl;
}
void show()
{
cout <<"in the derived class" << endl;
}
~B()
{
cout <<"Class B:Destructor()" << endl;
}
};
int main(void)
{
B obj;
A obj2;
obj.~B();
obj2.~A();
return 0;
}
The program shows the destructor of the base and derived class is called two times one "Explicitly" and
"Implicitly".?
My Question is , since in the program destructor is "Explicitly" but the program output shows the destructor is called "Explicitly" and "Implicitly".
The program is given below
"
Class B:Constructor()
Class A:Constructor()
Class B:Destructor()
Class A:Destructor()
Class A:Destructor()
Class A:Destructor()
Class B:Destructor()
Class A:Destructor()
Press any key to continue
".
This program is run in VC++ IDE.
Please help if you now why this happening.
Best Regards,
Phijo
|
|
|
|
|
first of all, i've tested your application and this is the output i got:
Class A:Constructor()
Class B:Constructor()
Class A:Constructor()
Class B:Destructor()
Class A:Destructor()
Class A:Destructor()
it makes perfect sence and i shall explain by steps:
1. B obj - calls first A const. cause b inherites from A and then calls B const. therefor you get the
"Class A:Constructor()
Class B:Constructor()"
2. A obj2 - calls A const. therefor you get the
"Class A:Constructor()"
3. obj.~B(); - calls B dest. and then call A dest. (the parent) therefor you get the
"Class B:Destructor()
Class A:Destructor()"
4. obj2.~A() - calls A dest.therefor you get the
"Class A:Destructor()"
and that's that
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
you should make the destructor virtual in base class.
class A
{
public:
A() {};
virtual ~A() {};
};
class B : public A
{
public:
B() {};
virtual ~B() {};
};
The destructor should not be called directly.
It is called by C++ when the object looses scope:
int main ()
{
{
A localA;
} // ~A is called by C++ , because localA looses scope
}
A very good book about this topic is Effective C++ from Scott Meyers.
Regards,
Ralf
|
|
|
|