|
Yes it stored in registry at this position.
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TypedURLs
-----------------------------
"I Think It will Work"
Formerly I AM Known As "Alok The Programer"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
But the URLs inputted in this Registry Key is Limited... I want to know how I can Log the URL of the link Clicked by the User.... tnx for the Information...
|
|
|
|
|
You'll need to look in the C:\Documents and Settings\<user id>\Local Settings\History folder.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi
Just a question on Pointer
In C++ used on embedded system, memory leak is very critical.
so i used example
LPTSTR ptrText = new _TCHAR[MAX_PATH];
when i exit, i use
if(ptrText)
{
delete[] ptrText;
ptrText = 0;
}
Just wonder if the ptrText = 0; is necessary?
Another is will the use of new and delete slow down the system?
|
|
|
|
|
IceBerG71 wrote:
Just wonder if the ptrText = 0; is necessary?
It is not necessary, however it is a good habit to do so, because if some code later tries to dereference ptrText , after the delete[] , the app will crash immediately and you will catch the bug.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
"Linux is good. It can do no wrong. It is open source so must be right. It has penguins. I want to eat your brain."
-- Paul Watson, Linux Zombie
|
|
|
|
|
Thank You. So Is There Performance Related Issue When using new & delete rather than just use the normal char declaration?
|
|
|
|
|
There is not.
When you declare normal variables, the memory they take is reserved from the stack. On mobile systems, the stack memory is extremely limited, so heap memory should be used instead. New & delete operators operate on the heap memory area.
There should be no performance hit, although reserving large quantities of memory (over 1 Mb) may cause small performance hits. So, if you need to reserve large quantities of memory, you should do that in sections whenever possible.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Anonymous wrote:
So Is There Performance Related Issue When using new & delete rather than just use the normal char declaration?
Yes. One requires help from the memory manager, while the other does not. However, the "penalty" is negligible.
It's also not uncommon for the new operator to be used incorrectly. For example:
char *name = new char[32];
lstrcpy(name, _T("David"));
m_listbox.AddString(name);
delete [] name; This is highly unnecessarily. Consider this instead:
char name[32] = _T("David");
m_listbox.AddString(name);
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I would argue that setting the pointer variable back to NULL after deleting the object is critical and highly recommended. If you do not, you are leaving a dangling reference to something that no longer exists. Once the memory is deallocated, by delete, the memory can be used for something else by another part of the program. If someone else is checking the pointer value against NULL, then the reset of the ptr to NULL will prevent a crash. My philosophy is that if the pointer doesn't point to anything then it should be null. NEVER EVER leave a pointer set to an address that is no longer pointing to a valid object. That is just asking for trouble in my mind. Of course deleting an object in the middle of program execution is tricky to begin with. There has to be an understanding between the piece of software responsible for deleting the object and the piece(s) of software using the pointer. Setting the pointer back to NULL is a simple way of establishing that understanding. If the pointer is NULL, don't use it!
//perhaps this is done in the constructor of a class and the pointer
//mlpszFilePath is a member variable of some class.
LPTSTR mlpszFilePath = NULL;
//Now in some member function you do this:
//Only build the string if it has not already been built
if(lpszFilePath == NULL)
{
mlpszFilePath = new _TCHAR chFilePath[_MAX_PATH];
}
//later you'd do this:
//Only delete the array if it has been previously allocated; perhaps in a class destructor.
if (mlpszFilePath != NULL)
{
delete[] mlpszFilePath ;
mlpszFilePath = NULL;
}
//Perhaps you have a function to get the pointer
const LPCTSTR GetPointer() const
{
return mlpszFilePath;
}
Perhaps a string is a bad example but you might have this kind of code where you have to new and delete some object that is placed in the global scope via a pointer variable that many components of an application need access to. Notice that the setup allows the same object to be reused over and over.
This type of pattern is very common and sort of applies to your other question about performance surrounding new and delete.
Yes, new and delete require system resources like any function call or calculation; but the operating system is designed to perform memory management for you so that you don't have to worry about it.
If you are only rarely using new and delete to allocate a string it's not a big deal. If you are doing it thousands of times in a second, then that could be a problem.
If the function using the string only uses the string within the block of the function, you might as well make it static or just make the string local to that scope in your program. If the string needs to continue to exist after the function completes, you have to use 'new' otherwise the string will not exist after the function call. lets say you are passing the string to another function and then the function creating the string ends. Well if you don't use new in that case, the string goes out of scope when the function creating it ends and the function you passed the pointer to is out of luck and has a dangling reference to an object that's been deallocated.
I know nothing about your application and have no idea whether to use new or delete vs. a static character array. It all depends on what you need the string for. It's totally situational. Do not be afraid to use new and delete if you have a legitimate purpose for doing so. That is why the operations exist.
|
|
|
|
|
I want to override the behaviour of WM_NCCALCSIZE and WM_NCPAINT to properly calculate the border sizes and then handle the painting of these borders for controls in my framework. So far I have it working perfectly for cases where no scroll bar is present. However if the control has the WS_HSCROLL or WS_VSCROLL style set then there are problems. In WM_NCCALCSIZE i am accounting for the presence of the scrollbar. But when the scroll bars are visible they never show up! Sometimes when I click in the right spot I can get them to appear, but the don't get redrawn correctly. Is there some other step I am missing?
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
|
While CMenu::TrackPopupMenu() is called, I wish to trap the WM_LBUTTON down and WM_LBUTTONUP messages, however CMenu doesn't have a message map. Is there a way of doing this by overriding the default menu proc? (is it called a menu proc or a window proc for a menu?) If so, how is this done?
Thanks,
Jeff
|
|
|
|
|
I tried this to create a 4-bit Bitmap, but can't draw on it once selected in to the DC:
bmp.CreateBitmap(nWidth, nHeight,1,4, NULL);
Do I need to setup a palette? If so, what are the basic steps to do that?
Thanks,
PinHead
|
|
|
|
|
Can anyone explain why DeleteColumn is not deleting all columns. If I insert say 7 columns and loop through and delete each column. It deletes only 4 columns. DeleteColumn returns false after 4. Any ideas?
Thansk
|
|
|
|
|
Are you by any chance doing
for(int i = 0; i < numColumns; ++i)
listCtrl.DeleteColumn(i); If so, think about what happens. Compare that code to
for(int i = 0; i < numColumns; ++i)
listCtrl.DeleteColumn(0);
If I assumed correctly, you will feel a big "DOH!" coming out through your mouth.
--
Ich bin Joachim von Hassel, und ich bin Pilot der Bundeswehr.
Welle: Erdball - F104-G Starfighter
|
|
|
|
|
DOH!,
It makes sense, Thanks
|
|
|
|
|
Sometimes programming just sucks, doesn't it
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
This is, by far, the strangest problem I have ever encountered.
I have an application, working on top windows media encoder. The Encoder is very heavy COM object, and so I created a separate thread for it. And here is the strange part on some machine, after the encoder starts working, if you try to move the window, everything stuck. On other machine – it’s working perfectly. P4 2.8 was stuck, while this laptop, P4 2.53 was working fine. The machines all have winxp on them. In this application I have 3 threads: the main mfc one, one thread for the socket communication and one for the encoder. I am sending user messages to the dialog window (the application is dialog based), but they are all more then user message value. How cam that it’s happen only on certain machine while others works fine? Any ideas?
TY!
|
|
|
|
|
Hmmm, it the 2.8GHz hyperthreaded?
Then it runs the program a lot like a dual-cpu computer will do it. And trust me, you will find the strangest threading errors on dual-cpu computers...
If this is the case, you might have some sort of thread deadlock in yout program.
- Anders
Money talks, but all mine ever says is "Goodbye!"
ShotKeeper, my Photo Album / Organizer Application[^]
My Photos[^]
New developersite: RealDevs.Net
|
|
|
|
|
Aragorn@Gondor wrote:
The Encoder is very heavy COM object, and so I created a separate thread for it.
Has the thread joined the apartment, or is it running in its own MTA? I wish I had the COM book by the Don Box guru with me right now. I recall reading about calls across apartment boundaries may hang. Gah, how frustrating! I can't remember the scenario in which it could occur.
But anyway, perhaps you could google for don box apartment hangs rpc. I'm sorry I couldn't be of much more help.
And yeah, you may want to post this in the COM forum. I bet it's related to COM in some way.
--
Ich bin Joachim von Hassel, und ich bin Pilot der Bundeswehr.
Welle: Erdball - F104-G Starfighter
|
|
|
|
|
Here is the code:
#pragma once
class Model
{
public:
Model(void);
~Model(void);
private:
std::vector<std::pair<AcGeLineSeg2d, double> > lines;
};
I am using Visual Studio 2003.
The main problem is that I'll add #include <utility> and instantly I have 30 or more errors. Even more fascinating, if I remove #include <utility> it still gives those same messages! It would be nice if I could get it to compile "std::vector<std::pair<AcGeLineSeg2d, double> > lines;" without an error. It gives error C2143: syntax error : missing ';' before '<'.
Thanks for your consideration,
Sean
|
|
|
|
|
Did you try to #include "vector" ?
|
|
|
|
|
Yes I had tried that- I've tried a lot of things. That works for getting rid of compile errors on that particular line, but does nothing with the xutility errors...
|
|
|
|
|
Could you please post operators definitions here if you have any?
[UPDATE]
I meant your AcGeLineSeg2d of course.
|
|
|
|
|
There aren't any operators defined.
In fact, my code is as simple as it gets. What is even weirder is that the xutility errors showed up in a new project that doesn't even use pair or even any header files, aside from #include "vector" (which should really be "class vector;", but that is something altogether different).
|
|
|
|