|
here is the sample snippet
CFileFind finder;
BOOL bWorking = finder.FindFile("*.*");
while (bWorking)
{
if (finder.IsDots())
continue;
if (!finder.IsDirectory())
{
bWorking = finder.FindNextFile();
m_ListBox.AddString((LPCTSTR) finder.GetFileName());
}
}
SaRath.
"Do Next Thing..."
My Blog | Understanding State Pattern in C++
|
|
|
|
|
Another way to do the same thing
extern CListBox* pmyListBox;
TCHAR lpszWinPath[MAX_PATH], lpszOldPath[MAX_PATH];
::GetWindowsDirectory(lpszWinPath, MAX_PATH);
::GetCurrentDirectory(MAX_PATH, lpszOldPath);
::SetCurrentDirectory(lpszWinPath);
pmyListBox->ResetContent();
pmyListBox->Dir(DDL_READWRITE|DDL_DIRECTORY, _T("*.*"));
::SetCurrentDirectory(lpszOldPath);
SaRath.
"Do Next Thing..."
My Blog | Understanding State Pattern in C++
|
|
|
|
|
|
first of all i add the files using follwing code
POSITION currPos;
char strFilter[] = { "Mp3 files (*.mp3)|*.mp3|All Files (*.*)|*.*||" };
CFileDialog avi(TRUE, ".mp3",NULL,OFN_ALLOWMULTISELECT | OFN_HIDEREADONLY, strFilter);
char drive[_MAX_DRIVE], middle[_MAX_PATH], filename[_MAX_FNAME], ext[_MAX_EXT];
if(avi.DoModal() == IDOK)
{
currPos = avi.GetStartPosition();
while(currPos != NULL)
{
m_SongName = avi.GetNextPathName(currPos);
_splitpath (m_SongName, drive, middle, filename, ext);
m_list7.AddString(m_SongName);
so tell atleast what modufication i should do to ad folder
|
|
|
|
|
|
ok!
how we use SHBrowseFolder it,
i know iam disturbing u,
really sorry,
but my work demands me please,
beacuse it is urgent,
sree.
|
|
|
|
|
sree_as wrote: how we use SHBrowseFolder it,
CString csFolderSelected;
BROWSEINFO bi = {0};
bi.ulFlags = BIF_RETURNONLYFSDIRS ;
LPITEMIDLIST pIt;
if( (pIt = SHBrowseForFolder( &bi )))
{
TCHAR tcPath[ MAX_PATH ];
if( SHGetPathFromIDList( pIt, tcPath ))
{
csFolderSelected = tcPath;
AfxMessageBox( "the user selected the folder " + csFolderSelected );
}
}
nave
|
|
|
|
|
After this,
TCHAR lpszOldPath[MAX_PATH];
::GetCurrentDirectory(MAX_PATH, lpszOldPath);
::SetCurrentDirectory(csFolderSelecter);
pmyListBox->ResetContent();
pmyListBox->Dir(DDL_READWRITE|DDL_DIRECTORY, _T("*.mp3"));
::SetCurrentDirectory(lpszOldPath);
This will work fine
SaRath.
"Do Next Thing..."
My Blog | Understanding State Pattern in C++
|
|
|
|
|
Thnak u sararth and naveen,
really it is working very nice,
thank u very much.
this is my friend login id because system has failed.
so iam sending message from my friend system.
thank u,
finally simple problem if i like to add items to listctrl instead of Listbox,
Dir function is not availble for that
what should i do
|
|
|
|
|
|
|
plz tell me where i found the function WM_ERASEBKGND to change color
in clas wizard
OnEraseBkgnd(CDC *pDC)
Please mail me
|
|
|
|
|
1. Go to Class Wizard and select required the message from the class (make sure that you have selected correct class) "Add Handler" there
2. Right click on the class and select "Add Message Handler"
SaRath.
"Do Next Thing..."
My Blog | Understanding State Pattern in C++
|
|
|
|
|
sir i am sorry what i dont understand
when i go to class wizard there is no function WM_ERASEBKGND
plz help me
Please mail me
|
|
|
|
|
|
i made a dialog based application
and now i want to change my dialog box color
i know that WMPAINT work for this what i want to use WM_ERASEBKGND
could it be possible
Please mail me
|
|
|
|
|
|
one simple way insert this codes in your file(I think you need to learning VC)but anyway for solve your problem use this
in header file
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
in cpp file insert
<br />
BOOL your class name::OnEraseBkgnd(CDC* pDC) <br />
{<br />
}<br />
whitesky
|
|
|
|
|
Depending on the class type (e.g. Dialog, MDI Child Frame, etc.), ClassWizard filters the messages.
To show all messages do the following:
- select "Class Info" tab;
- from "Message filter" combo box, choose "Window";
- go back to "Message Maps" tab; now all available messages are displayed in the "Messages" list.
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
You should open your dialog in dialog editor and then click on caption bar of your dialog. Then go to View --> Properties Window, activate the panel with Windows messages by clicking a toolbar button. Then select WM_ERASEBKGND event and add the handler.
The simplest handler can look like this:
BOOL CMyDialog::OnEraseBkgnd(CDC * pDC)
{
pDC->FillSolidRect(0, 0, 32000, 32000, RGB(0, 0, 255));
return TRUE;
}
|
|
|
|
|
Hi,
I'm looking for possible reason for the client connection failure with my server.
So for so good all clients where connected suddenly the client applications can't connect to the server appln. Only change happened is, there is a gradual increase in my users connecting & disconnecting from my server.
I use sockets for connections & when i debuged the client application with GetLastError() i receive WSAECONNREFUSED error when executing socket's 'Connect' method . I even tried telnet but receive 'couldnot open host' msg, but my server is still running & the previosuly connected clients are still receiving handshake.
Waited for few hours, still can't connect to server, do anyone know the possible reason why this is happening? this is killing me!
Thank you
Rove
|
|
|
|
|
from your description, I could understand that, it is the maximum number of clients that can be connected to the server.
Disconnect one of the currently connected clients and connect the new client. it should work fine.
SaRath.
"Do Next Thing..."
My Blog | Understanding State Pattern in C++
|
|
|
|
|
If this happens after a number of disconnects, you may be exhausting your socket handles. I would double-check your code to make sure that you are correctly freeing socket handles.
I have had this happen in the past with a UDP-based server I wrote - a bug in my socket wrapper class prevented the underlying socket handle from being released when the wrapper class was returned to its cache. (Note that in my case, the CPU usage was pegged when this happened, so if you are seeing that, that may be the problem.)
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Hi James,
Your answer probably looks closer to my problem, thanks for your reply. Did you mean that i've to double check the socket handles in server appln? it is a tcp based server.
Rove
|
|
|
|
|
Yes, in the server app. When a client disconnects, make sure that you are calling closesocket(...) on the socket handle you were communicating on (or that whatever wrappers you are using are doing that).
The normal flow of operations should be something like:
SomeSocket = socket(...)
bind( SomeSocket, ... )
listen( SomeSocket, SOMAXCONN )
while( ClientConn = accept( SomeSocket, ... ) != INVALID_SOCKET )
{
closesocket( ClientConn )
}
closesocket( SomeSocket )
The above kinds-sorta-pesudo-code gives a simple idea.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|