|
Right, make sure you use GUIDGEN to get your GUID, though. That guarantees that it is unique.
Even if you win the rat race, you're still a rat.
|
|
|
|
|
|
I don't think, that there is a way to really hide a key in the registry. However, you can make it a hell to find and/or delete your key:
1) Create an COM-GUID like entry under HKLM/Software/Classes. That's difficult to find and only very few users will dare to delete such a key.
2) If you app runs with SYSTEM privileges (like a service) you can create the key under HKLM\Security. This key is usually even not readable by Admins (but of course, they could take ownership or run RegEdit as SYSTEM). However most users would give up here.
3) And last: The really, really, really bad trick (only an idea):
Use NT's native API to create the registry key. At the native side NT passes all character arrays as UNICODE_STRING structures. These contain a *not* 0-terminated WCHAR buffer and a field for the actual lenght of the string. Using this, it should be possible to create a registry key that contains a 0 character in the middle of its name
Even if the user is able to find this key, it would not be possible to delete it via the Win32 API calls used by RegEdit and co - you can't pass them this ugly name
--
Daniel Lohmann
http://www.losoft.de
|
|
|
|
|
I have a dialog app that calls different dialog windows from a menu.
Here is the problem: After opening a window from my menu , closing it, and then closing the application I get a memory leak detected error.
This is how I establish the dialog:
else if(PU_SELECT_ID == ID_PU_MALF_SI)
{
CMALFSIDlg *pdlg;
error pts here->>>pdlg = new CMALFSIDlg;
pdlg->Create(IDD_MALF_SI);
pdlg->ShowWindow(SW_SHOW);
}
???? So if I add a button to close this window how do I do so without having memory leaks? I've tried EndDialog() and DestroyWindow() but they don't seem to take care of the memory leak.
Thanks for any help at alL!!!!
|
|
|
|
|
the 'new' keyword allocates a chunk of memory and puts a pointer to it.. your program wont clear out this memory like regular variables when you go out of scope.. after your done with the window just call pdlg->DestroyWindow() and then delete pdlg ..
what you should prolly do instead is not use the 'new' keyword, this should do the same:
CMALFSIDlg dlg;
pdlg.Create(IDD_MALF_SI);
pdlg.ShowWindow(SW_SHOW); that way you dont alocate the memory yourself, and the memory is handled by windows, and it will free up the memory on its own..
yeah im a newbie, but im tryin!
-dz
|
|
|
|
|
I don't this approach will do any good. The reason is the dialog is created on the stack, which you stated correctly. However, since it's created on the stack it will also be destroyed when the function exits. So you'll never see the dialog.
Do a search for a lesson on multiple dialogs, but it amounts to catching the "close" messages and calling 'delete' on the right pointer. This will free the memory allocated (like you said).
|
|
|
|
|
iF you are using MFC, before the program exits, you'll go into the app's ExitInstance function. Assuming you store a pointer to this dialog in the app class (or can get at it from there), you should call this in the ExitInstance function:
<br />
delete pdlg;<br />
(Note: to be robust, you should ensure that either pdlg points to a valid dialog, or to NULL!)
Even if you win the rat race, you're still a rat.
|
|
|
|
|
In the dialog, add a handler for OnNCDestroy. Inside that, do
delete this;
This might work. It has been a while.
Tim Smith
"Programmers are always surrounded by complexity; we can not avoid it... If our basic tool, the language in which we design and code our programs, is also complicated, the language itself becomes part of the problem rather that part of the solution."
Hoare - 1980 ACM Turing Award Lecture
|
|
|
|
|
I've tried doing the deletes and destroys, but it just doesn't work. I have the pointers defind under the OnMouseBtnClick and when I go to delete VC says that it is undefined.
I'm trying to find the cleanest and most modular way to do this, am I going to have to define these pointer ahead of the menu call making them global to the rest of the code?
|
|
|
|
|
I have the handle of a window and i want to add it a menu, how can i do it, i didn`t create the window could be any, how can i add it a menu and detect when the menu is selected, is a way besides hooks?, i dont want to add the menu to all windows.
|
|
|
|
|
Hi,
I am working on FTP project and it is already pretty large and complicated. It is written in MFC. And now, I have to add support for installing/uninstalling/running/pausing/stopping NT service. (myproject->NT service). I read some articles about it in MSDN, but I still dont know how to use it. I dont know, in which of my existing functions should I call these "services API function", such as StartService, ServiceMain function, Handler and so on...Can you help me ? Thanks Standa.
Celebrate Mr. Cesilko!
|
|
|
|
|
there are a few articles here on services and how to do them ... if they dont help ive written one that might be of some use in a squeeze
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
I want to Know if are there a WebCam and a SoundBoard installed on my System ..
Anyone know a Api Function that can determine this?
Tks a lot
|
|
|
|
|
UINT waveInGetNumDevs(VOID); and capCaptureXXXX macros!
|
|
|
|
|
Hi, I am working on FTP server and I need to manage IP Access. How can I get IP address from client socket which I accepted ??
And second question: dont you have/know any reliable and tested mechanism for providing IP Access restriction (eg. IP 200.100.50.25 cant access our server between 21.8.2002 23:00 and 22.8.2002 12:30) ??? I chiefly mean the format for saving these rules and for reading them (from textfile or whatever)...
Any help will be appreciated !!! Thanks, Standa.
Celebrate Mr. Cesilko!
|
|
|
|
|
s_k wrote:
How can I get IP address from client socket which I accepted ??
With Berkeley sockets you need to pass a sockaddr_in struct to your accept() call like so:
<br />
struct sockaddr_in their_addr; <br />
<br />
<br />
<br />
sin_size = sizeof(struct sockaddr_in);<br />
new_fd = accept(sockfd, &their_addr, &sin_size);<br />
Upon connection you can read the values from the their_addr struct and get what you need.
As for your other question I personally can't answer it in the context of a forum post. I would just look at how other programs handle rules like that for guidance. It's the kind of thing you can make as complex as you want, but I would really strive for simplicity to reduce logic errors.
|
|
|
|
|
I have an ATL(3.0) project that contains a composite control. I need to trap all the events that occur when the control has focus. I though I had accomplished this and then discovered the keyboard events( WM_KEYDOWN, etc) are missing. I investigated the problem and was advised to override the pretranslateaccelerator routine from the base class. I did so but found it never gets called with the keyboard events. Any help or examples would be appreciated. If you need to re-create the problem, create an ATL project with a composite control and then try to capture pressing and key on the keyboard. thanks in advance
|
|
|
|
|
i often see people in the forum write c#, what does it mean?
is it just c or c++?
if not, what is that? what is its main usage and advantage?
thx
includeh10
|
|
|
|
|
it is a new language from MS. it's similar to C++ and Java, but is somewhat more high-level.
it's main advantage is that it works well with the new .Net stuff.
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
thx
do u know the name of its compiler and how to get it?
(i.e. Visual C++ if one of compiler of C++)
does c# close to c, c++ or java?
includeh10
|
|
|
|
|
You need Visual Studio .NET, which has a C# compiler and stuff.
Even if you win the rat race, you're still a rat.
|
|
|
|
|
why would a CListCtrl move an item without my permission? i don't have any sorting set. it's an Icon view, Auto-arrange list view and it hates me.
i do this:
lvi.iItem = 0;
int idx = GetListCtrl().InsertItem (&lvi);
TRACE("idx = %d\n", idx);
idx is, correctly, 0.
but where does the item end up? position #3.
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
Chris Losinger wrote:
i don't have any sorting set. it's an Icon view, Auto-arrange list view and it hates me.
Well, i can´t think of something that you could have missed, and if the returned index is ok, i have definitely to agree with you : it hates you
~RaGE();
|
|
|
|
|
Doesn't the icons in icon view always end up at the next free space?
Internaly it have index 0, it just looks like it is 3..??
/M
- Don't sweat the petty things, and don't pet the sweaty things.
|
|
|
|
|
yeah, that's what it seems like.
looks like i'll have to take out all the items, and insert them back, in the order i want. what a nice feature...
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|