|
Inside every directory there are two 'folders' with the names of '.' and '..'
Is there a common name for them like 'reparse point' or something?
The reason I ask is that I have created a macro to check for them in a FindFile loop, and IS_INVALID() doesn't really make for clear understanding.
Waldermort
|
|
|
|
|
|
I suppose IS_SHORTCUT() is better than IS_INVALID()
Waldermort
|
|
|
|
|
Or IS_DOSSHORTCUT or IS_DIRSHORTCUT or IS_SHORTCUTDIR...
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Or IS_ONEOFTHOSEANNOYINGDOSSHORTCUTSTHATADDUNDESIREDSTRINGCOMPARRISSONS()
Waldermort
|
|
|
|
|
WalderM wrote: IS_ONEOFTHOSEANNOYINGDOSSHORTCUTSTHATADDUNDESIREDSTRINGCOMPARRISSONS
Perfect! Self-commenting too!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
If you're using MFC, why not use the IsDots[^]method of the CFileFind class.
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
WalderMs there a common name for them like 'reparse point' or something?
I'm not sure if this is the answer you're looking for, but . is a pointer to the Current directory while .. is a pointer to the parent directory.
Michael Martin
Australia
"I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible."
- Mr.Prakash One Fine Saturday. 24/04/2004
|
|
|
|
|
I have a worker thread that is posting a registered message to my UI thread to add data items to a combo box. Under extreme conditions, ie. lots of data items to be added, the PostMessage call fails. My suspicion is that the PostMessage is failing because the message queue is full of unprocessed messages that the worker thread has already posted. Besides doing the following, are there any better ways of doing this.
if ( !PostMessage(m_nRegisteredWndMessage, 0, (LPARAM)pItemData) )
{
Sleep(250);
if ( !PostMessage(m_nRegisteredWndMessage, 0, (LPARAM)pItemData) )
{
TRACE1("PostMessage has failed for %s\n.", pSecurities->GetSecurityID());
}
}
Like a PostMessageButYouCanBlockMeIfTheQueueIsFull() call? Thanks.
|
|
|
|
|
According to the documentation[^] a message queue can store 10000 messsages by default (although that can be changed). If you have 100000 unprocessed messages, I would say you have a bigger problem than merely PostMessage failing
|
|
|
|
|
Thanks for the online MSDN link. I should have checked there as it's more informative than my local copy.
Under normal use there is a filter on the query that is retrieving the data that ensures that the amount of data is much less than 10000 records. However there are extreme/unusual circumstances where the user can turn off this filter and there then could be as many as 30K to 40K records returned. I'm going to experiment with the registry setting to see if that does work, but I doubt I'll use that for a solution. Most likely I'll probably change the application so that removing the filter, which is actually a date filter, will be replaced by a filter on some other data item. Thanks.
|
|
|
|
|
Bleh - Sleep()
I'd definitely recommend using a better synchronization method.
If there's potentially that much data coming in, implementing your own FIFO queue
and not posting a message for every item should work much better.
For example - At a minimum, you could synchronize access to the FIFO queue using a critical section.
The worker thread can enter the critical section, queue an item (or several items), post the message, and leave the
critical section.
When the UI thread receives the message, it enters the critical section, processes all the queued items,
flushes all remaining user messages in the thread queue, and leaves the critical section.
That's a bare minimum, and if the data comes fast enough on the worker thread, it could still fill
the UI thread message queue, but hopefully it gives you an idea to work with.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I hear ya'. Using Sleep as a synchronization method is just a poor man's way of postponing a problem.
Thanks for the FIFO queue idea, although I think I'll end up going with replacing the filter as I mentioned to Nemanja. Thanks, Mark.
|
|
|
|
|
Even better: instead of using a message to signal new data in the FIFO, setting an event will do the trick also. That avoids to have a lot of unnecessary messages in the queue.
|
|
|
|
|
True, but what's an elegant way to check if the event is signalled on the UI thread?
Modify the message loop to use MsgWaitForMultipleObjectsEx() maybe?
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
We've got a bunch of apps that need to prepare data for a machine that uses big-endian byte order. So we have a bunch of structs that look like:
struct tagFOO_COMREG
{
UINT16 ui16DataLength_BE;
UINT32 ui32SeqNum_BE;
} FOO_COMREG_s, *PFOO_COMREG_s;
where the _BE is a reminder that these values have to be byte-swapped.
So, one day I thought it would be convenient to be able to assign to one of the struct members without having to explicitly do the byte swapping. So I wrote some classes like:
class UINT16_BE
{
private:
BYTE m_abData[2];
public:
UINT16_BE(void)
{
}
UINT16_BE(UINT16 ui16)
{
m_abData[0] = static_cast<BYTE>(ui16 >> 8);
m_abData[1] = static_cast<BYTE>(ui16);
}
operator UINT16(void)
{
return ((m_abData[0] << 8) | m_abData[1]);
}
};
And it works fine. Until my co-worker comes up to me asking how to fix a compiler error he's having. He's trying to put these in a union, which doesn't work because the constructors keep it from being recognized as POD (despite the fact that the class was designed to be memcpy-able).
So, is there a way around this?
modified on Monday, February 11, 2008 2:13 PM
|
|
|
|
|
ClementsDan wrote: He's trying to put these in a union
The constructor's not going to work there...maybe something like
this will work...
class UINT16_BE
{
private:
BYTE m_abData[2];
public:
UINT16_BE &operator =(UINT16 ui16)
{
m_abData[0] = static_cast<byte>(ui16 >> 8);
m_abData[1] = static_cast<byte>(ui16);
return *this;
}
operator UINT16() const
{
return ((m_abData[0] << 8) | m_abData[1]);
}
};</byte></byte>
Mark
Last modified: 22mins after originally posted --
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
operator UINT16(void) const
led mike
|
|
|
|
|
Fixed!
|
|
|
|
|
I need to get the count of the distinct dates from the DB which has both date and time . I use the following query . it is working in MS Access , but is failing while executing through MFC . Please let me know if anything needs to be modified.
SELECT COUNT(*) AS Field1 FROM (SELECT DISTINCT Format(Date,"dd/mm/yy") FROM Table)
|
|
|
|
|
And your code is?
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
opening recordset with the sql is throwing exception
cRec.Open (AFX_DB_USE_DEFAULT_TYPE, szSql);
|
|
|
|
|
The error is " Too Few parametrs . Please specify 1 parameter
|
|
|
|
|
krishnan.s wrote: sql is throwing exception
And the exception does contain what?
A few unsorted tips from MSDN[^]
"Finally, you must not insert whitespace before the curly brace in a CALL statement or before the SELECT keyword in a SELECT statment."
"You can examine the constructed string by calling GetSQL after calling Open. For additional details about how the recordset constructs a SQL statement and selects records, see the article Recordset: How Recordsets Select Records (ODBC)."
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
krishnan.s wrote: I use the following query . it is working in MS Access
krishnan.s wrote: SELECT COUNT(*) AS Field1 FROM (SELECT DISTINCT Format(Date,"dd/mm/yy") FROM Table)
I don't see any "Format" listed in the SQL Reserved words for MS Access?
led mike
|
|
|
|