|
If the file exists but you can't open it for exclusive read access, you can safely assume it's locked by another process. Assuming you're using MFC, see CFile for more information.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi,
thanks, but i don't want to use CFile.
After checking i want to delete the file.
Is there any win32 way ? I've read now that CreateFile can check this. But is not sure about the arguments.
Hari Krishnan
|
|
|
|
|
HFILE hFile = OpenFile(..., OF_SHARE_EXCLUSIVE);
if (HFILE_ERROR != hFile)
{
DeleteFile(...);
}
|
|
|
|
|
I have followed the instructions for C. Lung's VERY helpful article from 1999 on calling a VB ActiveX Dll from c++. I have built my VB dll that I have (which has 24 classes and 1 .bas file), and I used the midl compiler to compile the .idl file that I made by copying the code crom OLE View, as the article instructs. Now that I have the .idl files and the .c files which correspond to my VB DLL loaded into my C++ project, I get the following error when I try to build (F7) my c++ project.
"fatal error C1010: unexpected end of file while looking for precompiled header directive". I cannot figure out the cause of this error.
The only thing I have done that was not mentioned in Lung's article is change some data type specifications in the idl file which were causing error messages from the midl compiler. I changed "Single" to "float" and, I replaced the name of a VB enum I had created with a "Long" data type.
Please advise, or ask more questions, if I have not provided enough info.
Thank you VERY much, in advance, for any help you can provide!
rajdawg - a.k.a. Roger
|
|
|
|
|
|
The product I'm working on is still in the stage where I'm releasing debug builds. I have asserts in place for things that I want to see, but aren't actual application failures. What I'd like to do is augment assert so that places where I want to see an assert, I'll get an assert, but not when a debug build leaves my desk. I could just add a define and have not only a debug build configuration, but also a private debug build configuration. But ideally, I'd like to detect at runtime whether the app is running in the debugger or not, and key this behavior (and a few others I won't go into) off of that information. Does anyone know a way to do this?
|
|
|
|
|
|
Brian Tietz wrote:
The product I'm working on is still in the stage where I'm releasing debug builds.
You should never do that
(and btw. I think it's not allowed to redistribute the debug runtime dll's...)
Here on CP you'll find some tools how to convert your _ASSERT's into release-build log file entries. It's better, really.
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
Hi guys and girls,
Where can I find resources about OE plug-in (or add-in) development? I this feature only avaitable in Outlook 2000 or better?.
Thanks in advance.
"When I look into your eyes, there´s nothing there to see, nothing but my own mistakes staring back at me"
|
|
|
|
|
Hi there, now I have a problem with my buffer.
I have a buffer reading in data from the serial port data is passed into the buffer like this
m_serialbuffer += ch;
Now this works perfectly for the first string that is sent to the port and stores it. For subsequent strings though, no characters are added. Any ideas??
andy
|
|
|
|
|
Is there a chance for the NULL character '\0'? CStrings are NULL terminated.
John
|
|
|
|
|
|
If there is a zero (ASCII 0 not the number 0) in the input the CString will not add any more characters.
John
|
|
|
|
|
hmm yes I think there is a zero on the end of the first string. How can I get around this?
|
|
|
|
|
Either strip the 0 with an if statement or use an array like CArray or vector.
John
|
|
|
|
|
Nice one many thanks
Andy
|
|
|
|
|
Appending 0-terminated strings to a CString object is expected.
char *name = "David";
CString str = "My name is ";<br />
str += name;
|
|
|
|
|
The comment in this code snippet appears to be outdated.
Have you stepped into the code to verify that 'ch' has valid data at the time of appending? When you state that "ch is a string", does that mean it is a string object, or are you using string in the generic sense (e.g., char ch[32])?
|
|
|
|
|
Hi there, I'm trying to do overlapped IO on the serial port, but since I changed from non-overlapped the readfile and writefile calls fail with error
incorrect function
I changed the following
m_ComPortHndl = CreateFile (sComPort,GENERIC_READ|GENERIC_WRITE,0,
NULL,OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,NULL);
i.e. added the file flag overlapped
and also added overlapped structures to the read/write calls
ReadFile( m_ComPortHndl, &nData, 1, &dwBytesRead, &ovRead)
any ideas why I might be getting this??
Andy
|
|
|
|
|
Scratch that it was because I wasn't initialising the overlapped structures to zero
OVERLAPPED ov = {0};
Andy
|
|
|
|
|
example to forbiden and start it........
|
|
|
|
|
what to do if I get an error like:
LINK : fatal error LNK1104: cannot open file "mfc42u.lib"
Error executing link.exe.
|
|
|
|
|
You probably didn't include the MFC Unicode libraries when you installed VC. Run the install again and install them.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
|
Hi, everyone!
What is the function of "#pragma pack(1)"? Anyone can give
me a simple explanation? Or introduce some materials on this
subject?
Thanks in advance,
George
|
|
|
|