|
Hi,
I have a Pdf file which I want to run from my Application.
I want to restrict copy access to a file when I open the file using the my application.
Can I restrict access to that Pdf file by placing a lock on that file? So that only my application accesses it and no one can access the file.Is that a possible Solution?
Any Suggestions would be helpful.
Thanks
Today is a gift, that's why it is called the present.
|
|
|
|
|
narayanagvs wrote: when I open the file using the my application.
Through which API ur opening the file? Another applications, such as explorer cannot copy a file if it is already opened with the share deny ready permission.
Check the "DWORD dwShareMode" parameter in the CreateFile() API.
|
|
|
|
|
narayanagvs wrote: Can I restrict access to that Pdf file by placing a lock on that file? So that only my application accesses it and no one can access the file.Is that a possible Solution?
You mean using a semaphore ? If that's the case, then the answer is no. A semaphore has to be used by all parties that want to access a resource (whatever it might be). So, in all the programs that wants to access the resource, they need to use the same semaphore.
If you lock your file in your application through a semaphore, nothing prevent explorer (for example) to open the file (because it doesn't use a semaphore to open the file).
|
|
|
|
|
Cedric Moonen wrote: You mean using a semaphore ? If that's the case, then the answer is no
If not semaphores, Is there any way to do that?
Thanks
Today is a gift, that's why it is called the present.
|
|
|
|
|
When you open the file, use the exclusive flag. As Cedric said, semaphores have nothing to do with this.
Judy
|
|
|
|
|
Hi,
when I compiled this code
if ( testvar == 10 )<br />
strTestVar = "Test1";<br />
else<br />
strTestVar = "Test2";
Then compiler prompt me the error "illegal else without matching if", but when I changed the code to
if ( testvar == 10 )<br />
{<br />
strTestVar = "Test1";<br />
}<br />
else<br />
{<br />
strTestVar = "Test2";<br />
}
then code compiled successfully.
Can any one please explain why is it so?
Best Regards,
Mushq
Mushtaque Ahmed Nizamani
Software Engineer
Ultimus Pakistan
|
|
|
|
|
Maybe you used of two statements in if without {} or use of two elses.
|
|
|
|
|
is the code inside some other if's? the code compiles on mine correctly (VS2005). just included the declaration of the 2 variables used.
|
|
|
|
|
Can any body help me to scale an image of size=307*257 (BMP 8 bit grayscale) to size=157*157
Thanks in advance
|
|
|
|
|
|
|
what do you do with the image anyway? do you load to your program and display it? as suggested by Hamid you can use StretchBlt, or in LoadImage there is already a setting there to set a desired size for you image.
|
|
|
|
|
i already have the image pixel array as a two dimensional matrix in my program.i just want to resize it to the desired form.
|
|
|
|
|
Is your output going to be a resized two dimensional array? Or you only need to resize its the image (no need for the matrix to be resized)?
If you are going to resize the two dimensional matrix, what I can only think of is to load the image to a CDC handler (through SetPixel), resize it (using StretchBlt), and use the GetPixel to pass the pixel data to a new resized matrix. This though will take some time (if the image is very large).
If you only need the image to be resized, you can use the StretchBlt after setting the pixels to the CDC handler.
|
|
|
|
|
Thanks it works.Thanks a lot
|
|
|
|
|
Hello everyone
I'm doing a single client server application.
After receiving a file from the client, server gets closed with the following exception.
Debug assertion failed!
Program: path of file
File: winhand.cpp
Line: 229
But the file is getting transferred correctly. And i need to send more than one file without connection being closed.
Plz help...
|
|
|
|
|
First use GetLastError() to check the error number and find out what the exact problem is. It may be in either application which closes the socket after receiving/sending. Or it can be possible that the socket was declared locally inside a function, that's why on exit the socket is released. Try GetLastError first to check the error code. Also you should put some checking on the returns of the socket functions to check if the function was successful, otherwise it wouldn't have been generating assert errors like that, just failure to do the functions correctly.
|
|
|
|
|
|
Hello to every body,
IShellFolder::EnumObjects(.....) In this method, if we pass
"SHCONTF_INCLUDEHIDDEN" then it includes hidden items for enumeration, but there is no flag for "Protected System Files". What should I do if I want "system files" to be included for enumeration as well?
Thanks in anticipation.
Best Regards,
Yasir Nisar
|
|
|
|
|
Does anyone know of a CTreeCtrl-derived class that supports undo/redo of operations like move, copy, delete?
|
|
|
|
|
Is there such a function or property?
|
|
|
|
|
*** WRONG FORUM. Sorry. C++ and C# look the same at first... ***
|
|
|
|
|
What do you want to know?
|
|
|
|
|
An SDI project without doc-view support.
MFC doesn't call OnKeyDown either in CChildView or CMainFrame.
|
|
|
|
|
Add a WM_SYSKEYDOWN handler to your CChildView or CMainFrame and you will be able to process the down event of VK_F10.
|
|
|
|