|
Hi,
I have a simple relatively empty sdi app generated from class wizard.
I can run it and then quit but on exit it crashes and gives.
"Debug Assertion failed", dbgheap.c Expression: pHead->nBlockUse == nBLockUse.
The only thing the program does is load 4 dlls ,
make an instance of one of them unload them and exit.
However each of the 4 dlls relies on loading one of the other dlls.
How do I track this problem down? ( I have source for all dlls )
Yes, I am using the correct dll type for debug, release multithreading etc.
DOes this mean I definately have a memory leak in one of the dlls?
|
|
|
|
|
pHead is NULL that's why you get that error. Is pHead initialized properly? Did you write that part of the code?
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
pHead is part of the MFC heap allocation code. (dbgheap.c)
I assume Im trashing it somewhere but can't isolate the possible memory leaks in the dlls.
|
|
|
|
|
The error occurs in one of these two functions; _free_dbg() and _msize_dbg(). I can't tell you much, you have to debug the program and find out the places where are you deleting pointers that you are not supposed to. If you want to find out where you have memory leaks, after you run the program in debug mode, at the output screen scroll down the end. If you have any memory leaks it will tell you where they are occuring. It seems to me like the heap is getting corrupted, but I don't know why.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
If you get this debug assert, than usually you did something wrong with memory you allocated.
Maybe you freed a block of memory twice or similar.
Jens
|
|
|
|
|
the main funtion includes parameters. how can i run the program in VC++?
|
|
|
|
|
if you mean you are running it in the Visual C++ IDE, eg with F5 or single stepping with F10/F11, you go 'Project' -> 'Settings', select the 'Debug' tab, and enter the arguments to the program in the 'Program arguments :' box...
HTH
|
|
|
|
|
thank you very much! i just need it.
|
|
|
|
|
This may seem like a weird question but here goes. Is there a way to tokenize a tokenized string? Explanation:
I have an input buffer that I am tokenizing line by line. Once I get that line I need to tokenize it 3 times to get the info on it and then go back to the original buffer and get the next line. This is what I have so far but it only tokenizes the first line of the buffer:
//This gets the first line of the buffer
char *temp_tok = strtok(m_readBuffer, "\r\n");
m_ctrlTextInA.SetWindowText(temp_tok);
******************************************
//this tokenizes the whole line
char* tokA = strtok(NULL, ",");
m_ctrlTextInA.SetWindowText(tokA);
char* tokB = strtok(NULL, ",");
m_ctrlTextInB.SetWindowText(tokB);
char* tokC = strtok(NULL, "\r\n");
m_ctrlTextInC.SetWindowText(tokC);
*****************************************
I know I need some kind of loop around the ****, but I can not figure out the parameters of that loop. once i get those 3 tokens i want to get the next line from the readbuffer and continue doing this until the readbuffer is empty
any suggestions???
|
|
|
|
|
Before you tokenize each line, use strdup to create a copy of the line and then tokenize that. strtok() doesn't work properly when you are performing nested tokenizes. You can try passing multiple characters as separater characters to strtok() , but it might be easier to duplicate the string (and free() it when you're finished).
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
help!! I'm confused...
I want to modify my VC++ application so that I can handle environment variables as such:
1) to launch my application (e.g. %MY_VAR%\bin\myapp.exe
2) as arguments to my app (e.g. %MY_VAR%\bin\myapp.exe %MY_VAR%\config\setup.dat
3) other processes launched "as threads" recognize %MY_VAR%
I have made some coding changes in my app's InitInstance() function to immediately resolve the environment variable. I do this like:
CWinApp *app = AfxGetApp();
if ((app->m_lpCmdLine, '%') != NULL)
{
// ExpandEnvironmentStrings(...), but I wrote my own
ResolveEnvVars(app->m_lpCmdLine); // resolves string in place
}
if (strchr(__targv[1], '%') != NULL)
{
ResolveEnvVars(__targv[1]);
}
// Parse command line for standard shell commands,DDE,file open -- WIZARD
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
PROBLEM -- I am having problems getting it to work, having problems using the DEBUGGER.
If I try to use the debugger while in STUDIO, it doesn't like me to supply %MY_VAR% in the arguments list. Is there a way to use %MY_VAR% format in the edit fields of the DEBUG Settings page???
Please help (aleviate my confusion).
Thanks.
Johnny
|
|
|
|
|
I can't find a way to hide the list view inside of the file open dialog. I can hide all of the controls except for that one. Does anybody know how to do it?
I've derived a class from CFileDialog, and in OnInitDialog I try to hide controls:
GetParent()->GetDlgItem(edt1)->ShowWindow(SW_HIDE);
GetParent()->GetDlgItem(lst1)->ShowWindow(SW_HIDE);
What's funny is that I can resize the list box using GetParent()->GetDlgItem(lst1).
What's even funnier is if I try to show the list control, it disappears:
GetParent()->GetDlgItem(lst1)->ShowWindow(SW_SHOW);
Thanks for helping.
Dave
|
|
|
|
|
My wife has asked me to write an app that will call her cell phone and when she picks up, "speak" a prerecorded message into it. It would be nice to detect if I get her voice mail, so I can press # and then leave the same message there.
I'm not sure how to do this. I've already prepared the message into several MP3 files on my computer. I can use C++ or C# (preferrably), but I don't know what libraries to use for making the phone conversation happen. It would also be nice if I could somehow make the call through an Internet connection, but if that's too complex, I'll settle for dialing out through my modem.
I appreciate any guidance.
Regards,
Alvaro
If you want to get to the top, prepare to kiss a lot of bottom. -- despair.com
|
|
|
|
|
This may help. Sorry always forget how to do the clickety.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tapi/tapi3/telephony_application_programming_interfaces.asp
|
|
|
|
|
This is better. Now you have me interested in doing this.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppc2k2/html/simpletapi.asp
or
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dntapi/html/msdn_ctapic.asp
|
|
|
|
|
I wrote my own programable syntax coloring text editor a while back and wish to make the editor (and document) portion into a comercial product (a.k.a. DLL, ActiveX).
The question are:
1) Should I convert it to non-MFC dependent code. (not MFCxx.dll dependency)
2) If converted should I make it use UNICODE internaly, regardless of OS, or continue the need to create UNICODE and non-UINCODE version.
Any ideas would be appriciated.
Why did I write it?
1) I needed a programable text editor for future projects that provided functionality not available any where else.
2) I wrote it because I could! It is the best way I know how to learn.
INTP
|
|
|
|
|
It depends what you are looking for. If you want a quick time to market, but high overhead cost (computer usage) then go with MFC. However, you can also choose ATL which is much leaner and write your control in that, since it is a templated library it will only compile and link the necessary code, unlike MFC which give you everything. Also if you want a smaller files size ATL would be nice, and when I say ATL you can program it in straight "C" for all that matters I just find ATL faster to write components (none of my components are commercial, all of them are for in house use only, you may wish to wait for the opinion of someone who has written a commercial project)
Also grats on writing it. To tell you honestly one of the contractors I work with just bought a text tool like this himself, I think there is a viable market for it.
Code4Food
----
"There is no try; only do or do not"
-Yoda
|
|
|
|
|
John R. Shaw wrote:
2) If converted should I make it use UNICODE internaly, regardless of OS, or continue the need to create UNICODE and non-UINCODE version.
If you use Unicode internally, you'll get heaps of problems trying to run in on Win9x. You could attempt it, but I'd probably run with two different builds. if you use TCHAR and the preprocessor, you should be able to use (almost) the same code for both builds.
John R. Shaw wrote:
1) Should I convert it to non-MFC dependent code. (not MFCxx.dll dependency)
Thats up to you, really. If it's non-MFC dependent, then both MFC and non-MFC programmers can use it. But, MFC programmers may not like it because it doesn't fit in with the Doc-View model without extra work by them - it's not a drop-in solution.
My suggestion would be to drop the MFC dependency, but create a simple MFC wrapper that makes it look like a CView - allowing everyone to use it without problems.
Ummm, just in case you're wondering, yes, I am feeling very backwards and upside-down today - shouldna drank so much last night...
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi all,
I am writing a small utitlity to run as a system tray application. I would like to be notified when a USB device of the type USB Mass Storage or Digital Camera is connected to the computer. Once my application receives this event, it will prompt the user if they want to copy the files from the device to the hard drive. Is there any sample code on how I can achieve this with my application? Many thanks in advance.
Tuan
|
|
|
|
|
Hi all, does the registry api functions refer to window messages behind the scences????
i.e - combo box function : AddString, eventually calls to CB_ADDSTRING message....
i am looking for the same for all the registry api functions such as:
RegOpenKeyEx,
WritePrivateProfileString
etc....
thanks
Yaron
|
|
|
|
|
I do not understand your question? "Do the registry APIs refer to Windows messages" makes no sense. Please explain in more detail.
|
|
|
|
|
i was just wondering how does the application regmon works (it monitors all the registery read/writes.....
can u help in explaination?
thanks
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
YaronNir wrote:
can u help in explaination?
Not as good as the authors themselves.
http://www.sysinternals.com/ntw2k/source/regmon.shtml
|
|
|
|
|
Your question is trying to compare apples and screwdrivers...
There is no Win32 SDK (*) function AddString. You are right in that you need
to use SendMessage (hWndCombo, CB_ADDSTRING, ...);. The AddString you are
thinking of is a member function of the CComboBox class in MFC which wraps the
underlying SDK for you.
RegOpenKeyEx etc are actual SDK functions in their own right.
Clear?
Iain.
(*) Which I assume you mean by API...
|
|
|
|
|
I agree with what you are saying.
i was just wondering how does the application regmon works (it monitors all the registery read/writes.....
can u help in explaination?
thanks
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|