I did in the end copy the file to a temporary file which gets destroyed on destruction. Thanks all for your help.
Iain Wiseman
Posts
-
Lock a file -
Lock a fileI am simply after in one process being able to prevent someone else opening a file whilst I am reading it. I do not have control over the opening of the file as this is done within the Xerces library. The file is an xml file hence the use of xerces. Once I have completed the read I want to sometimes delete the file. Ideally I would have like to in my process Check I have exclusive rights to the file Read it using xerces Delete it
-
Lock a fileIf this isn't correct then is there something that is? It seemed to work when I ran a separate process with the same code and put a pause in it. I totally sure you are right. If you do know the right combination I would be grateful. It seemed such a simple thing to want to do. Iain
-
Lock a fileSolved by using
GENERIC_READ and FILE_SHARE_READ | FILE_SHARE_WRITE
-
Lock a fileI want to disable other processing from locking the file. When I use CreateFile, this works except it also prevents Xerces from reading the file so the code looks a little like this
m_Handle = CreateFile(
TEXT(inFullyQualifiedPath.c_str()),
GENERIC_ALL,
0,
NULL,
OPEN_EXISTING,
NULL,
NULL);m\_ConfigFileParser = new xercesc::XercesDOMParser; m\_ConfigFileParser->parse(m\_Filename.c\_str());
The reading of the file fails because Xerces cannot open the file.
-
Lock a fileThis looked easy but it wasn't I want to 1/ Test if I have rights to delete a file 2/ lock it 3/ read it 4/ delete it This is all in one process Gave up on 1/ but tried to use CreateFile to lock it and found xerces-c was not able to access the file for reading in the same process. Any pointers (no pun intended). Not .net just C++/Win32 Thanks Iain
-
Brightness and Contrast JpegHi, Great fan of the codeproject and the people who contribute. I want to provide the ability to change a jpeg brightness and contrast. Peoplae have suggested that I want a Window/Level approach. However I am not an Image processing guru (and I mean that). I did what any thickie might do and banged the Window/Level into google. This seems to comeback with cxImage and vtk. So far, vtk seems to play nicely with Windows Forms and I have not investigated cxImage. I am not a MS guru either (I know it gets worse), but know enough to create application can call unmanaged C++. Regards, Iain
-
Proxy Classes - Copy/Paste Pre-compilerHi, Firstly thanks for replying. I think the original is a code management one. As I said I don't have the detail behind why they are where they are. I think but don't know, that they have some common functions which are split across various projects. They generate the proxy classes and need to ensure all services have these new generated types. I believe they new some of the code a function level to be copied into the other projects. I have googled for cut and paste from proxies and it does seem that there are few people fallen into this trap in one way or another. Regards, Iain
-
Proxy Classes - Copy/Paste Pre-compilerHi, Firstly I am currently a Project Manager so I don't have the detail I would probably have if this was an Open Source issue which I am more familar with. Anyway enough of the caveats. My understanding is the team create Proxy Classes using WSDL.exe. These classes and then cut and paste into other code which uses them. Please please please don't ask why, accept it does and if you are still reading read on. What I want to know is, Does anyone know of any code which could be used to automate this. I was thinking, project managers can, that a pre-compiler of some sort could solve this. E.g. in the source which need to have the pasted code you could have. // #AUTO_GENERATED_SOURCE_FILE:Auto_GeProxy_Class.cs #FUNCTION_TO_COPY:My_Foo() Then make a tool which pre-processing this appropriately. People are using VS2008 Thanks for listening.
-
SSISThanks all, I come from an open source background and want to treat my colleagues who use microsoft fairly. All I want is the number of records in error and possible which they are. I assume that once you have a package to load them theat error reporting was easy. Reading this SSIS does not provide this easily. With oracle PLSQL this would simply be looking at a return code and doing something. I will ask the developer how to proceed.
-
UTF-8 need helpSo are you restricted to C because of a technology choice. You are using Microsoft. You need to look for support for "locale". Possibly can help but google is your friend.
-
SSISHi, Thanks for replying. So you are saying that you cannot ignore errors easily in SSIS and count them. I C++ or java or C# this would be a try, carch cout which is a matter of minutes. I had hoped that microsoft would have made this easier. Iain
-
UTF-8 need helpIs this using microsoft products. If so then why the need for C rather than C++. Might be able to help Iain
-
coloring a button -
SSISHi all, Hope this is in the correct forum. I have an issue with some work I am involved in. We have a flat file we are loading into an MSSQL database which is failing on the insert because the original flat file contains suspect data. Invalid dates or values etc. We are using SSIS to load this data. Can someone tell me if it is possible to exception these records easily. requirements are - to identify the number of records with the problem - to identify these records - to manage the issues which error I am a project manager and do not want the wool pulled over my eyes. I am familar with C# and SQL server but have only seen SSIS over a shoulder of a developer. I believe this would be a simple change and would be a matter of minutes to resolve. I am currently being led to believe it is hard. Thanks all
-
autocomplete selectionIt was to keep the selection down to something reasonable. All works now thanks for your help.
-
autocomplete selectionYes you are correct. It appears that calling _TextChanged everytime resets the focus E.G. private void textBoxFirstName_TextChanged(object sender, EventArgs e) { if (textBoxName.Text.Length > 4) { getAutoCompleteSuggestions(); } } I have changed it to if (textBoxName.Text.Length == 4) To solve this It does seem to crash a lot too in debug but I will save that for another day
-
autocomplete selectionHi, Sorry this is gonna sound stupid I expect but here goes Using m_AutoCompleteStringCollection = new AutoCompleteStringCollection(); textBoxName.AutoCompleteMode = AutoCompleteMode.Suggest; textBoxName.AutoCompleteSource = AutoCompleteSource.CustomSource; textBoxName.AutoCompleteCustomSource = m_AutoCompleteStringCollection; How, without a mouse, do you select an item for an autocomplete textbox? I have tried key down on the keyboard but that just makes a selection of the first item. I want the user to be able to select any item or type their one choice. This is going to be used as a login where the name can be a known name or a visitor. Thanks, Iain