|
how to create Transparent Bitmaps using win32
|
|
|
|
|
|
I am writing a program that will delete file(s) in a specified folder except file(s) in used.
Please show me how to check whether a file is using or not.
(Use C/C++ Non-MFC)
Thanks a lot
Sincerely
Thangnvhl
|
|
|
|
|
may be:
HANDLE hFile = CreateFile("test.txt",GENERIC_WRITE,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL ,NULL);
if(hFile == INVALID_HANDLE_VALUE){
if(GetLastError() == 5 || GetLastError() == 4)
{
//this file is being used
}
}else
{
CloseHandle(hFile);
}
|
|
|
|
|
aldo hexosa wrote: if(GetLastError() == 5 || GetLastError() == 4)
Why use constants? It would be much more readable to use:
if (GetLastError() == ERROR_TOO_MANY_OPEN_FILES || GetLastError() == ERROR_ACCESS_DENIED)
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
an alternative way i think is to use the OF_SHARE_EXCLUSIVE flag as the third argument for the OpenFile() function.
May all beings be happy and free...
|
|
|
|
|
Hi, Expert,
Now I'm implementing a encrypt software, all file is encrypted in a folder,
But when user wanna excute the file, I need decrypt the file and use CreateFile and WriteFile function copy it to a temp file. Then use ShellExecute let user can excute the file. when user edit and save the temp one, I'll encrypt back to the origin encrypt file.
Now my problem is, After user close the file, I need delete the temp one, because all it's content is not encrypt.
I search long time on internet, Can't use "open exclusive" to check is the file opened, because it can't detect notepad or ultraedit, also can't search the window's title to check have the file name or not, because some program may not show file name on window's title.
I found CreateFile have a param FILE_FLAG_DELETE_ON_CLOSE, but can't figure out how to solve my problem, or can you provide any other solution? Thanks!!
|
|
|
|
|
Check the following APIs
FindFirstChangeNotification(....)
ReadDirectoryChangesW(....)
that may help you
RinuRaj
|
|
|
|
|
rockryan wrote: Can't use "open exclusive" to check is the file opened, because it can't detect notepad or ultraedit
I'm not sure about notepad, but when UltrEdit opens a files it first creates a snapshot, reads the file, then closes the handle. I.e. It makes a copy of the file first and uses this copy for all it's read and write operations. If you are creating encrypted files, it is generally a bad idea to write anything unencrypted back to the HD.
|
|
|
|
|
does anyone know how to clear view in SDI form ?
thanx alot
|
|
|
|
|
What does this mean? Do you want to content drawn on view?
|
|
|
|
|
Invalidate and draw nothing.
--
======
Arman
|
|
|
|
|
How you draw on form did you use Invalidate
|
|
|
|
|
Hey, anyone know how to create a root certificate for code publishing?
I'm going to root through MSDN, but was hoping someone might be able to point me in the right direction.
|
|
|
|
|
Hello members,
the standart button (IDC_BUTTONX) in VC++ 6.0 contains only the Click- and the DoubleClick-Event. Is there a way to detect, if the left or the right mouse button was clicked on the button.
I hope, anyone can help me
Juergen
|
|
|
|
|
By default, the mouse click events handled by a button control are left clicks only. Right clicks are not handled for button controls.
Best,
Jun
|
|
|
|
|
Hope I understood your question
if you write a drived class CButton and declare Rclick on this class then you can use Rclickbutton
|
|
|
|
|
How to use WIA in VC 2005,I have read the tutorial and understand it,but it is not working as it should be i have a camera installed and it is also being used by window application like window movie maker.but my VC++2005 application is not able to enumerate and get properties off devices installed.Kindly someone please help me.
Tasawar Gulzar
|
|
|
|
|
did you look at the WIA Sample on MSDN[^]
"Alot of the people on this forum are incredibly stupid, thinking that the internet is real" Score: 1.0 in the Soap Box
led mike
|
|
|
|
|
I have written that i have read and applied tutorial.offcource these tutorial were from MSDN
Tasawar Gulzar
|
|
|
|
|
Yes but the sample could be built and then run to test with your hardware correct? Have you don that?
"Alot of the people on this forum are incredibly stupid, thinking that the internet is real" Score: 1.0 in the Soap Box
led mike
|
|
|
|
|
yes i have done that.if you have experience of that when u have a pointer of roperty storage to all the device attached. my device is attached and working properly but my the property storage pointer is null this mean that my application is not getting any pointer to any of the devices.I hope if u have WIA expeience you understand what i am sying and what is my problem
Tasawar Gulzar
|
|
|
|
|
tgchuhan wrote: I hope if u have WIA expeience you understand what i am sying and what is my problem
No I have NO WIA experience. I do however understand that if the "sample" project works with your hardware and your application DOES NOT, then there is a problem with your code. I still cannot determine from your posts if the "sample" application works with your hardware.
"Alot of the people on this forum are incredibly stupid, thinking that the internet is real" Score: 1.0 in the Soap Box
led mike
|
|
|
|
|
I have a propertypage and the first page is a listctrl. The whole
propertypage is a listctrl.
If I put alot of data in the listctrl, scrollbars to the right
appear on the listctrl and they also appear on the propertypage.
Is there any way for the listctrl and the propertypage to sort of
become one or work together more? I dont like the 2-scrollbars but I
can probably figure out a way to remove the scroll from the property
page. If I try to increase the width of the propertypage, the listctrl
doesnt increase with it. Instead a gap appears between the listctrl
and propertypage end. I tried making the first propertypage a ListView
but I could get it to compile.
My main question is, is there a better way for the listctrl and property
page to work together? Any response, any sample project, any direction
any one can give me will be greatly appreciated.
Sincerely,
Danielle Brina
|
|
|
|
|
I'm a little confused.
Do you want the property page to actually grow vertically together with the list control if the data in the list control overruns the initial size?
Why don't you just fix the size of the list control AND the property page and allow the list control's vertical or horizontal scroll to do its job?
Mark
|
|
|
|