|
I get an access violation error when I do that.
- KK
|
|
|
|
|
plz ensure that the menu have submenus.
make a menuu of below structure( similar to a file menu in notepad ) and try
File
Open
Close
nave
|
|
|
|
|
I got it working. Thank you.
What I wanted is just one "EXIT" to be present in the right click menu.
So I just had EXIT in top most menu.
Then I added another item Exit in it's submenu and it works, shows only the submenu.
thanks again.
- KK
|
|
|
|
|
Hello comunity,
when i create an new file(CStdioFile) and write something in them i close it with CStdioFile::Close();,
but how to set the attribute FILE_ATTRIBUTE_READONLY to avoid that someone make changes at random,
my program need this file after create to work with them, and when is inside the file something
wrong my program want crash!
regards
break;
|
|
|
|
|
If I understood u right, you dont want another process to access the file when ur program is using it, to do this use CFile::shareExclusive with the Open operation.
if u open a file while in read-only, u cant write in it unless u clear this attribute, so that ur program crashes.
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
Im not sure I understand all you're saying but :-
assuming : - LPCTSTR lpFileName
DWORD dwFileAttributes = GetFileAttributes( lpFileName);
long mask = dwFileAttributes;
if( ! ( dwFileAttributes & FILE_ATTRIBUTE_READONLY))
{
mask = dwFileAttributes | FILE_ATTRIBUTE_READONLY;
if( ! SetFileAttributes( lpFileName, mask))
{
// Flag the error here
return;
}
}
is probably what you're looking for - your program would of course have to remove the readonly flag before it used the file - the suggestion above this is also valid (ie exclusive flag)
'g'
|
|
|
|
|
Hello Garth,
yes, this is that what im looking for!
but need some help again!
Please check this code:
<br />
DWORD dwFileAttributes;<br />
DWORD mask;<br />
<br />
dwFileAttributes = GetFileAttributes(csFileName);
mask = dwFileAttributes;<br />
<br />
if((dwFileAttributes & FILE_ATTRIBUTE_READONLY))<br />
{<br />
mask = dwFileAttributes & FILE_ATTRIBUTE_NORMAL;
if(!SetFileAttribute(csFileName, mask))<br />
{<br />
AfxMessage(csErrorMessage);<br />
}<br />
}<br />
<br />
cMyFile.Open(...);<br />
dwFileAttributes = GetFileAttributes(csFileName);
mask = dwFileAttributes;<br />
if(!(dwFileAttributes & FILE_ATTRIBUTE_READONLY))<br />
{<br />
mask = dwFileAttributes | FILE_ATTRIBUTE_READONLY;
if(!SetFileAttributes(csFileName, mask))<br />
{<br />
}<br />
}<br />
This is what im doing with your response!
Is this right, take a look to my sample please!
Maybe is not the best way, but they do wat i want!
with best regards
break;
|
|
|
|
|
I would have done :-
DWORD dwFileAttributes = GetFileAttributes( lpFileName);
long mask = dwFileAttributes;
if( dwFileAttributes & FILE_ATTRIBUTE_READONLY)
{
long mask = dwFileAttributes & (~FILE_ATTRIBUTE_READONLY);
if( ! SetFileAttributes( lpFileName, mask))
{
// Output Some sort of error here
// Could not make (file) READ WRITE
return;
}
// Good - Output Some Soft of Message here ?
// (file) Is Read/Write
}
not sure if that answers your question
'g'
|
|
|
|
|
Good morning!
yeah, that it's!
With best regards!
break;
|
|
|
|
|
I am trying to repair the Curroupted Ms Access .mdb file.
here i able to get and insert most of the data from the Curroupted file to new created file by using the function defined in MsAccess class msacc9.olb in VC++.
I able to read and inser most of the data but unable to insert image in the OLE data field.
Is there any code or any othe way to do so.
Pls help me realated to this.
Thank You
Nirmal
|
|
|
|
|
|
Is there any way to get wheel mouse to work in the Call Stack Debug window in Visual C++ 6.0?
Wheel mouse works in normal source code windows.
|
|
|
|
|
Do you need to three actions from mouse(L/R/M)?
|
|
|
|
|
How to differentiate which is folder and which is files at run time?
|
|
|
|
|
kiranin wrote: differentiate which is folder and which is files at run time?
See WIN32_FIND_DATA
The first parameter to this has the information about the file/folder attributes.
FILE_ATTRIBUTE_DIRECTORY-The handle identifies a directory.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
hi all,
I need to display the 'Browse For Folder' Dialog window, but I need to place it in a combo box instead of being a popup dialog, so can anybody help with this???
Thanks
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
You can insert your controls to it but for insert it to combobox I dont know why you want to insert it to combobox do you need to folders?
|
|
|
|
|
I dont want to display in a combo box so that it doesnt take much of the dialog area...
do u know how???
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
You can use from CTreeCtrl and see examples for file/folder with CTreeCtrl on codeproject did you see them?
|
|
|
|
|
Hi,
I am trying to develop a socket server which will communicat with Microsoft Office in LAN.
But I don't know even a small bit about socket server. Can anyone help me out? Please Reply as soon as possible.
Thank you.
|
|
|
|
|
You should go to the networking section of codeproject and pickup a begginers tutorial on sockets, its a long way to be discussed in a single post...
Regards,
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
Thank u 4 ur reply but cause i m very new in this site i could not reach at the place show by u, can u plz tell me the proper link of it such that i can view the tutorial. Plz.
|
|
|
|
|
|
Thank you for ur kind help and ofcourse fast reply.
|
|
|
|
|
Anyone knows where I can get the errata of <<c++ primer,="" 4th="">>?
If there is no, anyone wants to create it? If so, plz contact me!
P.S.
I have done:
1. There is no on Stanley B. Lippman's website(http://staff.develop.com/slip/) and blog(http://blogs.msdn.com/slippman/).
2. I can't google it.
3. Email to him(slippman@objectwrite.com).
Thanks!
=== Inside Wintel! ===
Who: DollfaceYY (杨洋)
QQ: 55780839
MSN: DollfaceYY@hotmail.com
EMail: DollfaceYY@163.com
URL: DollfaceYY.china-pub.com
|
|
|
|