|
You shouldn't use HKLM unless your app can run elevated all the time (as mentioned by Mr Chen).
The proper place to put common app data is in the common app data folder provided by the OS,
as described in the Designed for Windows XP Application Specification[^] Section 1, chapter 3.0.
Note the actual folder pathnames have changed in Vista, but the way you get the folder pathnames
programmatically is the same as described in the document.
Windows versions through XP let us get away with using the HKLM key in the registry....no more in Vista.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark,
Thanks for your reply.
Currently None of my apps write anything to the registry. They use ini files, accessed by an ini file reader, written by me, and accessing ini files also written by me. The software was used under my control to run our businesses. Sofar, Licence issues where not a problem, because I held the only CD in existence. The software was written purely as an indoor aid to our business.
We are now trying to market the software as such, and in order to provide for secure licencing, we have come to the conclusion that a variety of parameters should be stored in the registry rather than in ini files. All I have done sofar has been verified to work from XP down to win95.
The software before attempting to converting to the registry runs successfully and efficiently on machines from win95 upwards. I do not want to loose that compatibility either.
The NT hardware outlay is that All machines run as 'No Administrator Assigned' level. All Machines run my software exclusively, (like a sales terminal in a supermarket) and all Software settings are machine settings. Any form of User customising MUST BE ABSOLUTELY OUTLAWED!!.
Under XP this can be achieved successfully by storing things under HKLM\Software\MySoftware. By reports, Vista would defy this for it's re-directing (or virtualisaton) of this key to HKCU.
So the question becomes: Where do I store System Wide Software Params in the registry in a way that they remain system wide and can be retrieved under any os from win95 to vista
Regards
Bram van Kampen
|
|
|
|
|
Hi Mark,
The thing is I want to get a Starting point to start searching on a Clients Computer on the Network. A good place to make this possible is to write things to the registry. The PC's my software would be installed to would be termed as Sales Terminals. They should be debarred from running or doing anything else but running the Sales Terminal Software. In otherwords, it is a requirement that my software takes over the hardware, and allows no one else near it.
Unbridled Access to HKLM is just one minor step in this game.
The Target Machine is not a machine in an office suite where various sales reps can do their own thing in their own time, this is a machine sitting on a Sales counter, guarding a Cash Drawer. I need exclude the Possibility that at some stage someone may logon differently and use the machine to say write a letter to his aunty. It is a Sales Terminal, Any Other attempted activity Must be Totally and absolutely Barred.
In Other words, I want to configure this machine as one that can do only One Singular Task, i.e. Being a Cash Register. I also need ways on this machine to search, and to have Search Hints in the registry at a Predictable Place,independent of whom managed to log on, i.e. HKLM
Is it possible under Vista to do this, or should I go for an alternative OS.
Bram van Kampen
|
|
|
|
|
|
Cool! Given your requirements in your last post (about the type of software), that could
be a good solution.
Thanks for the link and update!
MArk
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
given a class heirarch where
A is the base class and B , C are derived classes .
Now I want to implement something like an object factory externally where I want to automatically create an object of the appropriate type . For this I define a struct with the definition ( pardon me for the pseudo code as part of the problem is with usage)
typedef struct
{
int code ;
reference_to_type_creator ;
}OBJ_TYPE ;
OBJ_TYPE objTable[] =
{ objA_code , < reference to create an object of type A > } ,
{ objB_code , < reference to create an object of type B > } ,
{ objC_code , < reference to create an object of type C > } ,
{ -1 , NULL } such that I can use this table in a function that processes random object entries
ProcessObject( int objCode )
{
for (int i=0;objTable[i].code!=-1;i++)
{
if( objCode == objTable[i].code)
{
A *a = objTable[i].reference_to_type_creator
a->Foo()
}
}
} I was unclear as to how this reference would be specified in the struct array above and its usage.
Help is appreciated
}
Engineering is the effort !
|
|
|
|
|
i'd just do it with a switch
ProcessObject( int objCode )
{
A* a = NULL;
switch (objCode)
{
case 0:
a = new whatever0;
break;
case 1:
a = new whatever1;
break;
etc..
}
a->Foo();
}
otherwise, maybe you could add static Create methods to your object types, and put refs to those in your array (off the top of my head):
class whatever0 : public A
{
static public whatever0 * Create()
{
return new whatever0();
}
...
};
class whatever1 : public A
{
static public whatever1 * Create()
{
return new whatever1();
}
...
};
...
OBJ_TYPE objTable[] =
{
{0, whatever0::Create},
{1, whatever1::Create},
};
... where OBJ_TYPE is a struct with an int and a function pointer that returns an A*
you'd need the static Create functions because you can't do function pointers to non-static member classes.
|
|
|
|
|
I'm building an App. I have a Doialog Box containing a Progress Bar to show the progress of the longer operations. If I switch between the App window and other open window, during such a long operation, the contents of my App window become corrupted, dispite the fact that the App works correct. Only the Progress Bar is shown when is updated with the SetPos() function.
How to prevent the window from loosing his "face" ?
In VC++6 please...
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
RomTibi wrote: I have a Doialog Box containing a Progress Bar to show the progress of the longer operations.
What article or tutorial / example did you follow to do that?
led mike
|
|
|
|
|
No such source. I tryed to use MSDN
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
RomTibi wrote: No such source.
That's garbage those samples have been around like forever on MSDN and are probably available during installation of Visual Studio.
RomTibi wrote: I tryed to use MSDN
You need to try harder[^].
led mike
|
|
|
|
|
...IT IS TO WORK ...
Thanks!
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
A small problem: following the link you provided I didn't find how to download the "Fire" example.
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
Yes I see that now. It appears they have abandoned FIRE sample in later versions of MSDN documentation. If you go to the Documentation for CProgressBar for VS2005 version there is a link to a new sample of using the CProgressBar. Learn to use the MSDN documentation, doing so will save you much time.
led mike
|
|
|
|
|
I found it, thanks to you
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
You have two options:
1. Run your "longer operation" in a separate thread
2. Handle the messages for your dialog "manually" so Windows can re-draw your dialog and controls, see below
I sometimes use a macro that processes messages and place it in functions that usually take a long time to complete (in a for or while loop):
#define PUMP_MESSAGES {MSG Msg; while(::PeekMessage(&Msg,NULL,0,0,PM_REMOVE) != 0) {::TranslateMessage(&Msg); ::DispatchMessage(&Msg);}}
You don't want to call it too often, just about enough so your app remains responsive.
Example:
for (i = 0; i <= 999; i++)
{
PUMP_MESSAGES
...
...
}
|
|
|
|
|
Thanks!
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
Hi,
I had the same problem last year, and decided to use a dedicated Progress Dialog. You can find a simple but verry effective SDK type implementation at <a href="<a href="http://www.geocities.com/krishnapg/UPDialog.html">www.geocities.com/krishnapg/UPDialog.html</a><ahref="http://www.geocities.com/krishnapg/UPDialog.html" target="_blank" title="New Window">^</a>]"></a>
Hope you find this Useful,
Regards,
Bram van Kampen
|
|
|
|
|
Thanks! I'll study the sources...
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
|
Thanks!:rose:
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
I know there is a name for taking an "extended word" and converting it to a "base word". An example extended word is "taking". The base word for "taking" is "take". Or "steaks" becomes "steak". I'm pretty sure I've seen the name for the particular algorithm that does that somewhere along the line. The only thing I can think of is Soundex/Metaphone and those are for phonetic purposes not reduction purposes.
modified on Thursday, February 28, 2008 5:07 PM
|
|
|
|
|
|
Thank you. Now I just have to find a "Word to Lexeme" English dictionary (or maybe "Word to Lemma to Lexeme" dictionaries or something similar).
|
|
|
|
|
I have a MFC serveur and a MFC client which work fine in most cases except 1 (the client and the serveur are in different Active Directory trees on the same network).
On the client I use :
m_pConnectionSocket = new CSocket();
if (m_pConnectionSocket && m_pConnectionSocket->Create())
{
if (m_pConnectionSocket->Connect(m_strLicenseServerName, TCP_PORT_3))
{
...
}
}
In the case it does not work Connect returns WSAEISCONN error which make no sense on my point of view.
Any idea ?
|
|
|
|