|
VonHagNDaz wrote: Channel is an int and is set to zero at the start of the loop,
That's obvious from your code snippet. I was asking about NumberOfChannels .
VonHagNDaz wrote: ...out is an unsigned char*...
But what is its size? If it has not been initialized, memset() should fail if OutLen is anything other than 0 or 1.
VonHagNDaz wrote: Outlen is and unsigned int.
But what is its value at the time of memset() ?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
man, im sorry i keep making you ask me twice, i dont know where my head is at this morning.
NumberOfChannels is an int. both NumberOfChannels and Outlen are set outside by the calling class, and not altered with in this class.
I win because I have the most fun in life...
|
|
|
|
|
VonHagNDaz wrote: NumberOfChannels is an int.
Ok, but you still have not indicated their respective values prior to being used. Can you not just set a breakpoint on the for and memset() statements and look at their values in the watch window?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
there values are NumberOfChannels 4 and OutLen 2692. its just randomly that Channel = -1. Sometimes everything works out and Channel never goes to -1, and it never goes to -1 at the same iteration through the loop. It crashes either randomly, or not at all.
I win because I have the most fun in life...
|
|
|
|
|
VonHagNDaz wrote: ...and OutLen 2692.
So does Out have enough room for 2692 characters?
VonHagNDaz wrote: its just randomly that Channel = -1.
Computers never do anything at random. They do exactly what they were instructed to do.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: They do exactly what they were instructed to do
You have to use the good ole fashion "tool blame" to keep a small amount of sanity.
Yes, it is being allocated the proper space. A coworker has suggested that it might be a memory error where something is writing to that chunk and skewing the number?
I win because I have the most fun in life...
|
|
|
|
|
VonHagNDaz wrote: A coworker has suggested that it might be a memory error where something is writing to that chunk and skewing the number?
That's what I've been tring to get at for several posts now, but without having any actual numbers, could not be for sure.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
is there some slick way to see whats going on? ive tried watching that address with the memory view part of the debugger, but it doesnt show where anything is writing to that address.
I win because I have the most fun in life...
|
|
|
|
|
Set a breakpoint on any of the statements within the for loop. Add Channel to the watch window. Go through the for loop using F5. Watch Channel at each iteration. Hopefully you'll see it change to -1.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I appreciate the help, and im glad you havent just gotten fed up with me, but this loop is called per channel per scanline, so its simply not possible to watch Channel on every iteration. Since this error is not repeatable in the same spot every time, im fairly sure that im just screwed. Thank you for all the suggestions.
I win because I have the most fun in life...
|
|
|
|
|
Have you considered:
for (int Channel = 0; Channel < NumberOfChannels; Channel++)
{
if (-1 == Channel)
;
Dat = (unsigned char*)m_Dither.Dat[Channel];
Out = (unsigned char*)lpDithered->Data[Channel];
ChannelData = &(lpDthrCtrl->Data[Channel]);
...
}
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
all right! i finally got it! let me explain a little bit more about this problem. im working with my company's legacy code, and im not allowed to change it because "it works."
what im supposed to be doing is writing an interface to this class. so i tracked the problem down, and it was a call to CoTaskMemAlloc(1024)...
why the did they hard code this, and why cant i change it?
so basically what i had to do was cut out the call to that function and manually reset all the memory calls to the proper sizes from the interface.
i imagine this wasnt a problem when they were processing small images, but now they're using huge digital photo quality images, im tempted to tell my boss whats up, but then ill probably hear an ear full for working around their class that "just works."
thanks for the help man.
I win because I have the most fun in life...
|
|
|
|
|
So exactly how did allocating 1024 bytes, rather than some larger number, mess up what you were doing?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
it knew it was supposed to be accessing that memory, but it wasnt allocated properly, so it was overwriting into memory set aside for Channel and LengthInBytes. We (my cube mate, and i) stuck a whole bunch of _Asserts everywhere, and Channel never equaled -1, but as soon as the it set Out = (unsigned char*)lpDithered->Data[Channel]; Channel and LengthInBytes lost their value.
I win because I have the most fun in life...
|
|
|
|
|
Hi,
I created a win32 dll and I want use InvokeHelper function in it,but when i include that function it is giving error as "Undeclared Identifier",
So I tried to include it's header file AFXWIN.H,but it is not taking in it.
What i need to do to use InvokeHelper function???
Please help me with your suggestions,
Thank you
Siddharth
|
|
|
|
|
What's your context?
The docs say that InvokeHelper is part of the COleDispatchDriver and CWnd classes, thus when you call InvokeHelper() you're really calling ::InvokeHelper() , which doesn't exist in the global namespace.
|
|
|
|
|
Hi!
I wonder!!!!!!,
In my application I have set Tab property true. It's not working. I have used IDD_DIALOGBAR.
I am using win32 in .NET Environment.
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
what is the question ?
are you obliged to start a new thread each time you need to post something about that topic ? can't you just follow the same discussion ?
|
|
|
|
|
toxcct wrote: are you obliged to start a new thread each time you need to post something about that topic ? can't you just follow the same discussion ?
Sorry !
I will follow it.
The question is that I have used new dialog from the resource IDD_DIALOGBAR ,Now This window is set as my child window in my application.I have used some edittext box and set it's tabstop property true. But its not working .Is there any mistake I have made ? Please is their? then let me know so I can remove it
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
You are still very much unclear. Do you mean to say that the edit control never receives focus when you navigate through controls with the tab key?
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
so then what should I do to navigate through controls with tab key?How can I set focus.
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
I think I get your question now. Have you set the tab order in design time?
Layout menu->Tab Order
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
Yes.
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
Is the edit control too included in the tab order list?
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
In my Dialog I have 8 textbox all are in tab order.
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|