|
No, I don't because you didn't answer my question. And furthermore, this totally depends on the device with which you want to communicate.
|
|
|
|
|
Ok Device type is pendrive,ipode..
|
|
|
|
|
For the pendrive, you can access it the same way you access a local file, the driver takes care of that. I don't know for the ipod but I guess it is a similar principle. Anyway, you will never really see that these devices are accessed through USB.
|
|
|
|
|
ok Now can you give me tutorial link
|
|
|
|
|
Well, it is just accessing a file. See here[^] for example.
|
|
|
|
|
Do you want to Copy files from the USB memory device to system??
If yes
You can access it as any other normal system drive and use
CopyFile(..) to copy the files from the memory.
Regards,
Sandip.
|
|
|
|
|
NewVC++ wrote: Can any one give me tutorial or example link of How to Copy USB Data to System
As mentioned in my answer to your question yesterday, use the regular File API like CreateFile, ReadFile etc
NewVC++ wrote: When any one try to copy Data from usb Device to System(PC) then show a message.
SHChangeNotifyRegister[^] might be helpful.
You may also consider writing a filter driver
Sohail
Please mark helpful answers
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Hi All
I have a problem to Show USB Drive Name and File name.Problen is that when i insert a USB device then Drive Name and file name is show but also show Some dummy line like this
"ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌA". I debug the code.When i change the this line
char chDriveLabel='A'; to char chDriveLabel='B'; then it is working fine.But when i change this line then i have found some problem like when i insert the
first usb device then nothing show and when i insert
more than i device
then it is showing.So Plz help me code is here
BOOL CUSBDlg::FileList()
{
DWORD dwDrives=GetLogicalDrives();
if(0==dwDrives)
{
return FALSE;
}
DWORD dwCount=0;
char chDriveLabel='A';
char szRootpath[5]={0,0,0,0,0};
while(dwDrives !=0)
{
if ((dwDrives & 1) != 0)
{
sprintf(szRootpath,"%c:\\",chDriveLabel);
if(DRIVE_REMOVABLE==GetDriveType(szRootpath))
{
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
m_ListCountries.AddString(szRootpath);
m_tree.InsertItem(szRootpath);
szRootpath[3]='*';
hFind=FindFirstFile(szRootpath,&FindFileData);
if (INVALID_HANDLE_VALUE == hFind)
{
}
do
{
if (strcmp(FindFileData.cFileName,_T(".")) && strcmp(FindFileData.cFileName,_T("..")))
{
m_ListCountries.AddString(FindFileData.cFileName);
m_tree.InsertItem(FindFileData.cFileName);
}
AfxMessageBox("helloP");
AfxMessageBox(FindFileData.cFileName);
}while (FindNextFile(hFind, &FindFileData) != 0);
FindClose(hFind);
}
}
dwDrives = dwDrives >> 1;
chDriveLabel++;
}
return true;
}
|
|
|
|
|
That's a repost.
BTW, as suggested yesterday, why don't you handle the FindFirstFile function failure?
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]
|
|
|
|
|
ok so what i use there in place of FindFirstFile
|
|
|
|
|
Actually handling FindFirstFile failure means: take an adequate action whenever the function fails (for instance, stop further elaboration and report the user that no file was found). You do nothing in such circumstance.
I'm not suggesting you to use another function.
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]
|
|
|
|
|
ok then what i do to remove that problem..
Plz help me
|
|
|
|
|
NewVC++ wrote: ok then what i do to remove that problem
you 1) reread the answers you got correctly, and 2) you fully understand them.
|
|
|
|
|
while ( ! problem_solved )
{
<a href="http://www.codeproject.com/script/Forums/View.aspx?fid=1647&msg=2688026" target="_blank" title="New Window">follow_this_advice()</a>
};
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]
|
|
|
|
|
Hint: If FindFirstFile() is failing, do you think it makes much sense to go on into the while() loop?
"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 am useing FindFirstFile() code is here
hFind=FindFirstFile(szRootpath, &FindFileData);
if (INVALID_HANDLE_VALUE == hFind)
{
// return FALSE;
}
// List all the files in the directory .
do
{
//ignore the sub directories
if (strcmp(FindFileData.cFileName,_T(".")) && strcmp(FindFileData.cFileName,_T("..")))
{
m_ListCountries.AddString(FindFileData.cFileName);
// AfxMessageBox(FindFileData.cFileName);
m_tree.InsertItem(FindFileData.cFileName);
}
//AfxMessageBox("helloP");
// AfxMessageBox(FindFileData.cFileName);
}while (FindNextFile(hFind, &FindFileData) != 0);
FindClose(hFind);
}
|
|
|
|
|
NewVC++ wrote: i am useing FindFirstFile()...
No one is debating that. The problem is that you are continuing on even if that function fails.
"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,
I have two functions funx() and funy() in my VC++ application.Could someone suggest me a tool/mechanism as how to find which functions (application flow)are called in between funx() and funy().
I need this urgently.
Thanks in advance.
Taruni
|
|
|
|
|
Im not sure Im understood your question but why you dont use of deugger(F11 or F10/breakpoints)?
|
|
|
|
|
Thank You Hamid.
What I want to know is whether there is any tool that lists the functions called in between funx() and funy()
Taruni
|
|
|
|
|
Taruni wrote: What I want to know is whether there is any tool that lists the functions called in between funx() and funy()
yes, the DEBUGGER does it ! by showing the call stack.
but you seem to be to lazy to search a bit by yourself...
|
|
|
|
|
Taruni wrote: I have two functions funx() and funy() in my VC++ application.Could someone suggest me a tool/mechanism as how to find which functions (application flow)are called in between funx() and funy().
Normally you can use the debugger.
Taruni wrote: I need this urgently.
But that's bothering me. For urgent purposes, I don't know if the debugger will help.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
|
There is one Tool called WinDBG from MS.
|
|
|
|
|
shhhhh, that's a secret tool !
|
|
|
|