|
Hi,
can somebody tell me how to get the handle of edit box of a combobox in win32 environment.
Thanks
|
|
|
|
|
|
|
Thanks to both of you. My problem is solved now, after using the above mentioned function.
|
|
|
|
|
Hi all,
So far, I have had several projects in which I have used Office automation. Although this is always a pain in the #@# due to the lack of proper documentation, I have so far always succeeded. Now, I am trying the same thing, using office 2007. In itself, this looks a lot the same, but Microsoft wouldn't be Microsoft if they hadn't changed a few things here and there! Where for example the _Application used to have a GetWorkbooks method (I am now talking about excel automation), the _Application has been changed to Application, and it no longer has a GetWorkbooks method. In turn, it now has the "Workbooks" item. This item returns a VARIANT, rather than an LPDISPATH, which means that - when compiling - I get the error "no operator defined which takes a right-hand operand of type 'struct tagVARIANT'" when I use the code:
Application Excel;
Workbooks Collection;
COleVariant vOpt....;
Collection = Excel.Workbooks (vOpt);
How do I go about this? Does anyone have any suggestions? The Microsoft "documentation" of course remains silent on the subject (or at least, I have not been able to find any usefull information)
Thanks in advance,
William
|
|
|
|
|
William Engberts wrote: The Microsoft "documentation" of course remains silent on the subject
What documentation? Provide a link to the documentation you are referencing.
|
|
|
|
|
Hello All,
I want to use ffmpeg for creating FLV file in my Application.
Anybody know how to use ffmpeg library in win32 project?
Thanks in advance.
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
Hello everyone,
I think unmanaged resource means the resources (e.g. memory and file handler) which is used directly (new, FILE*) other than using a wrapper class (Resource Acquisition Is Initialization) or auto_ptr to wrap it. Is my understanding correct?
Here is a sample about what is unmanaged resource.
--------------------
http://www.gotw.ca/gotw/066.htm
Moral #3: Always perform unmanaged resource acquisition in the constructor body, never in initializer lists. In other words, either use "resource acquisition is initialization" (thereby avoiding unmanaged resources entirely) or else perform the resource acquisition in the constructor body.
--------------------
thanks in advance,
George
|
|
|
|
|
Yes, I think that's pretty much the idea.
Basically, in this context, 'unmanaged' means anything that is not destroyed/deallocated/uninitialized automatically.
In Microsoft parlançe, though, 'unmanaged' means native code, as opposed to native code. (At least that's how I understood it.)
Florin Crisan
|
|
|
|
|
George_George wrote: (thereby avoiding unmanaged resources entirely)
That is an unfortunate use of the word "unmanaged". RAII is about managing resources. This is the first person I have ever seen use the word "unmanaged" in reference to "managing resources".
The author seems to be using "unmanaged" to reference code that does not implement RAII. It seems to me that the usage is incorrect because you are always managing a resource even if you do not use an RAII approach. IMHO the word has been used improperly.
[Modification]
Ummm ok. The author is Herb Sutter so I think he can say whatever he likes. "unmanaged" is fine by me.
modified on Wednesday, January 02, 2008 3:07:20 PM
|
|
|
|
|
Hi,
I couldn't find a way to capture the events fired by the "Back" and "Forward" buttons on the mouse. I thought this would be a standard behavior by CHtmlView and should be handled automatically, but it's not.
Is there a sample somewhere I can look at?
Thanks.
|
|
|
|
|
Hello everyone,
Through myself study and previous discussion here, I share the conclusion here that,
if some object is synchronized (mutex, critical section, etc.), there is no need to add volatile keyword.
Here is the reference,
(refer to section volatile, Critical Sections, and Race Conditions)
http://www.ddj.com/cpp/184403766
if my understanding is wrong or you have any other options, please feel free to add here.
thanks in advance,
George
|
|
|
|
|
Hey George, let me understand what's your issue against the volatile keyword: Did your lineage be victim of a strange anathema?
By the way, you missed to mention (if I remember well was David Crow to point it out) that main usage of volatile is not synchronization.
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.
[my articles]
|
|
|
|
|
Hi CPallini,
1. I have no real issue of volatile in my work, my personal interest to learn it in depth.
2. I understand volatile has nothing directly with synchronization (compared with mutex, critical section, etc.), but it has relationship with sychronization, as mention in the article. If you read it, I think you should have some comments (whether my understanding is correct and whether you are agree with this article's points).
regards,
George
|
|
|
|
|
I'm not sure if you got the point, so I'm going to ramble on:
The whole idea of volatile is to tell the compiler not to cache the value. On every access, the value should be checked to see if it has been modified by another thread. The old value should not be presumed correct just because the current thread hasn't modified it.
Synchronization, on the other hand, is supposed to ensure that no thread is modifying a value while another thread is using it. You wouldn't want the state of an object to change while you are reading it.
Hope this helps.
Florin Crisan
|
|
|
|
|
Hi all,
I'm working on a dialog base application, dealing with the time zone details.
In the dialog box there is a text box to enter the time offset. Then user click the display button, on the next text box display the timezone name. If the given time offset have more than one timezone name, very first timezone name should be display.
That's my question.
I'm going to use Windows API for this. So that I want to read the timezone list. How can I do that using API with GetTimeZoneInformation()
I appreciate your help all the time...
Eranga
|
|
|
|
|
I this way is much prefer. I have a time offset and want to find the time zone name. That mean I have to read the registry. How can I do that. I'm confusing how to search whole registry of time zone in following path.
SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones
Under the 'Time Zones' I can see whole registered time zones. I want to get the required one. How can I do that. How can I search the whole Time Zones with given time offset.
I appreciate your help all the time...
Eranga
|
|
|
|
|
One step more done. Read the registry as follows.
HKEY hKey;
DWORD dwType = REG_SZ;
char buf[255];
DWORD dwBufSize = sizeof(buf);
const char* subKey = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones\\Afghanistan Standard Time";
if(RegOpenKey(HKEY_LOCAL_MACHINE, subKey, &hKey) == ERROR_SUCCESS)
{
if(RegQueryValueEx(hKey, "Display", 0, &dwType, (BYTE*)buf, &dwBufSize) == ERROR_SUCCESS)
{
AfxMessageBox(buf);
}
else
{
AfxMessageBox("Error in reading values.", MB_OK);
}
RegCloseKey(hKey);
}
else
{
AfxMessageBox("Error in reading registry.", MB_OK);
}
As you can see, this code gives the values related to the Afghanistan Standard Time. I want to iterate through the list of Time Zones.
In this way each time zone I can compare the user time offset with register values.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Eranga Thennakoon wrote: I want to iterate through the list of Time Zones.
So why not use RegEnumValue() ?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I do the enumerating as follows. How can I avoid the multiple findings. I mean, say there is more than one time zone for same time offset. In that case I want to display the very first time zone name. Used a break statement as follows. For some offsets it doesn't work.
for (i=0; i < cSubKeys; i++)
{
cbName = MAX_KEY_LENGTH;
retCode = RegEnumKeyEx(hKey, i, achKey, &cbName, NULL, NULL, NULL, &ftLastWriteTime);
char newPath[255];
sprintf(newPath, "%s\\%s", path, achKey);
printf("\n%s", newPath);
if(RegOpenKey(HKEY_LOCAL_MACHINE, newPath, &hSubKey) == ERROR_SUCCESS)
{
if(RegQueryValueEx(hSubKey, "Display", 0, &dwType, (BYTE*)buf, &dwBufSize) == ERROR_SUCCESS)
{
string strDisplay(buf);
string strSub = strDisplay.substr(4, 6);
int result;
result = strcmp(strSub.c_str(), str.c_str());
if(result == 0)
{
printf("\n%s", strDisplay.c_str());
break;
}
}
RegCloseKey(hSubKey);
}
else
{
printf("\nNo ");
}
}
I appreciate your help all the time...
Eranga
|
|
|
|
|
you wrote: For some offsets it doesn't work
which registry keys does it not work ?
|
|
|
|
|
for -09:00 it wont work. i'm expecting it for Alaskan Standard Time time zone. That is the second subkey of the Time Zones key of the registry. My code don't recognized it at all.
I appreciate your help all the time...
Eranga
|
|
|
|
|
i will use something like this:
i will store all zones into m_pszTimeZones
and after that it is easy to get information you want
.h
CStringArray m_pszTimeZones;
.cpp
void <myclassname>::TestTM
{
HKEY hKey, Key;
DWORD dwType = REG_SZ;
int iRet = 0;
CString strName, strValue, strPath, strKey;
strPath = _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones");
iRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, strPath, 0, KEY_READ, &hKey);
if (iRet != ERROR_SUCCESS)
return;
TCHAR achKey[MAX_PATH];
TCHAR achClass[MAX_PATH] = _T("");
DWORD cchClassName = MAX_PATH;
DWORD cSubKeys;
DWORD cbMaxSubKey;
DWORD cchMaxClass;
DWORD cValues;
DWORD cchMaxValue;
DWORD cbMaxValueData;
DWORD cbSecurityDescriptor;
FILETIME ftLastWriteTime;
DWORD i;
DWORD retCode;
TCHAR buffer[MAX_PATH];
DWORD dwSize = sizeof(buffer);
// Get the class name and the value count.
RegQueryInfoKey(hKey, // key handle
achClass, // buffer for class name
&cchClassName, // length of class string
NULL, // reserved
&cSubKeys, // number of subkeys
&cbMaxSubKey, // longest subkey size
&cchMaxClass, // longest class string
&cValues, // number of values for this key
&cchMaxValue, // longest value name
&cbMaxValueData, // longest value data
&cbSecurityDescriptor, // security descriptor
&ftLastWriteTime); // last write time
// Enumerate the child keys, until RegEnumKeyEx fails. Then
// get the name of each child key and copy it into the list box.
for (i = 0, retCode = ERROR_SUCCESS;retCode == ERROR_SUCCESS; i++)
{
ZeroMemory(&achKey, sizeof(achKey));
cbMaxSubKey = sizeof(achKey);
retCode = RegEnumKeyEx(hKey, i, achKey, &cbMaxSubKey, NULL, NULL, NULL, &ftLastWriteTime);
if (retCode == (DWORD)ERROR_SUCCESS)
{
strName.Format( _T("%s"), achKey);
strKey = strPath + "\\" + strName;
iRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, strKey, 0, KEY_READ, &Key);
if (iRet == ERROR_SUCCESS)
{
ZeroMemory(&buffer, sizeof(buffer));
dwSize = sizeof(buffer); //again
iRet = RegQueryValueEx(Key, _T("Display"), NULL, &dwType, (BYTE *)buffer, &dwSize);
if (iRet == ERROR_SUCCESS)
{
strValue.Format(_T("%s"), buffer);
m_pszTimeZones.Add( strValue );
}
RegCloseKey(Key);
}
}
}
RegCloseKey( hKey );
}
|
|
|
|
|
Then do the comparing with user inputs?
I appreciate your help all the time...
Eranga
|
|
|
|
|
yes...
like where strInput = "-09:00"
CString strTest;
int i;
for(i=0;i<=m_pszTimeZones.GetUpperBound();i++)
{
strTest = m_pszTimeZones.GetAt(i);
strTest = strTest.Mid(4,6);
if ( strTest == strInput)
break;
}
|
|
|
|
|