|
George_George wrote: How did B knows it will send a message to A? From which step B will get the information of where (to A in your sample) to send message to? [Smile]
The proxy knows how to communicate to A because A is responsible for its creation and provided all the necessary information in doing so.
Steve
|
|
|
|
|
Thanks Steve,
From your great and patient help, I think I am clear about the situation now. Let me confirm with you,
- proxy object only know how to communicate with the source interface (which is marshalled from) to the original coclass object, not knowing how to communicate with the original coclass object itself;
- since proxy object is created from the source interface (which is marshalled from), the proxy object could have information (e.g. address information) about where to contact the source interface.
regards and have a good weekend,
George
|
|
|
|
|
Hi All
How can i read USB Device Data.i want to read data which is present in USB Device.Example- Pendrive have a file vc.txt and vc5.txt and i want to read these data through VC++2005 code.So how can i do that..Plz help me
|
|
|
|
|
This may be helpful
<a href="http://www.beyondlogic.org/">interfacing</a>[<a href="http://www.beyondlogic.org/" target="_blank" title="New Window">^</a>]
|
|
|
|
|
Thx's for reply
but it is not useful for me.Sir if possibel then give me some example link or code..
Thx's in advance
|
|
|
|
|
the previous once code link to http://www.beyondlogic.org/usbnutshell/usb7.htm#PIC16F876Example[^]
or
You can first use the GetLogicalDrives API function to find which logical drives are present in a system, then use GetDriveType to determine whether a disk drive is a removable, and finally use FindFirstFile and FindNextFile to get file list in a specific remove disk. Here is sample code, hope it helps. Notice: in the sample code, It just lists all files in the root directory, if you’d like to list files in subdirectories, you can make small modifications on the code.
Code Snippet
#include<windows.h>
#include<iostream>
BOOL 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;
std::cout <<"Files in " << szRootpath << std::endl;
szRootpath[3]='*';
hFind=FindFirstFile(szRootpath,&FindFileData);
if (INVALID_HANDLE_VALUE == hFind)
{
return FALSE;
}
do
{
if (!(FindFileData.dwFileAttributes &
FILE_ATTRIBUTE_DIRECTORY))
{
std::cout << FindFileData.cFileName << ":";
}
}while (FindNextFile(hFind, &FindFileData) != 0);
FindClose(hFind);
}
}
dwDrives = dwDrives >> 1;
chDriveLabel++;
}
}
For detail information of GetLogicalDrives, you can refer to
http://msdn2.microsoft.com/en-us/library/aa364972.aspx
For detail information of GetDriveType, you can refer to
http://msdn2.microsoft.com/en-us/library/aa364939.aspx
For detail information of FindFirstFile, you can refer to
http://msdn2.microsoft.com/en-us/library/aa364418.aspx
For detail information of FindNextFile, you can refer to
http://msdn2.microsoft.com/en-us/library/aa364428(VS.85).aspx
Hope this helps!
|
|
|
|
|
Thx's I am going through this..After that i will tell you..
|
|
|
|
|
Sir when i add this(BOOL FileList()) code on exiting code then i am geting two error.Error like this
[code]
(1) error C2664: 'GetDriveTypeW' : cannot convert parameter 1 from 'char [5]' to 'LPCWSTR'
(2)
rror C2664: 'FindFirstFileW' : cannot convert parameter 1 from 'char [5]' to 'LPCWSTR'
[/code]
Plz help me
|
|
|
|
|
|
|
|
With what? You indicated the error was solved here.
"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
|
|
|
|
|
it is not working in proper way..I debug code then i found cursor not going in this section.Plz help me
[code]
if(DRIVE_REMOVABLE==GetDriveType(szRootpath))
{
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
//Removable dirve lable
std::cout <<"Files in " << szRootpath << std::endl;
szRootpath[3]='*';
hFind=FindFirstFile(szRootpath,&FindFileData);
if (INVALID_HANDLE_VALUE == hFind)
{
return FALSE;
}
do
{
//ignore the sub directories
if (!(FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
std::cout << FindFileData.cFileName << ":";
}
}while (FindNextFile(hFind, &FindFileData) != 0);
FindClose(hFind);
}
}
[/code]
|
|
|
|
|
Make sure that you are in Debug mode, or try putting the break point some where before.
|
|
|
|
|
Yes you are right i am putting the break point some where before.But after the remove the break point then also nothing showing.I use MessageBox(); for check cursor enter in that section or not.Then nothing showing..i mean same result i found..
Can i send you full code.What i use here..
Plz help me
|
|
|
|
|
Plz help me
If it possible then plz i need you help..
Thx's in advance
|
|
|
|
|
How does getting a list of files help with reading data from known files on a USB device?
"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
|
|
|
|
|
Ok as i think then it found logical drive then it's show file of USB. Any way if you have different view of this problem then plz give me..
Thx's in advance
|
|
|
|
|
vcprog wrote: Any way if you have different view of this problem then plz give me..
See here.
"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
|
|
|
|
|
Has the OS mapped that device to a drive letter?
"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
|
|
|
|
|
Application crashes after the call onStart is completed.
Declaration
virtual void OnStartPrgBar();
BEGIN_MESSAGE_MAP(MainFrame, CMDIFrameWnd)
ON_MESSAGE(WM_USER_START_PROGRESS,OnStartPrgBar)
END_MESSAGE_MAP()
void MainFrame::OnStart()
{
Dlg->DoModal();
}
|
|
|
|
|
You've given us very little to go on... Provide details such as:
- The type of exception.
- A stack trace to the exception.
- The source code around the crash.
Steve
|
|
|
|
|
<code></code><pre>void MainFrame::OnStart()
{
THREADSTRUCT5 *_param = new THREADSTRUCT5;
_param->_this = this;
thMPrgBar=AfxBeginThread (StartProgressBarThread, _param);
}
UINT MainFrame::StartProgressThread (LPVOID param)
{
THREADSTRUCT5* ts = (THREADSTRUCT5*)param;
if (ts->_this->popupDlg->DoModal()==TRUE)
{
}
return 1;
}
The crash is only in the Release mode, it is working fine in the Debug mode
|
|
|
|
|
ptr_Electron wrote:
The crash is only in the Release mode, it is working fine in the Debug mode
That doesn't mean you can't use the debugger. First enable debug information for the release build (this should always be done) then simply debug it as normal.
Steve
|
|
|
|
|
5F438D1A call dword ptr [edx+64h] // point of crash , pls advice
---------------------------
Microsoft Visual C++ Debug Library
---------------------------
Debug Assertion Failed!
Program: -----------------------------------.exe
File: afxcmn.inl
Line: 449
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
---------------------------
Abort Retry Ignore
---------------------------
|
|
|
|