|
Hi Nelek,
I am not a BOT. BOT is not as smart as you and me.
Nelek wrote: user is a BOT
regards,
George
|
|
|
|
|
George_George wrote: BOT is not as smart as you and me.
yeah, sure you aren't. BOT is sure smarter than you
so, answer my previous SIMPLE question, and then i'll consider revising this statement !
modified on Thursday, December 13, 2007 9:19:54 AM
|
|
|
|
|
Hi All,
This is the first time i am writing to this forum.
So let me staight come to the point .
I am a newbie to MFC , but i understand C,C++.
My urgent need of the hour is that i want to provide a text box on my GUI along with a button , and when this button is clicked the data which is shown/typed in the text box is transferred to any kind of USB device viz a viz USB Pen drive's (or any other USB 2.0 compliant class device).
So has any one done similar kind of work and if yes could you'll provide me some good links wherein i will be able to make a GUI which will allow me to talk to the USB device .
Basically the USB API 's which allows us on a click of a control button to send data to a USB device like a USB Pen drive .
Any help in this regards will be highly appreciated.
Regards
A.G
|
|
|
|
|
when this button is clicked the data which is shown/typed in the text box is transferred to any kind of USB device
What does it mean? A TEXT to be transferred to the USB device?
Come online at:-
jubinc@skype
|
|
|
|
|
A USB port is not similar to a serial port. You cannot just get a handle to the bus and send data on it. What you need to do, is get a handle to a specific device driver (using CreateFile) and then you'll be able to exchange data with this specific device (using WriteFile and ReadFile). The string you need to supply to CreateFile is something that is specific for the driver. You should check in the documentation that is supplied with the USB device (if it comes with a SDK).
|
|
|
|
|
Hi Friends,
I am using a CFileDialog, i am giving a path in that.
like..
dlg.m_ofn.lpstrInitialDir = Final_path;
Here i have to Select all the files in the CFileDialog.
How to do that?.
Thanks and Regards.
SANTHOSH V
|
|
|
|
|
santhoshv84 wrote: Here i have to Select all the files in the CFileDialog.
How to do that?.
While creating the CFileDialog object, you have to pass the OFN_ALLOWMULTISELECT also( 4th parameter )
|
|
|
|
|
OFN_ALLOWMULTISELECT is not my problem.
While opening the CFileDialog all the files should be selected.
How to do that?.
Thanks and Regards.
SANTHOSH V
|
|
|
|
|
derive a class from the CFileDialog and overide the OnFolderChange function. Inside that function take the handle of list control and select all items in it.
|
|
|
|
|
santhoshv84 wrote: While opening the CFileDialog all the files should be selected.
How to do that?.
Programmatically, or using the keyboard/mouse?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Programmatically.
or else
With out the CFileDialog, I have to take all the files in the particular folder in an array. If you know this, let me know.
|
|
|
|
|
santhoshv84 wrote: ...I have to take all the files in the particular folder in an array.
From MSDN:
"If the user selects more than one file, the lpstrFile buffer returns the path to the current directory followed by the file names of the selected files. The nFileOffset member is the offset, in bytes or characters, to the first file name, and the nFileExtension member is not used. For Explorer-style dialog boxes, the directory and file name strings are NULL separated, with an extra NULL character after the last file name."
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi all,
Last time I try to write an application to read a RTF format file and get the text on it. But actually it is not much easy. So I've search on the MSDN and found using CRichViewEdit and its members, it can be easy than my first application.
I've searching some articles on code project forum. But not found such things. If you have any link with you please put it here. Or give some clues to me start work on CRichViewEdit.
Thanks.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Does this http://sourceforge.net/projects/librtf/[^] help?
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.
|
|
|
|
|
Thanks, but it is on Linux.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Eranga Thennakoon wrote: Thanks, but it is on Linux.
Well, the above is a true.
Anyway they give you sources, IMHO (I gave a quick look at) a build for (or a porting to) Windows appears viable. At least sources maybe the starting point for your own library (You may eventually write an article 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.
|
|
|
|
|
Hmm.... let see
I appreciate your help all the time...
Eranga
|
|
|
|
|
Ok, I've try it and it can be done easily in this way.
CString x;
if(m_rtfCtrl2.CreateEx( WS_EX_APPWINDOW,WS_BORDER|ES_MULTILINE,CRect(10,10,200,200), this, 1))
{
CFile rtfFile;
BOOL err = rtfFile.Open("G:\\Work On\\CPP\\RTFControl\\TestFile.rtf", CFile::modeReadWrite, NULL);
int iLength = rtfFile.GetLength();
char *pBuffer = new char[iLength];
rtfFile.Read(pBuffer, iLength);
CString rtf(pBuffer);
m_rtfCtrl2.SetWindowText(rtf);
m_rtfCtrl2.GetWindowText(x);
AfxMessageBox(x);
}
This works fine. But I want to make a change here. I used this code on MFC application, on click event for simplification. So, used the same window as the main window(use 'this' pointer to refer it) in CreateEx function.
Now I want to use this on MFC supported console application. But there 'this' pointer is not allowed. How can do this change.
On CreateEx() function main window is in HWND* type. So I can't use GetConsoleWindow() as well.
Can you guys give me a clue.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Eranga Thennakoon wrote: CString x; if(m_rtfCtrl2.CreateEx( WS_EX_APPWINDOW,WS_BORDER|ES_MULTILINE,CRect(10,10,200,200), this, 1)) { CFile rtfFile; BOOL err = rtfFile.Open("G:\\Work On\\CPP\\RTFControl\\TestFile.rtf", CFile::modeReadWrite, NULL); int iLength = rtfFile.GetLength();// Data length char *pBuffer = new char[iLength];// Data buffer rtfFile.Read(pBuffer, iLength); CString rtf(pBuffer); m_rtfCtrl2.SetWindowText(rtf); m_rtfCtrl2.GetWindowText(x); AfxMessageBox(x); }
You could simpify this a bit with something like:
DWORD CALLBACK StreamInCallback( DWORD dwCookie, LPBYTE lpBuff, LONG lBytesIn, LONG *lpBytesOut)
{
CFile *pFile = (CFile *) dwCookie;
*plBytesOut = pFile->Read(lpBuff, lBytesIn);
return 0;
}
CFile file("G:\\Work On\\CPP\\RTFControl\\TestFile.rtf", CFile::modeRead);
EDITSTREAM es = {0};
es.dwCookie = (DWORD) &file;
es.pfnCallback = StreamInCallback;
m_rtfCtrl2.StreamIn(SF_RTF, es);
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I have a zip file which contain a lot of files and folders, and in its folder maybe also contain some other files and sub folders. Most of the zip lib can only visit the first layer files, but it's difficult to visit the sub folder's file.
Could anyone give me some advice!
Thanks in advance.
|
|
|
|
|
Try with 7zip sdk. I am not sure but give a shot.
|
|
|
|
|
I have MSVC app that has one executable and a number of DLL's
When I run Depends tool (a tool that shows what functions make up a DLL)
one of the srtucture in this C/MSVC app show up as a function
Is that possible
If I were to do a GetProcAddress of this structure would I get its address
Thankx
|
|
|
|
|
Well, I think the following is an hint (MSDN documentation about GetProcAddress):
GetProcAddress Function
Retrieves the address of an exported function or variable from the specified dynamic-link library (DLL).
However, I did not make a test (this is up to you).
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.
|
|
|
|
|
|
I've been trying to add some animated GIF files to my Visual Studio 2003 project as a resource, but I get an error message: "(filename) is not a valid GIF file." The GIFs are all valid and can be displayed in any image editor I have. Any way to fix/work around this and get the GIFs into my project as resources?
|
|
|
|