|
In the MSDN-documentation for the InitializeCriticalSection-function it says :
In low memory situations, InitializeCriticalSection can raise a STATUS_NO_MEMORY exception.
Now, what exactly do i have to catch here ?! Couldn't find any hint anywhere.
|
|
|
|
|
Mr.Brainley wrote: Now, what exactly do i have to catch here ?!
There's nothing to catch.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Ok, rephrasing the question : What should i do ? Current strategy : nothing. But what exactly happens in such a low memory situation ? Does it crash the program ?
|
|
|
|
|
Mr.Brainley wrote: What should i do ?
Based on what I read, nothing (can be done).
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: nothing (can be done).
you mean besides stopping an unhandled exception from closing your app?
led mike
|
|
|
|
|
led mike wrote: you mean besides stopping an unhandled exception from closing your app?
Since the exception is not raised in an exception-safe manner, I'm not sure. Don't try and catch it is the only thing I know to do.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Just a guess...
__try
{
::InitializeCriticalSection(...);
}
__except (GetExceptionCode() == STATUS_NO_MEMORY ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
{
...STATUS_NO_MEMORY exception
}
|
|
|
|
|
Hi there,
I have an application that exchanges messages (text message) between a mobile device and another appication software using socket connections (udp to the mobile device and TCP to the second application) and now I need in some circumstances send a short message to a mobile phone (cell phone) so that if the person can not access the mobile device, he can receive a text on his cell phone to go to look into the mobile device. I need to know how I can provide the connection from my application (windows base)to mobile phones using their phone numbers.
I appreciate any usefull idea.
Best regards,
nahitan
|
|
|
|
|
Onw way is to just send an e-mail to their_number@their_carrier. Other than that, is SMS an option?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
As far as i know, i think it can be done using GSM modem and AT commands.
KIRAN PINJARLA
|
|
|
|
|
Can anyone tell me what conditions would cause a call to gmtime() to crash the program?
|
|
|
|
|
SteveRubio wrote: Can anyone tell me what conditions would cause a call to gmtime() to crash the program?
When it's used incorrectly.
Seriously, if you can provide a code snippet, better help can be provided.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Fair enough
static char * yetanotherfunction(){
struct tm *newtime;
time_t ltime;
time(<ime);
newtime = gmtime(<ime);
return (asctime(newtime));
}
The commented line is where the crash occurs. And I've tried moving it around and it is the call to gmtime() that causes problems.
I'm modding a project that I've inherited and this block of code has never caused problems in previous iterations.
|
|
|
|
|
What are you doing with the return value from yetanotherfunction() ? What do you mean by "crash?"
SteveRubio wrote: ...this block of code has never caused problems in previous iterations.
That you know of. A problem may well have existed, but just never surfaced.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
assigning it to a char *, which then gets printed out to the console. At least, that's what's previously happened when the function worked.
And by crash I mean the program stops and windows says that the program has encountered a problem and needs to close. The exception code is 0xc0000005, which I beleive is an access violation, but how the block of code would cause it is beyond me.
As for the last part, fair enough. Change my statement to read "this block of code has never caused program crashes in previous iterations"
|
|
|
|
|
SteveRubio wrote: assigning it to a char *...
Assigning, or copying.
Do you call gmtime() , mktime() , or localtime() elsewhere in your code?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
char * s;
s = yetanotherfunction();
And gmtime is called many other places throughout the code.
I've been looking at some documentation and tinkering with various stuffs, and using _gmtime64() instead of gmtime() doesn't cause the error. The asctime() seems to be the one that fails when I do that.
|
|
|
|
|
SteveRubio wrote: ...using _gmtime64() instead of gmtime() doesn't cause the error.
I would be more inclined to do something like:
char s[32];
strcpy(s, yetanotherfunction()); Because _gmtime64() still shares a common, static structure.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
the strcpy thing will probably be enacted when these shennanigans with the time are figured out.
However, I figured out that rather than just crashing, _gmtime64() simply returns NULL.
|
|
|
|
|
SteveRubio wrote: However, I figured out that rather than just crashing, _gmtime64() simply returns NULL.
So what time value is being passed to it? I assume you've read this:
These functions validate their parameter. If timer is a null pointer, or if the timer value is negative, these functions invoke an invalid parameter handler, as described in Parameter Validation. If execution is allowed to continue, the functions return NULL and set errno to EINVAL.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: So what time value is being passed to it? I assume you've read this:
The result of a call to time(). Either on the time_t itself, or on 0. Either way, the results are strange.
|
|
|
|
|
Hi fellows
Someone tells me that the best way to send an object from a window to another is by serialization. How can I do this? I'm very new in this subject....
Someone have a sugggestion for me?
Thanks a lot
|
|
|
|
|
Alex Cutovoi wrote: ...send an object from a window to another...
What exactly are you wanting to send?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I have 2 windows. In these windows I have a class that I create. This class is exactly the same in both windows. I create the object and I need to send this object from one window to the another window to use it. Actually I'm using unsuccessfully WM_COPYDATA message to send the object. But this is written is MSDN:
"The data being passed must not contain pointers or other references to objects not accessible to the application receiving the data."
Because this, some data in my object are empty.
So, someone suggested me to use serialization, but I'm very very new in this topic...
|
|
|
|
|
Alex Cutovoi wrote: Actually I'm using unsuccessfully WM_COPYDATA message to send the object. But this is written is MSDN:
"The data being passed must not contain pointers or other references to objects not accessible to the application receiving the data."
Because this, some data in my object are empty.
See here and here.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|