|
You can try some third party tools or please check the Desktop Development section. you will get lots of help in that.
|
|
|
|
|
You don't need any third party components (never in Windows..)
Simply use the native Win32 Graph control
|
|
|
|
|
I have two specific keys available at the following location in registry
HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\INSTALLER\USERDATA\S-1-5-18\PRODUCTS\---CLASSID----\InstallProperties\
The above path is having classid with it.
How to read this and retrieve the value.
|
|
|
|
|
Venkat KR wrote: How to read this and retrieve the value.
Maybe you can use CRegKey[^]
|
|
|
|
|
Venkat KR wrote: How to read this and retrieve the value.
Start here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
//Open the registrey and check that is it writable
lRet=RegOpenKey(HKEY_LOCAL_MACHINE, strKeyPath,hKey);
//if lRet != ERROR_SUCCESS then go to read registrey
unsigned char* lpBufferValue = new unsigned char [dwSize];
unsigned long dwType = 0;
unsigned long dwSize = 0;
lpBufferValue = new unsigned char [dwSize];
ASSERT(lpBufferValue);
lRet = RegQueryValueEx(hKey,strValueName, NULL,dwType, lpBufferValue,dwSize);
// if dwSize is not 0 then it is success
// close registrey (either success or failure )
RegCloseKey(hKey);
I hope this will work.
It's not enough to be the best, when you have capability to be great..
|
|
|
|
|
//Open the registrey and check that is it writable
lRet=RegOpenKey(HKEY_LOCAL_MACHINE, strKeyPath,hKey);
//if lRet != ERROR_SUCCESS then go to read registrey
unsigned char* lpBufferValue = new unsigned char [dwSize];
unsigned long dwType = 0;
unsigned long dwSize = 0;
lpBufferValue = new unsigned char [dwSize];
ASSERT(lpBufferValue);
lRet = RegQueryValueEx(hKey,strValueName, NULL,dwType, lpBufferValue,dwSize);
// if dwSize is not 0 then it is success
// close registrey (either success or failure )
RegCloseKey(hKey);
I hope this will work.
It's not enough to be the best, when you have capability to be great....
|
|
|
|
|
I am creating an app where I have CListBox object. I call .AddString() to add 10 string to the list. After the list is initialized, I want to update some of the string data in the list. How to do ? I reviewed all the class member of CListBox and I do not see any type of update string method. The only way I see to do this type of operation is to use Add/Delete methods. There must be a bette way Please help, so much time wasted on this class.
|
|
|
|
|
Perhaps your requirements call for using a ListView rather than a ListBox?
|
|
|
|
|
Hi, thank you for the reply I will look into ListView. As I found out yesterday ListBox is very good for what I am trying to do. I'm basically trying to create a window that is a comm monitor. I have 10 CAN message I receive at a very high rate 20-100ms that I want to display. With CListBox I am getting "flickering" and I know the app is probably getting tons of Window messaging !!
|
|
|
|
|
CodeMacDaddy wrote: The only way I see to do this type of operation is to use Add/Delete methods.
That's about it. Do you have an aversion to this approach?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Adding and removing items repeatedly may affect the performance of the application. You might want to use a CListCtrl[^].
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
For a small list (small number of items) the Add/Delete will work (maybe add a CWnd::LockWindowUpdate rto prevent flickering)
You could also use the list box in "virtual mode".
This signature was proudly tested on animals.
|
|
|
|
|
Hi again,
I got another one. This time regarding mutexes. I am using the following locking routine:
HANDLE Thread::Lock( const char* name )
{
wchar_t buffer[FILENAME_MAX];
mbstowcs_s( NULL, buffer, FILENAME_MAX, name, FILENAME_MAX-1 );
HANDLE hMutex = CreateMutex(NULL,
FALSE,
buffer);
if (!hMutex)
{
return NULL;
}
if (GetLastError() == ERROR_ALREADY_EXISTS)
{
}
WaitForSingleObject(hMutex, INFINITE);
return hMutex;
}
Now I found out that my locking mechanism does not work properly. And the thing is this: Thread 1 calls the Lock()-function. A Mutex is created and everything is fine. While it is locked the same thread actually (which is an error, but that´s how I found out) calls the Lock()-function again with the same name parameter. CreateMutex returns a DIFFERENT handle this time but the GetLastError query returns ERROR_ALREADY_EXISTS. But since it is a different handle WaitForSingleObject() grants access again, before the first Unlock() call occured.
So how does this work. Shouldn´t I get the same handle everytime I call CreatMutex() with the same parameters? Otherwise I get a new handle everytime and nothing is really ever locked.
Thanks again.
Souldrift
|
|
|
|
|
Souldrift wrote: But since it is a different handle WaitForSingleObject() grants access again, before the first Unlock() call occured.
Or since the handle is to the same mutex and the thread already has a lock on it the wait call does not block.
Not all synchronization objects work the same, particularly when you lock them multiple times in the same thread. There are different object because they are designed to work differently.
Also I seriously recommend one obtains a good book on multi-threading if one intends to learn the subject.
|
|
|
|
|
The main problem here is that you are returning a local variable. In addition, every time your function is called, it creates a new mutex handle (referencing the same mutex.) You are leaking handles like crazy.
To properly use a mutex you need to first create it (and you don't need to do a conversion from a char to wide string--just call CreateMutexA.) The locking is done separately.
BTW, only use mutexes if you are synchronizing between processes or you have to have multiple waits on a lock, otherwise use critical sections.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
It is not important the handle value of CreateMutex are different or same becuase the handle will never be compared its value but only be used with WaitForXXXXXX function.
Others wrote that mutex can not lock with the same thread and this implementation may cause handle leaks.
I suggest another locking mechanism using InterlockedIncrement and InterlockedDecrement like;
extern long some_locker = 0;
bool lock(long& name) {
if (1 == InterlockedIncrement(&name))
return true;
InterlockedDecrement(&name);
return false;
}
void unlock(long& name) {
InterlockedDecremtn(&name);
}
Note that this implementation dose not wait, so you must write wait loop for this for example;
while (!lock(some_locker)) Sleep(10);
unlock(some_locker);
This may not be quite your requirement, but one way of some practical technique.
|
|
|
|
|
Hi all
Can anybody tell me how to change the back ground color and text color dynamically in an edit box.
Thanks and regards
Deepu.
|
|
|
|
|
Check out WM_CTLCOLOREDIT .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
|
I noticed the explorer properties that used to show in XP for my MFC generated files are gone in Vista. I did find something about including XML file .propdesc file to include properties that I need the file to have... Any one dealt with this before?
Thanks
|
|
|
|
|
Hi, does anyone know where sources for B/B+ tree implementation can be found?
The main requirements are:
- fast access to an element by index
- fast writing to a file
|
|
|
|
|
alikalik wrote: Hi, does anyone know where sources for B/B+ tree implementation can be found?
See here[^].
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Nobody knows about, even Wikipedia [^], [^] (and you surely won't find links to C/C++ implementations at the bottom of the pages).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi
I have a MDI application. I don't want to use MDI default "ID_FILE_NEW". How can I manually implement this?
(1) What classes should I instance and create?
(2) The steps to do this?
Best regards,
|
|
|
|