|
In addition to the other replies pointing you at FindFirstFile, what is empty?
Does it count as empty if there's only directories there? What if there are directories, but they have / have not got any contents themselves?
You don't need to answer me, but you need to ask and answer this question for yourself.
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Yeah the case can be considered.
But the directory is created by my application and the files are also created by my
application.
My files doesnt contain any extension.
I do not understand how I can use FindFirstFile.
FindFirstFile is giving me the valid handle.But FindNextFile is always returning 0, even
files are present.
what is the reason behind it?
Regards,
Sunil Kumar
|
|
|
|
|
If you're using MFC you might try something like this:
BOOL DirHasFiles(CString csDir)
{
if (csDir.Right(1) != "\\")
csDir += "\\";
csDir += "*.*";
BOOL bDirHasFiles = FALSE;
CFileFind ff;
BOOL bWorking = ff.FindFile(csDir);
while (bWorking)
{
bWorking = ff.FindNextFile();
if (ff.IsDirectory())
{
if (ff.IsDots())
continue;
}
else
bDirHasFiles == TRUE;
}
return bDirHasFiles;
}
Edit:
For plain WIN32, have a look here:
http://msdn.microsoft.com/en-us/library/aa365200%28VS.85%29.aspx[^]
modified on Thursday, October 29, 2009 8:00 AM
|
|
|
|
|
Thanks a lot Michael.This is exactly what I am looking for.
Regards,
Sunil Kumar
|
|
|
|
|
|
I am using VC++ 6.0.I am not to conversant with VC++.
I have a project where i need to extract the data from the database then provide preview of the same data & then print the same independently. The no. of page could be more than one if the data is more. To achieve this, I have referred to below link for print & preview in MFC. I found this project very useful to cater to my requirement.
http://www.codeproject.com/KB/printing/printlib.aspx
In this project, preview or print button, i am unable to understand how it adds 2nd page. i have a requirement where if data is more than 1 page then it should automatically go to next page. How would i do that in VC++ in the above project.
Kindly indicate if you would need some more info.
|
|
|
|
|
I've done next to nothing in regards to printing via code, but one of the last times I did need to print something, I wrote the contents of my database query to an HTML file, and then navigated to that file using CHtmlView .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I have a client server applicaion. on the server side it uses ISAPI.dll and ilaServer.exe on windows 2000 server with IIS 5.0
build in C++
for some reasons the IIS hangs. and the IIS need to be restarted to set back to work.
I want to know the root cause for this hangs, and analyse the problem and reslove it.
source was in VS 2005. I tried using Dr. Watson Dumps
And tried to analise it in VS 2005, but it is not compatable (VS says it is old version of dump file )
Can you pls help & advice
|
|
|
|
|
Hi,
im creating combobox ctrl dynamically Thru code but not from resource...and Pls let me know how can i increase the height of the ctrl based on the font...ie if the font is small ctrl should be small else if the Font is bigger Ctrl should increase....
i used SetFont() the size of the ctrl is increased and the Font of the items in the Dropdownlist was also increased but the selected item font is not changed...
m_ComboBox.Create(
WS_CHILD|WS_VISIBLE|WS_VSCROLL|CBS_DROPDOWNLIST,
CRect(5, 10, 20, 50),
pParentWnd, IDC_COMBOBOX);
and even i tried using GetComboBoxInfo and obtained HWND hwndItem handle for Editbox but i want to know how can i setfont for the same...
|
|
|
|
|
Just set the font size as mentioned below with m_Font as member.
Doing so will increase the height of the combo box according to the font size and font type
To increase the width, you can SetWindowPos or MoveWindow functions .
CDC *pDC = GetDC();
LOGFONT lFont;
memset(&lFont, 0, sizeof(lFont));
lFont.lfHeight = 34;
lFont.lfWeight = FW_NORMAL;
lFont.lfOutPrecision = OUT_TT_ONLY_PRECIS;
strcpy( lFont.lfFaceName, _T("Lucida Sans Unicode"));
m_Font.CreateFontIndirect(&lFont);
m_pComBo->SetFont(&m_Font);
Величие не Бога может быть недооценена.
modified on Thursday, October 29, 2009 4:15 AM
|
|
|
|
|
You may send the WM_SETFONT message to the the combo's edit box (that is another window), i.e.:
- call
GetComboBoxInfo [^] to obtain the handle of the edit box ( hwndItem member of the COMBOBOXINFO struct ). - Send the
WM_SETFONT message using the found handle.
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]
|
|
|
|
|
I tried using the below code..
COMBOBOXINFO cbi;
cbi.cbSize = sizeof(COMBOBOXINFO);
m_ComboBox.GetComboBoxInfo(&cbi);
::SendMessage(cbi.hwndItem,WM_SETFONT,(WPARAM)pFont->m_hObject,TRUE);
::SendMessage(cbi.hwndCombo,WM_SETFONT,(WPARAM)pFont->m_hObject,TRUE);
::SendMessage(cbi.hwndList,WM_SETFONT,(WPARAM)pFont->m_hObject,TRUE);
Where pFont is a CFont* in which im having the bigger font..
All are changed except the Font in the selected item in the combobox..
The font in the selected item of Combobox is also changed but when i click on the combobox the font of the selected item is changing to older font ie small font...
Please help me regarding the same..
|
|
|
|
|
can u make CFont* pFont to be member of the class.
Величие не Бога может быть недооценена.
|
|
|
|
|
still the it"s giving the same problem...
the font of the selecteditem in the combobox changing to olderfont when clicking on the combobox
|
|
|
|
|
When i changed the property of combobox from CBS_DROPDOWNLIST to CBS_DROPDOWN while creating combobox dynamically....but the CBS_DROPDOWN gives editablecombo which is not accepted in my case..
|
|
|
|
|
The other thing I would recommend you look at is MapDialogRect[^], so you can use dialog box units, just like you would if you're doing a resource driven layout, and get them transformed to pixels like CreateWindow uses.
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Hi All,
Can anybody tell me how to retreive IP address of a server pc from client pc.
Regards,
Abinash
|
|
|
|
|
Just refer [^]
Величие не Бога может быть недооценена.
|
|
|
|
|
Hi
How to print content of a txt file using VC++.
Thanks in advance
|
|
|
|
|
|
Hi can anybody give a sample for WritePrinter function , i am confused about getting handle to the printer ,which is obtained by using OpenPrinter function.
OpenPrinter("Printer_Name" ,&pHandle ,NULL )
From the above code ,I am confused about getting printer name, 'cos
suppose I am using more than one printers ,it is not possible to hardcode the printer name.How to get selected printer name?
thanks 
|
|
|
|
|
Use GetDefaultPrinter() to get the name of the default printer. If you want the user to select a different printer, use PrintDlg() .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Thanks 
|
|
|
|
|
The steps:
1. StartDocPrinter
2. StartPagePrinter
3. WritePrinter
4. EndPagePrinter
5. repeat 2, 3, 4 for as many pages as necessary
6. EndDocPrinter
When you are trying to print a text file directly to a printer, there will be no format information such as font, color, etc sent to the printer. The printer will use its default font to print the text file in its natural text flow. The result is not pretty.
|
|
|
|
|
Hi
How to format data before printing ?
thanks
|
|
|
|