|
It's not an error, but a warning. Try:
srand((unsigned) time(NULL));
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
As already stated, it's not an error but a warning. Compiler is simply making sure you're doing it on purpose and not by mistake, remember that casting may lead to digits being dropped and rounding (hence the warning). Cast the data to the appropriate type and the compiler won't warn you about it anymore.
|
|
|
|
|
Hi,
I want to provide undo/redo drawing feature in MFC dialog based application. I am saving the images dynamically in a vector in OnMouseMove handler code. But when I am going to load the previous image on clicking Undo button, its getting distorted. the last image saved still remains there on the canvas. Can anybody tell me whats the issue with OnMouseMove handler. How the compiler will know when to end saving the image.?
Regards,
|
|
|
|
|
mbatra31 wrote: How the compiler will know when to end saving the image.?
The compiler knows nothing, it's your code that has to do the work. Without seeing some of your code it's impossible to know what is going on.
|
|
|
|
|
Don't save the image the "OnMouseMove" event handler, save it in the OnLButtonUp handler (normally when the action is finished); or else you will end up with thousands and thousands of images.
How are you saving and putting back the image ? BitBlt ? StretchBlt ? show us some code.
If the image is stretched, are you certain you are using the good Width and Height for the bitmap ?
Watched code never compiles.
|
|
|
|
|
Hi Maximilien,
Thanx for your response.
I have done that part. I am saving the images in OnLButtonUp event handler only.
Thanx & Regards,
|
|
|
|
|
|
Hi
My application is in C++/ATL/COM and uses the Access database for storing configurations. Various DLLs and EXEs (and threads) that are part of my application query the database when needed.
When doing so, I am getting the database locked message ('[Microsoft][ODBC Microsoft Access Driver] The database has been placed in a state by an unknown user that prevents it from being opened or locked' in the log) randomly and the application fails to continue.
I am assuming that this problem happens due to the shared access of the database.
My question is:
Can i get the complete database in memory (in form of recordsets for every table) during the launch and query the recordsets directly instead of querying the database? I believe this might solve the database locking problem.
Any help is appreciated.
Thanks
Selva
Selva
|
|
|
|
|
A better solution would be to locate and fix the problems.
Some hints:
- Open database read only when no data should be written
- When opening/accessing and the database is locked, retry operation after some time
- When writing to the database, lock the thread so that other threads are blocked
- When writing, close the database aftwerwards to avoid locking states
|
|
|
|
|
Hi Jochen
Thanks for your response.
I am already reviewing the code and doing that. But still it fails at times. So I was thinking whether i could keep them all in memory so that the DB hits can be avoided.
Please share your thoughts.
Thanks
Selva
Selva
|
|
|
|
|
If you have it in memory, you won't get changings. And if you add code to support changings during runtime, you may not need a database.
Assuming that all modules must then use only one function to access the memory db, why not implement the only function using direct db access?
In both cases, that function must be thread safe using locking. I think that's your problem: You access the db from different threads which may fail when the db is locked by another thread. You will have similar problems when using a memory image that is modified when not using locking (but without getting an error message).
|
|
|
|
|
i need an urgent help on this plz explain it cleraly how we can add a picture control or any other control inside list control mfc ,,,reply me as soon as possible
|
|
|
|
|
|
|
If you want to put a background picture on a listcontrol, look here[^] and if you want to insert any kinf of control (COleDateTime, CComboBox, CEdit, and so on) to a listcontrol look here[^].
|
|
|
|
|
hi, i'm developing an application for a school project in wich i need to read the data that an open port is about to send to another.
is there any way that i can do that?
i have search in everywhere and it seems to be no answer for that.
can anyone help me?
thanks
|
|
|
|
|
A serial port can be opened only by one application/thread at time. So there is no chance to do this in a simple way.
You may use some hardware that splits the serial lines and mirrors it to another port where you get a copy of the data that has been send.
You may create a special send thread that copies the data to a buffer before sending and flushes the buffer after they has been sent. You can then query the unsend data from this thread.
|
|
|
|
|
I suppose you should hook the WriteFile function. Not an easy task, anyway.
Veni, vidi, vici.
|
|
|
|
|
Or you can create an upperfilter driver for serial.sys and pump the data back up to your app.
Of course this is extremely difficult for most people to do but should you feel up to a mammoth challenge, it is an interesting way to do it.
The other way you can do it is to create a dll that manages serial.sys, ie, implements all the Win32 serial functionality and get the other app to talk to your dll instead of the stock system one. But this has its own problems in terms of replacing the system dll with yours.
|
|
|
|
|
|
The latest version can be found here
|
|
|
|
|
Hello,
My C/C++ skills are minimal but I would like to see if I can somehow compile a working sample to write a multi-level Window shell extension à la 7zip.
I read the article "The Complete Idiot's Guide to Writing Namespace Extensions" from 2001. I was wondering if someone could tell me...
1. If that sample can be compiled as-is or requires some extra work
2. If yes, can it be compiled with a free C/C++ compiler for Windows?
Hopefuly, once I get everything installed and the sample compiled, I can start peeking and poking to see if I can customize it to build my own shell extension.
Thank you.
|
|
|
|
|
fredtheman wrote: My C/C++ skills are minimal There a re lots of articles here[^] and elsewhere on the internet that will help you learn.
fredtheman wrote: but I would like to see if I can somehow compile a working sample to write a multi-level Window shell extension à la 7zip. Given your previous statement I would think that somewhat over ambitious.
What you can do, is get hold of the free Visual C++ Express system[^] and start building your skills and experience.
|
|
|
|
|
Thanks for the links. I'll give it a try and see if I can figure it out.
|
|
|
|
|
Hi,
if I call CWinApp::GetProfileString() for a key that does not exist, it creates one for me.
This is not what I want.
Is there any way to stop this key from being created?
BTW, I read Stuart Konens CRegistry class article, but cannot use that as third party code is not allowed in my current project.
Thanks,
Bryan.
|
|
|
|