|
George_George wrote: Anyway, I agree .Net is better
Sure?
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]
|
|
|
|
|
But do you have any ideas to my original question? I still have some COM code to maintain.
regards,
George
|
|
|
|
|
I cannot figure out how an answer to your original question will help you in maintaining COM code
Anyway, I think that dispinterface attribute is always needed when declaring IDispatch methods and properties, regardless of the dual nature of the interface.
But it is only a guess, I'm not an expert about.
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]
|
|
|
|
|
There are 3 ways to provide IDispatch interface,
1. Expose interface say IX in QueryInterface, and marking IX dispinterface IDL;
2. Expose interface IDispatch directly in QueryInterface, and coclass implements IDispatch directly;
3. Expose interface say IX (and IX inherits from IDispatch) in QueryInterface, and making coclass implements IX (i.e. dual interface).
I think the differences between 1 and 2 is just we can use dispid property in IDL file if we mark an interface dispinterface, but can not use dispid property in IDL if it is not dispinterface.
Any comments?
regards,
George
|
|
|
|
|
Hey Gerge, you're again comparing quite different entities: dispinterface is a MIDL attribute, while IDispatch is a COM interface.
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]
|
|
|
|
|
Hi CPallini,
It should be my description issue.
What I compare is, making an interface "dispinterface" in IDL, comparing with an iterface implementing IDispatch or dual. Have I made myself understood?
regards,
George
|
|
|
|
|
Hi All
How can i copy the folder data(it means Folder A have two File a1 and a2. And Want to copy full data of a1 and a2)?
Plz help me
modified on Wednesday, September 24, 2008 2:39 AM
|
|
|
|
|
You can use FindFirstFile/FindNextFile APIs or if using MFC you can use CFileFind class to find all the files in the folder and use CopyFile API to copy files one by one..
Does it help??
Regards,
Sandip.
|
|
|
|
|
Thx's sir i am abel to copy file through this code
CopyFile("source Path", "Destination Path",TRUE); .So do you think it is necessary to use
FindFirstFile/FindNextFile .
Plz help me
|
|
|
|
|
You said that you need to copy all the files from the folder. So you have to use FindFirstFile/FindNextFile API to list all the files in that folder.
Here is sample code for listing all files in the directory
List files in a directory[^]
I hope it helps..
Regards,
Sandip.
|
|
|
|
|
No Sir Sorry for misunderstanding.I want to copy Folder which is currently copy by user.
I want to do like this
Copy("D:\\VC","C:\\VC",True)
Plz help me
|
|
|
|
|
You will not be able to copy directory using CopyFile.
Either you can use FindFirstfile/FindNextFile and copy file by file manually.
Or
You can use SHFileOperation API.
Here is good article by Michael Dunn for SHFileOperation
Wrapper for SHFileOperation[^]
I hope it helps..
Regards,
Sandip.
|
|
|
|
|
Use FindFirstFile/FindNextFile.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Use SHFileOperation() .
"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
|
|
|
|
|
i just want to change back ground color of a specific dialog
SetDialogBkColor function changes all dialogs colors but i just want to change a single dialog color
how can i do this?
|
|
|
|
|
See here[^]
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
As implicitely suggested by sashoalm, you should handle the WM_CTLCOLOR in your dialog.
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 to check whether the given bitmap image file is a monochromic or coloured.. ?
Thanks in Advance
|
|
|
|
|
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.
|
|
|
|