|
Not in a loop. I am updating only 1 time.
But i am doing from a thread.
I have dialog class pointer in thread class. From thread call i call a function of dialog class and pass string in that function which update data on static control.
dialog class function is like
dialogclass::func(TCHAR *str)
{
Staticstr = str;
UpdateData(FALSE);
}
where Staticstr is of cstring type and used for static control
|
|
|
|
|
MKC002 wrote: But i am doing from a thread.
Very bad idea to do that.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Then which way i should select to display text on dialog
I am using thread to do some backend work which takes time and i need to update information on dialog so that user should be able to know what's going on
modified on Monday, October 18, 2010 5:59 AM
|
|
|
|
|
MKC002 wrote: Then which way i should select to display text on dialog...
Post a message from the secondary thread to the primary thread (the one that owns the UI).
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi,
How to get file creation date and time?
|
|
|
|
|
BOOL GetFileTime(
HANDLE hFile, // handle to file
LPFILETIME lpCreationTime, // creation time
LPFILETIME lpLastAccessTime, // last access time
LPFILETIME lpLastWriteTime // last write time
);
|
|
|
|
|
Please put your code within <pre></pre> tags as noted in the guidelines.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
GetFileTime function.
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]
|
|
|
|
|
Tis a real pity how people don't have MSDN or know how to google. But thanks to you they can breathe a sigh of relief...once again the day is saved....thanks to...CPallini
|
|
|
|
|
Yes, CPallini is a bot forwarding to Google...
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]
|
|
|
|
|
|
I got the value in WIN32_FILE_ATTRIBUTE_DATA structure then how to format time like ""13/10/2010 2:51 PM"
code is
GET_FILEEX_INFO_LEVELS fiid;
WIN32_FILE_ATTRIBUTE_DATA fileinfo;
::GetFileAttributesEx(m_szFilePath,fiid,&fileinfo);
|
|
|
|
|
You can do it (at least) in two ways:
- Use the FileTimeToSystemTime Function (Windows)[^]: the
SYSTEMTIME structure that you get has separate fields for day, month,year, etc. and you have only to use printf or sprintf with an appropriate format string - Use the CTime Class (ATL/MFC)[^]: one of its constructors accept a reference to a
FILETIME structure. Then use the CTime::Format (ATL/MFC)[^] method, that returns a CString formatted accordingly to the specified format string
|
|
|
|
|
Hello, guys
CMFCRibbonBaseElement::SetVisible do not work....
But, I need this function.
How to hide the CMFCRibbonBaseElement????
Any help, or suggestion on where to look for help would be appreciated.
modified on Wednesday, October 13, 2010 3:45 AM
|
|
|
|
|
I never worked with the MFC version of the ribbon bar, only with the BCG version...but with that after making changes like that you would have to call RecalcLayout on the ribbon bar instance to make your changes take effect, maybe the MFC version has that too, give it a shot.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
Hi,
Normally I can figure this stuff out, but not this one. I have just upgraded my program from VC6 to VS 2010. Quite a jump. It allows me to do things like actually debug now which is fantastic. Anyway, I have found a problem that I do not understand.
Basically there is a function (which I did not code originally) that is used to convert a hex string into a binary buffer.
ULONG util_ConvertHexStringToBin(char *pszHexString, void *pBinaryBuffer, unsigned int uiBufferSize)
{
unsigned int uiHexPairs;
unsigned int uiByteIndex;
char *pszParse = NULL;
BYTE ucTempByte;
uiHexPairs = strlen(pszHexString)/2;
pszParse = pszHexString;
uiByteIndex = 0;
while (uiByteIndex < uiBufferSize && uiByteIndex < uiHexPairs)
{
sscanf_s(pszParse, "%2x", &ucTempByte);
((BYTE *)pBinaryBuffer)[uiByteIndex] = ucTempByte;
pszParse += 2;
uiByteIndex++;
}
return uiByteIndex;
}
The problem is, as soon as sscanf_s is called, pszParse becomes invalid. I've seen other strange things too, like the uiByteIndex being reset to 0 when calling sscanf_s. I have tried sscanf as well with the same results.
The problem this is at the edge of my c++ knowledge. Its acting like the memory where these varables are stored is free and being overwritten, but this shouldn't be the case. I'm getting different results all the time with this function and this worries me a lot!
Any help, or suggestion on where to look for help would be appreciated.
|
|
|
|
|
What do you mean exactly by "pszParse becomes invalid" ? What is your program doing ?
|
|
|
|
|
It gets changed from its current location, pointing to a location in the input hex string, to another seemingly random one. In most cases this throws a access violation when it is next used, but not always.
|
|
|
|
|
If you look at the type fields documentation[^] you can see that providing 'x' means that you want to read an hexadecimal integer. The result should be stored in an integer, not in a byte. The sscanf_s is probably corrupting memory when trying to write the integer to the byte you provided. Try with to supply an integer instead (you'll need to retrieve the first byte of the integer after it but a simple cast will do it).
|
|
|
|
|
Thanks Cedric, that worked a treat. Somthing else for me to look out for in future. Thank you!
|
|
|
|
|
int CreateArray(void** data, unsigned int* size)
{
}
int main()
{
unsigned char* data = 0;
unsigned int size;
int res = CreateArray(&data, &size);
}
Is it possible to avoid void* pData in main function and pass directly data pointer?
Чесноков
|
|
|
|
|
You may perform a cast.
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]
|
|
|
|
|
CreateArray(&(void *)data) does not work.
What is the correct one?
Чесноков
|
|
|
|
|
The other one:
int res = CreateArray((void **) &data, &size);
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]
|
|
|
|
|
that one is great, thanks.
Чесноков
|
|
|
|