|
You can get pixels.
if the R,G,B value are the same, It's not colored.
get and UltraEdit(or other Hex edit), open the pic...
|
|
|
|
|
Well, the BITMAPINFOHEADER struct [^] has a biBitCount field.
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]
|
|
|
|
|
How can I calculate the speed of file transfer using recv function on client?
The code a client present as below,
__int64 iFileSize=0;
__int64 iPos=0;
//Get the size of file from server
char *sizeBuff[64]={'\0'};
DWORD dwRead=recv(Socket,sizeBuff,64,0);
iFileSize=_atoi64(sizeBuff);
char readBuff[BUFFSIZE]={'\0'};
while(iPos<ifilesize)>
{
dwRead=recv(Socket,readBuff,BUFFSIZE,0);
//here write to local file
iPos+=(__int64)dwRead;
//Question here: how can I carry out the speed of reveiving? as k/s or kb/s
}
//Thanks so much and I'll appreciate it
|
|
|
|
|
What are you having trouble with?
You show the necessary calculation in your comments:
amount of data divided by elapsed time.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
//to Mark Salsbery
//I tried to calculate the speed like that:
long bClock=GetTickOut();//get the system clock before excuting the next code
dwRead=recv(Socket,readBuff,BUFFSIZE,0);
WriteFile(handle,readBuff,dwRead,&dwWritten,0);
long eClock=GetTickOut();//retrieve the system clock once again
long vClock=eClock-bClock; //carry out the variance between eClock and bClock;
long speed=(long)((double)(dwRead*1000)/(vClock*1024));
//puporsed to calculate the speed as k/s here
//But I got nothing,It always show me 0
//I wanna know why and what else other solution to solve this problem.
//Thanks a lot
|
|
|
|
|
Pearson_Bee wrote: long speed=(long)((double)(dwRead*1000)/(vClock*1024));
Shouldn't that be something more like this:
<br />
long speed = (long)(((double)dwRead / 1024.0) / ((double)vClock / 1000.0));
Also just doing it once isn't going to be informative - you're just measuring
how fast the recv() function can remove bytes from it's internal buffer.
You need to make cumulative measurements over many recv() calls.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Accumulate the speed over a period of time... for example over one second (bytes/sec):
void CSocketClient::OnReceive(int nErrorCode)
{
int nBytesRead = ::recv(&m_socket, pBuffer, nBufferLen, 0);
if(nBytesRead && nBytesRead!=SOCKET_ERROR) m_nBytesReceived += nBytesRead;
}
void CSocketClient::OnTimer()
{
m_nTransferSpeed = m_nBytesReceived;
m_nBytesReceived = 0;
}
int CSocketClient::GetTransferSpeed() const { return m_nTransferSpeed; }
Hope it helps.
|
|
|
|
|
Hi, I'm working on a tab control and i would like to place the bitmaps on each tab of the tab control. I did use "InitImageList" function yet there was no big help and an error message says CTabCtrl doesnt have "InitimageList" function. Please advice me how to proceed and i would also wish to have my tabs on the left side of my dialog box , how is it possible?? Becoz in properties we can change them from top position or bottom position.
|
|
|
|
|
|
|
Thanks a lot. It severed my purpose
|
|
|
|
|
Hi all,
I have made a dialog based application in vc 2008 in which i have made a list and a tree control together(i.e in list we have a tree displayed). Now i want to create radio buttons in my list control as we have check boxes in our list control. How can i do this.
Thanks in advance..
|
|
|
|
|
See Here http://www.codeproject.com/KB/combobox/RadioListBox.aspx[^]">
|
|
|
|
|
</b>hi,
some compiling error is hapanning in your program
How to solve it??
Compiling...
DirectInputTest.cpp
E:\download display device\24.09.08\Hooking_DirectX_COM_src\COMTest\DirectInputTest.cpp(68) : error C2146: syntax error : missing ';' before identifier 'lpdi'
E:\download display device\24.09.08\Hooking_DirectX_COM_src\COMTest\DirectInputTest.cpp(68) : error C2501: 'LPDIRECTINPUT8' : missing storage-class or type specifiers
E:\download display device\24.09.08\Hooking_DirectX_COM_src\COMTest\DirectInputTest.cpp(68) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
COMTest.exe - 3 error(s), 0 warning(s)
tisosbrat@gmail.com
|
|
|
|
|
tisos wrote: E:\download display device\24.09.08\Hooking_DirectX_COM_src\COMTest\DirectInputTest.cpp(68) : error C2146: syntax error : missing ';' before identifier 'lpdi'
So have you even looked at line 68 of DirectInputTest.cpp ?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi Forum
I have a dialog application and i want to add this application in StartUp in vista.Can any one give me tips how can i do this?
Plz helpe me
Thanks in Advance
|
|
|
|
|
This article may be of use.
Regards,
--Perspx
"I've got my kids brainwashed: You don't use Google, and you don't use an iPod." - Steve Ballmer
"Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen an angry penguin charging at them in excess of 100mph." - Linus Torvalds
|
|
|
|
|
i want to show print preview on same dialog in any control
i want to show print preview when user chose patient name form combo then from data base his patient detail will retrive and i want to show that information on report( for print out) but before to send print i want as well as user select patient name print preview should display on same dialog in any control( edit box, or label etc etc )
how can i do this?
|
|
|
|
|
HI,
I want to delete individual items in the combobox.
using below code iam deleting each item, but Last item still displaying in my Combobox.
int index = m_CtrlCmb.GetCurSel();
m_CtrlCmb.DeleteString(index);
help me to resolve this.
Thanks in advance.
Preethi
|
|
|
|
|
Debug and trace through to see what index is on the Last Item. GetCurSel() will return LB_ERR (usually -1) if nothing is selected.
- S
50 cups of coffee and you know it's on!
A post a day, keeps the white coats away!
|
|
|
|
|
HI
My problem is my combobox contains nitems. Iam deleting each item using below code, Comobo List also getting updated according to that,means that item is getting deleted. Last item also iam able delete from Combobox List using below code.
int index = m_CtrlCmb.GetCurSel();
m_CtrlCmb.DeleteString(index);
But my problem is Last item in the combobox getting deleted from Combo List but displaying in the combobox,means that item i need to delete manually.
I couldnt trace By Debugging, Plz Help.
|
|
|
|
|
Are you trying to delete all items in the combobox? Are you using MFC?
If so, call:
m_CtrlCmb.ResetContent();
- S
50 cups of coffee and you know it's on!
A post a day, keeps the white coats away!
|
|
|
|
|
HI Steve,
Thanks for your help
Iam able to fix this issue
using this code
int Count1 = m_CtrlCmb.GetCount();
if(Count1 == 0)
{
m_CtrlCmb.ResetContent();
}
Thanks,
Preeti
|
|
|
|
|
Preethi_123 wrote: int Count1 = m_CtrlCmb.GetCount();
if(Count1 == 0)
{
m_CtrlCmb.ResetContent();
}
How does it work??
I mean you are deleting when count is 0? does n't it mean that there are no contents?? Or is it a typo??
Regards,
Sandip.
|
|
|
|
|
Or m_CtrlCmb.SetCurSel(-1);
Lookup documentation on CComboBox on MSDN.
- S
50 cups of coffee and you know it's on!
A post a day, keeps the white coats away!
|
|
|
|