|
I have found the problem
|
|
|
|
|
Hey everyone,
I'm having a problem deleting a dynamically allocated array of strings.
I do something like this to allocate the array of strings:
.
.
.
char** arrayofstrings = new char*[stringcount];
for(int i = 0; i < stringcount; i++)
{
arrayofstrings[i] = new char[MAX_STRING];
}
.
.
.
I do something like this to delete the array of strings:
.
.
.
for(i = 0; i < stringcount; i++)
{
delete [] arrayofstrings[i];
arrayofstrings[i] = NULL;
}
delete [] arrayofstrings;
arrayofstrings = NULL;
The deletion code always crashes. I've done this before with no problem, but its early and I've got a splitting hangover(damn Thirsty Thursday) and can't seem to make sense of it.
Can anyone point me in the right direction?
Oh yeah, what's the tag to format my code in the forums?
Thanks for any help....
Josh
josh@that-guy.net
|
|
|
|
|
A bad stringcount of zero for new char*[stringcount] would cause problems. Good place for an assert, if stringcount is being passed in.
Use the <pre> tag to format code - for more info, see the C++ FAQ
|
|
|
|
|
And writing more than MAX_STRING chars to one of the strings would do it too:
int stringcount = 2;
char** arrayofstrings = new char*[stringcount];
for(int i = 0; i < stringcount; i++)
{
arrayofstrings[i] = new char[10];
}
strcpy(arrayofstrings[0], "This is entirely too many chars");
for(i = 0; i < stringcount; i++)
{
delete [] arrayofstrings[i];
arrayofstrings[i] = NULL;
}
delete [] arrayofstrings;
arrayofstrings = NULL;
|
|
|
|
|
I'm using BCB5 and I'm delay-loading a couple of DLL's which I have put copies of in both my /windows/ and /windows/system/ directories. I'm getting an error when compliling...
[Linker Error] Delay load module <name> was not found
I have the library loaded into my project. Anyone have any ideas?
|
|
|
|
|
How to remove the maximize button, minimize button and the title bar of a window from a specified window?
Thanks.
|
|
|
|
|
Remove WS_MINIMIZE, WS_CAPTION styles
Zolee
|
|
|
|
|
Thanks for your reply. But I still have a question.
Here is my source codes in a dialog based program, but it does not work.
void CTestStyleDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
this->ModifyStyle(WS_MINIMIZE,0);
CDialog::OnLButtonDown(nFlags, point);
}
I have already added the minimized button to the window before running the program. But nothing happens when clicking the left button of the mouse.
How to resolve the trouble?
Thanks again.
Maer
|
|
|
|
|
How can I get the KB articles?
Thanks.
|
|
|
|
|
It's all here:
http://search.support.microsoft.com/kb/c.asp
Josh
josh@that-guy.net
|
|
|
|
|
Thanks
Your reply helps a lot.
Maer.
|
|
|
|
|
I have designed a class for win32 (not mfc) which takes a bitmap , makes a region of it and then draws that bitmap on the window canvas.(skin stuff)
I use a memory dc to speed things up.
However when i quickly move the window it still leaves prints behind.
I don't use any own code to move the window, i intercept the NCHITTEST message and respond with return HTCAPTION;
I have tried writing my own code for WM_LBUTTONDOWN, WM_LBUTTONUP, WM_MOUSEMOVE to allow tracking and moving of the window and then use SetWindowPos to actually move the window but this sollution leaves even more trails behind. I also capture the WM_ERASEBKGND message.
Any idea on how to speed it up? The only thing i can think of is not moving the window but showing a rectangle of the new window position when people are dragging the window. I tried something like that but got into trouble. I was using a hdc that i got via ::GetDC(NULL) since i need to draw on top of everything else then but i couldn't find a good way of deleting my previous rectangle.
I have looked at other samples for skinwindows but they al seem to use the same draw stuff like i do.
Does anybody have a sample program for this or know how to speed up the drawing without leaving a trail?
Thanks.
|
|
|
|
|
I have designed a class for win32 (not mfc) which takes a bitmap , makes a region of it and then draws that bitmap on the window canvas.(skin stuff)
I use a memory dc to speed things up.
However when i quickly move the window it still leaves prints behind.
I don't use any own code to move the window, i intercept the NCHITTEST message and respond with return HTCAPTION;
I have tried writing my own code for WM_LBUTTONDOWN, WM_LBUTTONUP, WM_MOUSEMOVE to allow tracking and moving of the window and then use SetWindowPos to actually move the window but this sollution leaves even more trails behind. I also capture the WM_ERASEBKGND message.
Any idea on how to speed it up? The only thing i can think of is not moving the window but showing a rectangle of the new window position when people are dragging the window. I tried something like that but got into trouble. I was using a hdc that i got via ::GetDC(NULL) since i need to draw on top of everything else then but i couldn't find a good way of deleting my previous rectangle.
I have looked at other samples for skinwindows but they al seem to use the same draw stuff like i do.
Does anybody have a sample program for this or know how to speed up the drawing without leaving a trail?
Thanks.
|
|
|
|
|
Ever since I installed one of the Service Packs for Visual Studio 6 I have been seeing stray files in my \Windows directory. For instance, one of them there today is "fffe09cd_{EBCCC94F-1148-4B95-8DC0-6FD293E98B0C}.tmp". It seems I get these everytime I reboot and they are not deleted unless I go do it myself.
Anyone know the story and how to stop these files from clogging up my directory?
Thanks!
John Hagen
|
|
|
|
|
I wanna to change the name of network drive connected to Win2K server.
The default drive name is like this : "my folder : (f "
How can I change this network drive name?
Thanks, in advance.
Have a good day!.
|
|
|
|
|
Hi
In my project, I need my app to "wake up" once a minute. Currently, I use a timer for this. It seems that when some games is running, the app fails to wake up. Can this be cause by some for me unknown DirectX-stuff?
|
|
|
|
|
It might be because the game uses *all* of the CPU, and your app doesn't get any CPU-time to do anything...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
The problem is probably the game using DirectX's exclusive mode.
That's all I know - I don't know a better way to do it but I thought by suggesting that as a cause it might trigger someone else (or yourrself) to find a solution.
> Andrew
"Do you like my mask, it raises the dead...!"
-- Buffy (season 3, Giles)
|
|
|
|
|
My version of MSDN says
"The exclusive (full-screen) mode does not prevent other applications from allocating surfaces, nor does it exclude them from using DirectDraw or GDI"
Is this outdated?
|
|
|
|
|
I am working at tree view. My application is just like Address Book of Windows. I am using instance TV_INSERTSTRUCT to insert items in tree view. It works well in this way. I also save TV_INSERTSTRUCT instances for all items in array. After adding few items I delete all item at runtime and again inserts those item from array, which already have instance of TV_INSERTSTRUCT of previously, inserted and deleted items. But this time only first two items are inserted and all others are not shown in Tree view window. Can some body help me to solve this problem.
|
|
|
|
|
Hi everybody,
Does someone know if there is a way to present a table like a real table in a list box ?
Thank you in advance
|
|
|
|
|
I to all,
does anyone know how to use the LVS_EX_FLATSB style on a CListCtrl class?
I can display the scrollbar, but I can do anything with it : it's disabled .
Thanks to anyone. .
|
|
|
|
|
m_List.SetExtendedStyle(m_List.GetExtendedStyle()|LVS_EX_FLATSB);
Jerzy
|
|
|
|
|
I agree you solution, but my problem is that the scrollbar (when displayed) is always disabled!
Can you tell me why?
Thanks.
Massimo
|
|
|
|
|
a scroll bar in list box is disabled until it needs to be enabled, ie its enabled when there are mroe items in list box than the list box can show at one time.
|
|
|
|