My application uses a Flexgrid. Iam using the first row as the header. I need to insert new rows (data rows) after the first row (as the second row). Every new row inserted must become the second row and the remaining rows should get pushed down. Resetting the number of rows works but it appends a row at the end of the grid. Is there any way to achieve this? Where can I get the complete documentation on Flexgrid?
void CMSHFlexGrid::AddItem(LPCTSTR Item, const VARIANT& Index) adds a new row. If you want to add a new row after the header then just call: AddItem( Item, _variant_t((long)1) );
If you want the documentation for FlexGrid, go to Project->Add to project->Components and controls and then find the flexgrid control. Select it and then click More Info.
// Afterall, I realized that even my comment lines have bugs
is there anyway or API that helps me printing the contents of an List view control ?? , i mean here with "Printing" is to use the printer device not pronting on the screen.
if anyone can support me with articles or code will be better.
i use MFC.
I have a stl set with pointers to objects. When I insert() a reference to one of these objects in the empty set I get an access violation in the while loop of the following code:
Where can I get the actual values of the vb constants defined for an activex control which I include in a vc project (for instance vtChChartType2dXY for mschart) ?
Thanks
Two days ago I had to send out an application. At the very last minute I was asked if I could add a splash screen to it and stupid me said yes. I had never done that before in my life. I tried to add a splash screen through Components and Controls but that works only for MDI or SDI. My application is dialog based. With only 20 minutes left (I couldn't go online and search codeproject) I decided to add my own splash screen. So inside OnInitDialog I have something like this:
CSplashDlg aSplashDlg( this );
aSplashDlg.DoModal()
Not being able to send a close message to CSplashDlg I just added a thread to CSplashDlg (a CDialog based class).
Now I am afraid that this might cause race conditions. For example what if the thread is activated and then it returns before the Splash dialog is created. 5 seconds is a long time but should I be worried? I mean you never know.
// Afterall, I realized that even my comment lines have bugs
I am facing a problem in registering my COM DLL. We have build an Addin for a CAD application, which is a COM addin.
At some customer site, the addin dll is not getting registered. When we try to register using Regsvr32.exe, the exe returns an error code of 0x000000B6. The error description is "The operating system cannot run %1." when viwed with 'Error Lookup' tool.
I searched on google newsgroups and i found 1 article stating this error occurs when the ATL.dll on the target machine does not match with the ATL.dll with which the addin dll (the DLL being registered) was built. And we have to use the mindependency build to remove the ATL.dll dependency.
Accordingly i found my machine has ATL.dll with version 3.0xxx. where as the client's machine has ATL.dll 2.0xxx.I replaced the ATL.dll with the one that i had and tried to register. Still the problem persists.
Any clues on the above problem ? This is the most urgent and most important issue for us.
Did you check whether you have all the dependencies for your COM dll on the client's machine.
Also, if possible try doing the registration through some installer (like installshield). I had a similar problem, when I had previous versions of the same COM Dll on the user's machine, it went fine through a installer.
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
I need to build an application that loads a 200, 000 line
(or more) text file and lets the user interactively search
through it in memory, generating sub-lists of those 200, 000
lines with various search criteria.
I'm just wondering if it's wishful thinking to hope that
a standard list box can handle that many lines, and be
fast enough to traverse. If not, I wonder what other solutions or suggestions might there be.
Has anyone seen any applications that sound similar in
functionality to this?
All the string searching going on makes me think to use Perl,
but I don't know Perl at all. Also, I'm probably wrong, but
it's a command line only tool, isn't it?
Sounds like an excellent candidate for using a DATABASE. Like SQL Server. That's what these programs do for a living....
If you really need to do this yourself, you should probably create a series of memory structures to house the data and create indexes on the various fields. The MFC/OO approach would be to create objects similar to the following:
class CommandObj
{
public:
CString m_cCommandTime;
CString m_cCommandName;
WORD m_wParam1;
WORD m_wParam2;
WORD m_wParam3;
};
class CommandDB
{
BOOL CheckMatch(CommandObj *pCmdObj, LPCSTR cpCommand, WORD *wpParam1, WORD *wpParam2, WORD *wpParam3);
public:
CObList m_oCommands; // list of Command objects
CMapStringToOb m_oCmdNameIndex; // index of cmd name to a CObList of Command objects that have this cmd name
CMapWordToOb m_oParam1Index; // index of param1 values to a CObList of Command objects that have this valuevirtual ~CommandDB(); // clean up our listsvoid AddCommandObj(CommandObj *pCmdObj);
BOOL SearchCommands(CObList *pOutputResults, LPCSTR cpCommand, WORD *wpParam1, WORD *wpParam2, WORD *wpParam3);
};
void CommandDB::AddCommandObj(CommandObj *pCmdObj)
{
CObList *pIdxList = NULL;
// update our indexes...if (!m_oCmdNameIndex.Lookup(pCmdObj->m_cCommandName,pIdxList))
{
pIdxList = new CObList;
m_oCmdNameIndex.SetAt(pCmdObj->m_cCommandName,pIdxList);
}
pIdxList->AddTail(pCmdObj);
if (!m_oParam1Index.Lookup(pCmdObj->m_wParam1,pIdxList))
{
pIdxList = new CObList;
m_oParam1Index.SetAt(pCmdObj->m_wParam1,pIdxList);
}
pIdxList->AddTail(pCmdObj);
// and add to "table"
m_oCommands.AddTail(pCmdObj);
}
BOOL CommandDB::SearchCommands(CObList *pOutputResults, LPCSTR cpCommand, WORD *wpParam1, WORD *wpParam2, WORD *wpParam3)
{
BOOL bFound = TRUE;
CommandObj *pCmdObj;
CObList *pKeyList = NULL;
if (cpCommand != NULL && *cpCommand)
m_oCmdNameIndex.Lookup(cpCommand,pKeyList);
elseif (wpParam1 != NULL)
m_oParam1Index.Lookup(*wpParam1,pKeyList);
else
pKeyList = &m_oCommands; // table scan time...// scan keyset for matches
POSITION pPos = pKeyList->GetHeadPosition();
while (pPos)
{
pCmdObj = (CommandObj *)pKeyList->GetNext(pPos);
if (CheckMatch(pCmdObj,cpCommand,wpParam1,wpParam2,wpParam3))
{
bFound = TRUE;
pOutputResults->AddTail(pCmdObj);
}
}
return bFound;
}
BOOL CommandDB::CheckMatch(CommandObj *pCmdObj, LPCSTR cpCommand, WORD *wpParam1, WORD *wpParam2, WORD *wpParam3)
{
// you can extend this to do "like" clauses/pattern matching, etc...if (cpCommand && *cpCommand)
{
if (pCmdObj->Compare(cpCommand))
return FALSE;
}
if (wpParam1)
{
if (*wpParam1 != pCmdObj->m_wParam1)
return FALSE;
}
if (wpParam2)
{
if (*wpParam2 != pCmdObj->m_wParam2)
return FALSE;
}
if (wpParam3)
{
if (*wpParam3 != pCmdObj->m_wParam3)
return FALSE;
}
return TRUE;
}
This is like a little "hardcoded" isam file...only in memory.
Is it possible to draw several shapes directly on a window during a loop without having any flicker? I have tried to use the ValidateRect and InvalidateRect function, but I can’t seem to make them prevent flicker, maybe I am missing something. How do you prevent flicker when drawing directly on a window?
One way is to use a memory device context (search codeproject for CMemDC), which is essentially a bitmap in memory. Instead of drawing directly to the screen, you draw everything to the memory DC, and then as the last step in the drawing process, you BitBlt the memory DC onto the real DC. This means that if the same part of the DC is drawn multiple times during the drawing process, you won't see any flicker.