|
The following is a code snippet for checking the subdirectories.
This code is crashing in the highligted line when sStr is "C:\".If it is "D:\" or "E:" it is working.
void CBatchPrintDlg::ChkForSubDir( CString sStr, HTREEITEM hTree )
{
struct _finddata_t c_file;
long hFile;
::SetCurrentDirectory((LPCTSTR)sStr);
if( (hFile = _findfirst( "*.*", &c_file )) != -1L )
{
if ( IsDirectory ( c_file.attrib ) )
InsertItemTOTree( (LPCTSTR)c_file.name, hTree );
//m_tree.InsertItem((LPCTSTR)c_file.name, hTree );
while( _findnext( hFile, &c_file ) == 0 )
{
if ( IsDirectory ( c_file.attrib ) )
{
InsertItemTOTree( (LPCTSTR)c_file.name, hTree );
//m_tree.InsertItem((LPCTSTR)c_file.name, hTree );
//break;
}
}
_findclose( hFile );
}
}
Please help.
Thanks.
|
|
|
|
|
sheetal_06 wrote: "C:\".If it is "D:\" or "E:"
Do all of these have subdirectories ?
|
|
|
|
|
ya all have sub directories.
|
|
|
|
|
Since you are using MFC, why not utilize CFileFind ? It's much cleaner. What exactly is your code supposed to be doing? There's no need to call SetCurrentDirectory() .
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Are you sure sStr is C:\ when you got error and also why you dont use of value return of SetCurrentDirectory?
|
|
|
|
|
Hi all,
I'nm trying to read the data in a UDL file, but I think it is binary(despite being readable in Notepad), and all my attempts to read one has failed, generally getting some gibberish such as "y;[" and a load of blank spaces.
Can anyone help me in this regards
Many Thanks
Regards,
-- modified at 4:43 Thursday 19th July, 2007
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Take a look at this article here; scroll down and look at the "Binary files" section
Hope this helps!
--PerspX
"Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates
|
|
|
|
|
Thanks for the response, I've tried it, but with this result:
memblock="y;["
Isn't a udl file in unicode ??
If so how would one do it ?
Thanks again ...
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
I could not find the specifications for ‘.udl’, but I saw no indication that it has to be Unicode (just statements like plain text). I would open it as plain text, Unicode, and binary with a hex editor and look at it closely. After that a little research should provide the answer.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Assuming this file is in UTF-16 encoded UNICODE, ie every character is a 16 bit word, Notepad may have put a header on the file to indicate this (despite it supposedly being plain text ). I would try opening it in notepad and then saving in a separate file with UTF-8 encoding. Ordinary text processing code should then be able to read it. If not you've got a binary file.
If you have to read the unmodified UDL file then you'll need to find the size of that header ( I think it's four bytes but I'm not sure ), skip over it and then read wide characters a wchar_t or WORD or short at a time from the file.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
|
Hi,
I am using VC++ 6.0 for my project,in which I am using DialogBox and in
dialogBox I am using picture control.So i want to change picture at run time
so how can I do this.
Thanks and Regards
Atul Mahajan
|
|
|
|
|
Use the STM_SETIMAGE message. See the MSDN documentation for more information.
Hope this helps!
--PerspX
"Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates
|
|
|
|
|
Hi PerspX!
im using VC6.0, in my dialog based application if i try to load the bitmap with the following code in OnPaint() Function, its taking more memory and its not clearing,
CPaintDC dc(this); // device context for painting
HBITMAP m_Bmap;
CRect rect;
HDC memdc;
CString path,m_ifilename1,m_ifilename2;
path=AfxGetApp()->m_pszHelpFilePath;
for(int i=1;i<=path.GetLength();i++)
{
if(path.Mid(i,18)=="VTS_VC_0003_070605")
{
path = path.Mid(0,i+18);
break;
}
}
m_ifilename1 = path + "\\"+"3.bmp";
GetClientRect(&rect);
m_Bmap=(HBITMAP)::LoadImage(NULL,m_ifilename1,IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
memdc=::CreateCompatibleDC(dc.m_hDC);
::SelectObject(memdc,m_Bmap);
BitBlt(dc.m_hDC,0,0,rect.right,rect.bottom,memdc,0,0,SRCCOPY);
i need to know whether its possibble to load jpeg image in dialog background (to reduce the memory) ?
pls help me
thanks in advance
Abdul Khathir A.
|
|
|
|
|
What's the source of the bitmap? A resource? A File? What type of bitmap?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Thanks,I overlooked the docs."
|
|
|
|
|
You can use of SetBitmap with a new handle to bitmap.
|
|
|
|
|
Hi,
I have added functionality to add history in my list control by using the following function.
BOOL GetHistory(CStringList & list)
{
STATURL url;
CString strUrl;
ULONG uFetched;
IUrlHistoryStg2Ptr history;
IEnumSTATURLPtr enumPtr;
if(FAILED(CoCreateInstance(CLSID_CUrlHistory,
NULL,
CLSCTX_INPROC_SERVER,
IID_IUrlHistoryStg2,
( void**)&history)))
{
return false ;
}
if(FAILED(history->EnumUrls(&enumPtr)))
return false;
while(SUCCEEDED(enumPtr->Next(1,&url,&uFetched)))
{
if(uFetched==0)
break;
strUrl = url.pwcsUrl;
list.AddTail(strUrl);
}
return true;
}
Only IE history is added to my list control.How can i add history of other browsers also.
|
|
|
|
|
revanth1985 wrote: How can i add history of other browsers also.
Do they store history data in the C:\Documents and Settings\<user>\Local Settings\History folder?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
ya.only IE histroy is located in the above location.But if i browse using other browsers such as mozilla,opera etc,i am not getting the history.I want to load history of all the browsers in a list control.How can i go further?
|
|
|
|
|
revanth1985 wrote: But if i browse using other browsers such as mozilla,opera etc,i am not getting the history.
So where do they store their history information?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Actually i am not able to trace the path in which thay store their history information.
|
|
|
|
|
Why? Just visit some benign site that IE has not been used for, and then search for filenames, file contents, and registry entries for part of the URL.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
I created a Dialog based application "Sample" using VC 6.0 using the Wizard.
When I opened the resource file namely Sample.rc using a text editor,
I found
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 235, 55
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU.
What is the significance of the word DISCARDABLE above.
I removed the word and on compiling and running the application, could not
find any noticable change in any style.
MSDN was of no much help either.
|
|
|
|
|
Marimuthu.pesit wrote: MSDN was of no much help either
You simply have to refine your search...
http://msdn2.microsoft.com/en-us/library/Aa380908.aspx[^]
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.
|
|
|
|
|
Man, I miss 16-bit Windows
Mark Salsbery
Microsoft MVP - Visual C++
"Thanks,I overlooked the docs."
|
|
|
|