|
Anybody knows, how I can retrieve messages from other processes.
Thanks in advance,
Thomas
|
|
|
|
|
I have a database with 10000 records that populates a CListCtrl. It takes roughly 10 - 13 seconds to load. Is there a more efficient way of populating a CListCtrl?
|
|
|
|
|
Try making it a virtual list control. This means you need to respond to the LVN_GETDISPINFO message. This message is sent to your control when it needs to be repainted. A call to SetItemCountEx() tells the control how many items should be in the list. I usually load up 100 or so items at a time so that the control does not allocate anything until the user actually pages down. This is great for incremental searching, but it does mess up the scroll bar (when the user pages down enough another block of 100 items is SetItemCountEx()'d, so the scroll bar recalculates its relative position). In the OnGetDispInfoXXX callback you need to use CRecordset::SetAbsolutePosition(nListIndex) to retrieve the correct record.
Here's a snippet (LIST_BLOCK_SIZE = 100)
//==============================================================================
void CLogReviewDlg::OnGetdispinfoListLog(NMHDR* pNMHDR, LRESULT* pResult)
{
LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
LV_ITEM* pItem = &(pDispInfo)->item;
int nIndex = pItem->iItem + 1;
if (pItem->mask & LVIF_TEXT && nIndex <= m_nRecCount)
{
if (nIndex >= m_nListCount && m_nListCount != m_nRecCount)
{
m_nListCount += LIST_BLOCK_SIZE;
if (m_nListCount > m_nRecCount)
{
m_nListCount = m_nRecCount;
}
m_ctlListLog.SetItemCountEx(m_nListCount, LVSICF_NOINVALIDATEALL | LVSICF_NOSCROLL);
}
try
{
m_rsLogData.SetAbsolutePosition(nIndex);
}
catch (CDBException* pEx)
{
TRACE("Database exception %s", pEx->m_strError);
pEx->Delete();
}
switch (pItem->iSubItem)
{
case COLUMN_CATEGORY:
lstrcpy(pItem->pszText, m_rsLogData.m_Category);
break;
case COLUMN_PROCESS:
lstrcpy(pItem->pszText, m_rsLogData.m_Process);
break;
case COLUMN_INSTANCE:
wsprintf(pItem->pszText, "%d", m_rsLogData.m_Instance);
break;
case COLUMN_TIMESTAMP:
lstrcpy(pItem->pszText, m_rsLogData.m_DateTime.Format("%m/%d/%Y %H:%M:%S"));
break;
case COLUMN_MILLISEC:
wsprintf(pItem->pszText, "%d", m_rsLogData.m_Milliseconds);
break;
case COLUMN_FUNCTION:
lstrcpy(pItem->pszText, m_rsLogData.m_Function);
break;
case COLUMN_LOG_TEXT:
lstrcpy(pItem->pszText, m_rsLogData.m_LogText);
break;
default:
TRACE("Product List control column out of range %d", pItem->iSubItem);
break;
}
}
*pResult = 0;
}
Hope it helps.
|
|
|
|
|
Can u give me a little more detail on how to get it up and running.
I is hard to understand ur code.
Thank you
|
|
|
|
|
If you don't want to go with the 'virtual list' method, you can speed up
your existing list with:-
list->SetRedraw(FALSE);
... do your list population algorithm...
list->SetRedraw(TRUE);
or you could do
list->LockWindowUpdate();
... do your list population algorithm...
list->UnlockWindowUpdate();
list->Invalidate(FALSE); // not strictly necessary, but I have seen some controls
// fail to redraw correctly after this, so this will do it, use FALSE so that it
// just redraws without an erase first
Stephen Kellett
|
|
|
|
|
Hi,
We are doing a project to design a voice chat software for LAN. We are trying to do it in Visual C++. So far we have not been able to get a good start? How do we do it ? Are there any command in MFC to send sound via LAN ? If yes what are they ? Laslty would it be better to do this project in Java or Visual Basic ? Please help, Thanks.
|
|
|
|
|
hi,
Do some research on VoIP. There are some libraries available do to synchronisation and checking on lost packets. For the capturing you can use Direct Sound (there are a lot of examples with the DirectX SDK). I find the one for full-duplex the most appropriate for what you want to do.
As compression you can use windows Codecs. Real eazy, you just have to get aquainted with the way it works. I used the GSM 6.10 Codec to send over modem-internet links (only 1.6KB).
Then send and receive everything the MFC-way using async sockets.
Regards,
WimB
|
|
|
|
|
hi
where can i find the DirectX SDK. i am working on the project of voice chat over LAN. plz help me because i am not getting any help from anywhere .
WildChaser!
U r providing the best services for the students and the the people who seek help
Thanks
|
|
|
|
|
ftp.microsoft.com or http://msdn.microsoft.com/downloads/default.asp
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Hi,
We are doing a project to design a chat software for voice chat. We are trying to do it in Visual C++. So far we have not been able to get a start? How do we do it ? Are there any command in MFC to send sound via LAN ? If yes what are they ? Laslty would it be better to do this project in Java or Visual Basic ? Please help, Thanks.
|
|
|
|
|
How can I change the text color in a console-based program? Is there a 'textcolor' function like in DOS?
Thanks!
|
|
|
|
|
There are lots of great things you can do with the console api.
First you get a handle to the console:
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
This may be 0 - as long as its not INVALID_HANDLE_VALUE you're ok. Note - you'll need to #include <windows.h>
Now you can set colors. This sets white text on a red background:
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | BACKGROUND_RED);
I tested with printf, and assume cout is ok. You might like to investigate the fns like WriteConsole etc. Search for "Console functions" in the msdn. There is stuff for positioning too.
BTW I copied my own previous message on this Search this forum for 'console' for more stuff on consoles. What a great site!
|
|
|
|
|
I want to code a program which generates all possible
combinations of characters with a flexible length and
store this characters in a file.
The second part is no problem (Put the characters in a file)
but how must the algorithm look like to generates this characters ???
I mean how can I code the following scenario...
Ok lets say a want to generate words with a length up to 3 characters !!!
So the output should look like this...
a
b
c
.
.
.
z
.
.
.
a a
a b
a c
a d
.
.
.
b a
b b
b c
.
.
.
till z z z
OK ....
My first very simple idea was to make 3 for - loops
int z1,z2,z3;
for (z1=1;z1<256;z1++)
{
for (z2=1;z2<256;z2++)
{
for (z3=1;z3<256;z3++)
{
printf(" %c, %c , %c",z1,z2,z3);
}
}
}
This should work fine... but I've got no chance to make it flexible...
I mean this works only with 3 characters at run-time !!!
But I want to make an input at the beginning where you can tell how many characters
you want... in this case you can't work with for - loops ?!?!?
Did anyone of you know how this problem can be solved ???
Malcomx
|
|
|
|
|
Why not just write a routine that adds a char to the end of a string passed to it, then you'd just need to do something like this:
string s;
for (int i = 0; i< iNumOfChars; i++)
AddChar(s);
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Ooops - just thought that through. I suspect you may need to do something recursive that adds the strings to an array or prints them as it goes.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
I would like to use the IPAddress Control as provided by Microsoft in a VB Application. In VB, unlike VC, you can't just add the control to a form, it is just not in the toolbox.
I tried to create a new (subclassed) ActiveX control but I could not get things to work.
Does anyone know how to get this to work? Or can someone explain to me, why it can't be done (if so)?
Greetings,
Patrick
|
|
|
|
|
i need to get info about the controls in a window created by some other application from my application.this works fine for integer variables li but the problem comes when accessing pointer type variables.
for e.g. using SendMessage for getting the RECT values of a track bar control does not work.any clues?
|
|
|
|
|
i need to get info about the controls in a window created by some other application from my application.this works fine for integer variables li but the problem comes when accessing pointer type variables.
for e.g. using SendMessage for getting the RECT values of a track bar control does not work.any clues?
|
|
|
|
|
i need to get info about the controls in a window created by some other application from my application.this works fine for integer variables li but the problem comes when accessing pointer type variables.
for e.g. using SendMessage for getting the RECT values of a track bar control does not work.any clues?
|
|
|
|
|
Ok, so I know it is not that difficult but I can't find the correct arguement to make
a checkbox control go invisible (essentially, just need to make some of the controls on
my dialog disappear when certain conditions are met).
I retrieved the pointer to the cbutton object cbutton* mycontrol = (cbutton*)GetDlgItem(ID_Control)
thought I could use mycontrol->setbuttonstyle( ) .....but don't know which arguements.
thanks....please email straight to lrector@netzero.net
|
|
|
|
|
You're right, it's not difficult.
mycontrol->ShowWindow( SW_HIDE );
--Mike--
http://home.inreach.com/mdunn/
"That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."
--Buffy
|
|
|
|
|
|
Does anyone know if it's possible to roll my own CA and PKI for NT Workstation Security. For various reasons, I want to be able to work with signed code and SSL connections in a peer-to-peer NT Workgroup (no servers, just four workstations). I can't set up the personal web server (IIS 4.0 personal web server from the NT Option Pack) to handle https and SSL without a Verisign certificate so I would like to create and install my own CA certificate as a root trusted authority in the Trusted Computing Base.
Here's the problem: A University network allows potentially hostile users access to the local network. I want to set up four workstations as a VPN or something similar, but don't have the budget to sacrifice one computer as a server and create a domain. Thus, I would like to secure communications among the workgroup as much as possible. At the minimal level, I would like to get the computers talking to one another using https rather than http, but can't do this without spending a large fraction of my computing budget on Verisign keys.
I haven't seen anything about this anywhere in MSDN or in the magazines. Does anyone know if it's possible? If it is possible, where should I look to learn more?
He was allying himself to science, for what was science but the absence of prejudice backed by the presence of money? --- Henry James, The Golden Bowl
|
|
|
|
|
How do I get the decimal eqivalennt of a 2's complement hex number in VC++ 6.0? In other words, how can I convert FD to a -2 given that FD is a 2's compliment hex number?
Regards,
Mike Zolna
|
|
|
|
|
I'm not sure exactly what you need. A number is a number, no matter how it's stored or what base (decimal/hex) you represent it in. But if you want to go from the number 0xFD to the string "-3" (0xFD is -3, not -2) then just sprintf() it:
char szNum[16];
signed char num = (signed char) 0xFD;
sprintf( szNum, "%d", (int) num ); // cast sign-extends 0xFD to 0xFFFFFFFD
You need to use the "%d" format since that prints the value of a number. The (int) cast puts the correct number of bytes (int-sized, instead of char-sized) on the stack.
--Mike--
http://home.inreach.com/mdunn/
"That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."
--Buffy
|
|
|
|