|
mohiul wrote: Can anyone help me to run a process before winlogon?
You can create a service (they run without the need of anyone logging in).
You can also create an regular application and add it to the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
Items in this key run in the context of the machine and not any particular user.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
|
|
|
|
|
Hi,
I am running a unicode web application where data passed is in the form of MBCS. Now i am receiving 'Buffer Overrun Detected' error while connecting to CDatabase::OpenEX(). I have an application developed in VC++ (MFC).
BTW, connection string passed is in non-unicode format hence there should not be a problem in connecting to database.
One more point to notice is, I am getting this error in DEBUG mode and not in RELEASE mode.
Can anybody tell what is possibly the cause of the error?
Light thrown in this regard by anybody would be a great help to me.
Thanks for your time.
Nishith
|
|
|
|
|
meet2nishith wrote: Now i am receiving 'Buffer Overrun Detected' error while connecting to CDatabase::OpenEX().
What does this statement look like?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
|
|
|
|
|
Following string is passed as connection string which it successfully passes with CDatabase::Connect().
"ODBC;DSN=Corporate Directory;UID= corpdiruser;PWD= corpdiruser;APP=Internet Information Services;WSID=NISHITH;DATABASE=HRMSDB;Network=DBMSSOCN"
But when it comes back to same function, just after return TRUE; it fails and throws buffer overrun error. (_SECERR_BUFFER_OVERRUN)
|
|
|
|
|
Well Guys, ive got a query that why does crystal report control initialization is very slow. im facing this problem since ive installed crystal reports versions 10 n 11. it had better speed than 11 when i was using 9 version. if anyone knows the solution, please send me email at prog_irfan@yahoo.com
will b glad n thankful.
Irfan Shahid
Irfan Shahid
|
|
|
|
|
Hi,
I am new to vc++.
can anybody tell me what exactly applications we can write which are not able to write in any other language, i mean what is the exact purpose of vc++.I heard that it is useful for embedded applications. can anyone tell me other applications.
i will be thankful if u can suggest best sites which explain major advantages of vc++ otherthan any other language.
waiting 4 earliest reply
|
|
|
|
|
Apart from the application and web we can everything in vc++. applications developments area also possible in vc++ but constraint application development is not easy like vb or other applciation development tools.
Have A Nice Day!
Murali.M
|
|
|
|
|
thanx Mr.Murali for you information,
can u tell me is there any application kind of thing that we can only do with vc++ not with any other language.
|
|
|
|
|
we cann't say any application only possible in vc++. but the problem we decided to go any specilisation on your application for that we need to depend on third party controls. this is the restriction. but 80% we can solve with out any dependent. that is the beauty
Have A Nice Day!
Murali.M
|
|
|
|
|
Technically, there is no such thing. Since you can do anything in ASM you know...
However, C++ (don't mess it with VC++ as that is just one complier out there, although my favorite) is so powerful you can rely on it as providing a good balance (maybe, the best balance ever) between what you can do (nearly anything) and what effort it takes (a lot, I admit).
Besides, C++ programmers are paid well. Only Java gurus get more, I think.
So go grab a copy of Visual Studio and start learning C++.
|
|
|
|
|
trinadh_t wrote: can anybody tell me what exactly applications we can write which are not able to write in any other language
This question is upsite down and should instead be:
"Why do we need any other language (Java springs to mind) when we can do anything in C++?"
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
-- modified at 4:14 Friday 24th February, 2006
|
|
|
|
|
I am using win32 APIs for this project. I have to write records into a file and for that i was using FILE * fp; fwrite() and fread(). the Structure i am writing into file contains char fn[100];char sn[1000];char dt[20];char tm[20]; int ET;. Now for few reasons i had to change the sturcture and change the "dt" and "tm" fields to two different structures.each having three Integer variables.Now When i am trying to write records into the file it is working fine but when i am trying read from the file it just dies at the new "tm" sturcture's first int variable. While debugging i found that the other two variables contain some illegal values. the statement while(fread(&data,sizeof(data),1,fp)==1) breaks and goes to the next line of loop which is fclose(fp); before changing to new structure it was working fine(both read and write).
Why is it so? and is fread and fwrite are not safe ways to write records into a file ? if so, then, is there any better solutions for this? can anybody suggest the best Riskfree and Errorfree way to write and read from a file? cause i have to read and write to this file 10 times a minute(approx).
Thanks in advance
kss
|
|
|
|
|
I think that code snippets for the dec. of the structure, the writing of records, and the reading of records. Packing/alignment and how you "changed" members of the structure to other structures may be part of the problem.
Oh, and ReadFile(...) and WriteFile(...) are the Win32 APIs for reading and writing files. fread(...) and fwrite(...) are C-RTL functions.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
thanks james, But can i write records into a file using ReadFile() and WriteFile() and also i have another question please clear the doubt. if i am reading the file from a secondary thread and at that moment the primary thread tries to update it then, will it generate any error letting my second thread crash ? i cant let this happen as the secondry thread runs in the background. how can i achive the synchronization using WIN32 code....
kss
|
|
|
|
|
No, I do not think you will have any errors unless you manually handle locking sections of the file. You should synchronize access to the file HANDLE by wrapping calls to your read/write functions inside of a critical section (if the threads are in the same process) or a named object (event, mutex, etc.) if they are in separate processes.
Look up the Sync objects and their related functions (SetEvent , WaitForSingleObject , EnterCriticalSection , etc.) in the MSDN help
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
fwrite and fread are OK.
BTW, why not use a database instead of managing records manually?
|
|
|
|
|
no I cannot because i am writing a plugin kind of thing. so i can't use any database.my plugin has to read this file every 6 seconds to check for any new updates hey BTW will it create a problem while i am reading from the file and another therad updates this particular file. will the reading thread crash ?..
kss
|
|
|
|
|
fearless stallion wrote: BTW will it create a problem while i am reading from the file and another therad updates this particular file. will the reading thread crash ?..
No, but the data you'll read will be corrupt. Of course, if you manage sharing properly the reading thread will fail to open the file instead.
|
|
|
|
|
|
I do stay away from design meetings
Allow me to quote a part of the original message:
"the Structure i am writing into file contains char fn[100];char sn[1000];char dt[20];char tm[20]; int ET;"
Now this is big enough for a single record. Since records are used, it's more than probable that these will be searched or accessed randomly. Fine with me if there are a couple of records, but what if there are much more?
Besides, database is just an idea, not an imperative. I'm not the guy's boss, so I'm not imposing this design alternative as a "must", only as a way he might have failed to consider.
Finally, who mentioned a full-blown db? I'm not sugesting a db server and such. A small and handy MSAccess db can do the job more effectively. Especially when there are two threads accessing the file simultaneously (as is the case - see previous messages).
Sure you understand all this as well as I do so there's no reason why I should be subject to such criticism is there?
|
|
|
|
|
HAND wrote: Sure you understand all this as well as I do so there's no reason why I should be subject to such criticism is there?
Yes, of course. You will note, of course, the amount of simileys used in the message, and even on the icon for the post itself. They are there for a Reason.
...But since you asked...
Those records are small, and there appears to only be one "entity". With a record size of ~1126 bytes, even 10000 of them can be managed in memory rather easily (These days, 11MB is a trivial amount of data to manage), and can be saved and loaded from storage quite easily as well. No need for additional requirements, even to bring DAO or a similar technology into the picture for something as small and handy as an MDB file. I would question anyone that suggests any kind of external database implementation (ranging from SQLite, to MS Access, to a full-blown C/S RDBMS implementation) for a single entity.
IME, experienced VC++ developers do not consider Access to be a "database". So when someone mentions the word "database", we do not envision an MDB file, but a true, mature, capable RDBMS implementation. If you would consider a flat-file storage implementation a database, then that is what the OP has already, and there is no need to mention "database" at all.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Oh I see. It wasn't obvious to me the entity is single, hence my suggestion. If it is, I DID sound rather inappropriate not to say stupid
Oh and - why not call MSAccess *.mdb file a database? Access supports SQL standards (mostly) and isn't necessarily flat as such (although here it's flat as we're talking about a single table, of course). The only problem with MSAccess is the oh-so-slow Jet Engine.
Peace!
|
|
|
|
|
Again, I have the problem of associating "database" with a full-fledged RDBMS system, not one that suffers limitations that one would not expect.
Off of the top of my head, I would consider things like:
o the lack of true user-level security (all you really need is Permission access to the underlying physical file), excluding DB passwords
o the lack of complete join support (no OUTER and FULL join, last I knew; not sure about the new Access DB engine, which is NOT going to be JET-based)
o the lack of true "server side" processing - since the DB is just a file, and the data processing components are on the client-side, if you have the file remote and run a query, data is sent over the wire and then processed by the client.
IMHO, MS Access, like Java, has a place. In the case of MS Access, it allows non-tech types to build easy form-based data storage and processing applications. But since I deal in large applications and systems, MS Access generally does not have a place in there. I have created and used JET databases in applications in the past, and I remember myself always wanting something more from them. These days, I would not suggess MS Access off-hand - at least, not without much more research into the needs of the project in question.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
You arose quite a discussion! Still, no answer to your original question I believe?
As far as I can see, your code should work just fine, but are you sure that, after changing your structure, you deleted the original file? Could it possibly be that you are reading information that was written with the old structure? In that case, anything could happen!
The problem here is that you simply write a block of data, assuming that it must be what you expect it to be. If you need to be more sure, also after changing the data's structure, you would need to write individual data elements, with some kind of indication as to thei meaning (something like ASN.1, but you could of course write your own simpler version).
If this is no problem to you, then what you are doing now should work. If you simultaneously write from one thread (or application) and read from the other, then the data you read might be corrupted! (imagine one thread being halfway writing a tm structure, while the other is reading it). The best way around this is using simple file-locking.
If you use the CFile method, this would be "CFile::LockRange ()" for example.
If you use the FILE * approach, you will have to use fsopen to open the file, using for example _SH_DENYWR to avoid someone else writing to the file.
Success,
William
|
|
|
|
|
Thanks willam,
Let me put it a bit more clearly,
The primary thread of my application or the main thread launches the second worker thread when it is initialized. the second thread runs in the background and after every 6 seconds looks for a file say "abcd.txt" where records are written. now records to this file are written from the primary thread. and this writing can take place at any moment the enduser wishes. say at a particular moment the secondary thread is reading the file and the enduser writes to it at that particular moment than the data read from the file will be corrupt. that is what my problem is. i don't want to deny the end user ,rather i would like to keep him waiting for a second or two and then once the read is complete, i would like to write into the file. and give him a success message.
The critical section point that james made above sounds nice. but if you have any other suggestion then please let me know.
One more question , is it a good idea, reading from a file every 6 seconds?
kss
|
|
|
|
|