|
Sakthiu wrote: I need to show the staus information...
Of what? The file-find progress, or of the files themselves? Be more specific about what you are after.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Sakthiu wrote: I need to show the staus information on the STATIC control of that dialog while processing.
Do you want that static control should show the current accessed file or directory?
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Do you wan to set a progress bar for files 1,2,...1000 ?
|
|
|
|
|
Why WM_ERASEBKGND, since all the paintings can be done with the WM_PAINT itself?
- NS -
|
|
|
|
|
In general the WM_PAINT handler will not "touch" every pixel: it might just write some text in the corner for example. Still the entire client area need to be updated if its dirty. Thus the two stage painting.
Steve
|
|
|
|
|
OK... that i know.
But my doubt is, since WM_PAINT will update enough area in the window, is WM_ERASEBKGND necessary? And i could find out that if a WM_ERASEBKGND message is sent, WM_PAINT will be surely sent after that to update the whole area. So i think there is no need to process WM_ERASEBKGND to draw anything.
- NS -
|
|
|
|
|
NS17 wrote: But my doubt is, since WM_PAINT will update enough area in the window, is WM_ERASEBKGND necessary
It depends. If your WM_PAINT handler paints every dirty pixel then you don't need WM_ERASEBKGND . If, as is generally the case, the WM_PAINT handler only touches a subset of the dirty pixels then without the WM_ERASEBKGND handler the dirty pixels not painted will still be dirty. It depends on your application.
You can handle the WM_ERASEBKGND message and return 0 to stop the erasing if you want to.
Steve
|
|
|
|
|
Stephen Hewitt wrote: as is generally the case, the WM_PAINT handler only touches a subset of the dirty pixels then without the WM_ERASEBKGND handler the dirty pixels not painted will still be dirty
Could you please explain a little more?
- NS -
|
|
|
|
|
The WM_PAINT does not always paint the whole of the DC, it is passed an 'update region' which is a series of 'dirty' rectangles. Lets say you drag a button around on your window. The rectangle for the new position is passed to WM_PAINT, without the WM_ERASEBKGND The rectangle of the old position would not be filled in, causing a trail effect. The button will only paint within it's own bounds ( the first rectangle ) since it knows nothing of lies beneath it.
In most cases WM_ERASEBKGND is not required, but if there is anythig on your main window that changes appearance ( uncovering pixels beneath it ) then this message will fill in those pixels giving WM_PAINT a fresh canvas.
There are a few class styles that also effect the painting of a window, CS_VREDRAW, CS_HREDRAW, CS_CLIPCHILDREN, CS_CLIPSIBLINGS to name a few...
|
|
|
|
|
WalderMort wrote: The rectangle for the new position is passed to WM_PAINT, without the WM_ERASEBKGND
...but from Spy++ tool I found that WM_ERASEBKGND is also coming while dragging a message box over a window (I used notepad).
- NS -
|
|
|
|
|
Just like with my example using your window and a button, the desktop is itself a window, when you move a window over yours, those pixels are erased, the desktop is telling your window that it is now uncovered and should fill in those uncovered areas.
|
|
|
|
|
Can anyone show a condition when WM_PAINT is sent but WM_ERASEBKGND is not? or when WM_ERASEBKGND is sent but WM_PAINT is not?
|
|
|
|
|
If you use InvalidateRect(...,..., false) then only WM_PAINT is sent. If you use InvalidateRect(...,..., true) then WM_PAINT is called and when you use 'BeginPaint' inside WM_PAINT it calls WM_ERASEBKGND (when WM_ERASEBKGND is called, the Invalid rectangle is nullified).
In a normal circumstance the Invalidate rectangles received in WM_ERASEBKGND and WM_PAINT are same.
|
|
|
|
|
Hi
I think this is depend on how the window be update. When you call Invalidate(...), you can specify the erase background occuer or no. I think when you want to update only an item in the window like a button in the toolbar NOT all window area, WM_ERASEBKGND is not needed because not change made in other places of the window.
Kind Regards. mrjavadtaheri@gmail.com
|
|
|
|
|
Whether it is background or foreground you draw on same DC. This is only an option given to you to separate background and foreground. The usefulness comes when 'InvalidateRect' etc. are called in the program. Normally, WM_ERASEBKGND and WM_PAINT both get called ('resize' say). If you use InvalidateRect(...,...,false) only WM_PAINT gets called. If you use InvalidateRect(...,...,true) then WM_ERASEBKGND gets called when you use 'BeginPaint' inside WM_PAINT.
|
|
|
|
|
Thanks! But why a reply now, after years? (just due to curiosity) - ns ami -
|
|
|
|
|
Hello everybody!
Is there any way to start an application at bootup!
for eg:
a program to display the date of the day when the user has logged in!
If you happen to know the concept,I humbly request you to kindly respond me!
Thanks in advance!
Shalini
|
|
|
|
|
ShaluMalu wrote: Is there any way to start an application at bootup
Add the path of the exe that u want to run on startup under the following key in registry
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
nave
|
|
|
|
|
How about a shortcut in the StartUp folder below the Start menu?
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
|
|
|
|
|
Since you mentioned bootup, and not at user logon, using the startup folder or the Run key will not work as they require a user logon to take place. If you really want to use the Registry, you need to use the following key:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices or RunServicesOnce Note that the Run key is also ignored in Safe Mode.
However, I would suggest a Windows Service. They are designed to be started when the system starts, and will be running when a user logs on and will remain running after a user logs off. They can easily receive for logon/logoff events.
If you need finer control the point where your application starts, I think you would have to go the driver route.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> 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! See DeleteFXPFiles
|
|
|
|
|
i have creating the file with WriteFile function.in the following way.
The File has created in the XML form.
but when i tried to open it in EXPLORER .
it gives me following error.
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------
An invalid character was found in text content. Error processing resource 'file:///D:/Encoder_user_siteid.xml'.
i am going to write file is following
----------------
<filelist><listitem type="file" order="0"><filename>C:\Documents and Settings\Amit\Desktop\MediaFiles\TT.wmv</filename><extension>wmv</extension><size>494 KB</size><Duration>00:00:38</Duration><Bitrate>103 Kbps</Bitrate><Type>Windows Media Audio/Video file</Type><modifydated>11/22/2005</modifydated></listitem></filelist>
//////////
actual display following in the edit mode.
-----------------------
ÌÌÌÌZ× ÌÌÌÌÌÌÌÌÌÌÌÌB" u" ÌÌÌÌÌÌÌÌ ÌÌÌÌÌÌÌÌ" ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ" ÌÌÌÌÌÌÌÌ / 2 2 / 2 0 0 5 i a A u d i o / V i d e o f i l e D e s k t o p \ M e d i a F i l e s \ T T . w m v ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ$«¥ôdæ ½(E àå ´B V Hæ µÙA ' ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌLÂE ÂE øÁE àÁE ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌð®¥ôæ ‡Ôw ' µÙA Í«ºÜ Hæ µÙA tæ ë‡ÔwµÙA  '
////////////////////////////////////
code for that is below (in short ,listview content is transfer in the xml file)
i am passing the listview handle to the _WriteXml function.
///////////////////////////////////////
void _WriteXml(HWND hList)
{
TCHAR buff[MAX_PATH];
LRESULT iCount=ListView_GetItemCount(hList);
size_t i,j;
string startstring;
for(i=0;i<iCount;i++) //for row
{
for(j=0;j<8;j++)//for column
{
ListView_GetItemText(hList,i,j,(LPWSTR)&buff,MAX_PATH);
std::wstring buff_input(buff);
if(j==0)
{
std::string bufferstrig(buff_input.begin(),buff_input.end());
string substring= bufferstrig.substr(bufferstrig.find_last_of("\\")+1,bufferstrig.length());
string addtag="\"\>";
char sub1[20];
sprintf(sub1,"%d",i);
string s=sub1;
if(substring=="")
startstring="<listitem type=\"dir\" order=\""+s;
else
startstring="<listitem type=\"file\" order=\""+s;
startstring+=addtag;
startstring=startstring+"<filename>"+bufferstrig+"</filename>";
}
if(j==1)
{
std::string bufferstrig(buff_input.begin(),buff_input.end());
string extension=bufferstrig;
startstring= startstring+"<extension>"+extension+"</extension>";
}
if(j==2)
{
std::string bufferstrig(buff_input.begin(),buff_input.end());
string size=bufferstrig;
startstring=startstring+ "<size>"+size+ "</size>";
}
if(j==3)
{
std::string bufferstrig(buff_input.begin(),buff_input.end());
string Duration=bufferstrig;
startstring=startstring+"<Duration>"+Duration+"</Duration>";
}
if(j==4)
{
std::string bufferstrig(buff_input.begin(),buff_input.end());
string Birarate =bufferstrig;
startstring=startstring+ "<Bitrate>"+ Birarate+ "</Bitrate>";
}
if(j==5)
{
std::string bufferstrig(buff_input.begin(),buff_input.end());
string Type=bufferstrig;
startstring=startstring+"<Type>"+Type+"</Type>";
}
if(j==6)
{
std::string bufferstrig(buff_input.begin(),buff_input.end());
string Modifdate=bufferstrig;
startstring=startstring+ "<modifydated>"+Modifdate+"</modifydated>";
}
/*if(j==7)
{
std::string bufferstrig(buff_input.begin(),buff_input.end());
string size=bufferstrig;
startstring=startstring+"<size>"+size+"<size>";
}*/
if(j==8)
{
std::string bufferstrig(buff_input.begin(),buff_input.end());
string Protected=bufferstrig;
startstring=startstring+ "<Protected>"+Protected +"</Protected>";
}
}
startstring=startstring+"</listitem>";
}
HANDLE hFile;
startstring="<filelist>"+startstring+"</filelist>";
hFile = CreateFile (_T("D:\\Encoder_user_siteid.xml"),GENERIC_WRITE, 0, NULL,CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL) ;
DWORD iBytesWritten=0;
BYTE amit =startstring.length();
bool hResult=WriteFile(hFile,&startstring,(amit+1)*sizeof(string),&iBytesWritten,NULL);
CloseHandle (hFile);
}
should i have to trim the startstring?
if so, then how do trim it i am tring to find the function, i had implement this with adding string.h
and iostream includes. e.g trim(startstring);
but function didn't work.
what should i do to see my xml file?
after wrting this file i hev to read this file.
i had found the problem with intial first charatcters might be take unicode or other.
so how i handle it.
Best Regards
Amit.
|
|
|
|
|
Change this:
bool hResult=WriteFile(hFile,&startstring,(amit+1)*sizeof(string),&iBytesWritten,NULL);
to this:
bool hResult = WriteFile(hFile, startstring.c_str(), startstring.length(), &iBytesWritten, NULL);
There are other problems. For example, why use a BYTE below?
BYTE amit =startstring.length();
std::string::size_type is the correct type to use here.
On a last note, why use WriteFile at all? Use std::ofstream instead. Avoid needlessly mixing the low-level (WriteFile ) with the high-level (std::string ).
Steve
|
|
|
|
|
Thanks ,
i had suddenly strike in my mind, when you just write low level.
it means ,
Basically WriteFile/ReadFile use for operation on port coming data.like data coming from COM1 or from the other device or resource. is it?
or if i am wrong then please explain me the difference.
i have changed the code following now its working.
<br />
<br />
startstring="<filelist>"+startstring+"</filelist>";<br />
std::ofstream out;<br />
out.open("D:\\Encoder_user_siteid.xml", ios::out);<br />
out<<startstring.c_str();<br />
out.close();<br />
<br />
Amit
|
|
|
|
|
amitmistry_petlad wrote: Basically WriteFile/ReadFile use for operation on port coming data.like data coming from COM1 or from the other device or resource. is it?
or if i am wrong then please explain me the difference.
Those two functions can be used for many things, COM ports included.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
then what's the difference?
|
|
|
|