|
A simple casting should do the trick:
int* tempInt = (int*)tempChar;
But be carefull with byte ordering ! As the bytes are stored in an inverted way in memory. It means that if you have those bytes in memory:
0x00 0x00 0x00 0x01
And you interprete those bytes as an integer (like you will do with the cast), the resulting integer value won't be one (but 0x01000000).
|
|
|
|
|
Cedric Moonen wrote: As the bytes are stored in an inverted way in memory
partially right. all depends of the system.
but one should always care about bytes order anyway
|
|
|
|
|
union is the best, because you can save some processin time the shift operator would consume...
|
|
|
|
|
int *tip;
tip = (int *) tempChar;
|
|
|
|
|
I a CDialog based application which has approx 30 CBitmapButtons and 30 CStatic text boxes. I'm receiving data at about 20hz which is causing the screen to flicker badly when these are getting repopulated. I've looked at the usual ways of stopping/reducing the flicker (overloading OnEraseBkgnd, using InvalidateRect ( rect, FALSE ), Invalidate (FALSE), etc...) with no luck. Does anyone have any ideas how I can overcome this? One idea I've had is buffering the entire dialog before painting it, however I can only find examples on how to do this with bitmap controls rather than an entire dialog with controls.
TIA,
Andy
|
|
|
|
|
I would look into updating the controls without redrawing the entire dialog
(especially its background) every time data is updated.
Also limiting the update region(s) to just areas that change helps alot.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Thanks for your reply. I've delved further into this now and have found that the flickering is due (or at least appears to be due) to the fact that I have controls on top of each other, an example is that I will have a Group Box with a CEdit control inside of it, when they are seperate they don't flicker when combined they do. I'm using the Group box to provide a border effect to the CEdit control as none of the built in border styles are suitable, so if I can get an identicle border in another way then my problem may be sorted! Do you have any ideas on how to do this?
cheers,
Andy
|
|
|
|
|
well sort of the answer, further to my above post, I've got rid of the group boxes and changed the style of the CEdit controls to have the Border, Modal Frame and Static Edge set to TRUE. Although this border is thicker than I wanted it is better to look at than a flickering screen!
Any suggestions on how to make this border thinner would be great
Andy,
|
|
|
|
|
mcsherry wrote: Any suggestions...
No
I'm still wondering why the groupbox causes flicker. Is it just a Z-order thing?
If you set the tab order, the groupbox should be before any controls "inside" it.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
i have two 8 bit 256 color images, they have different color palette, i want to replace some pixels of one image with other image's pixels. how can i do it since they have different palette?
or i can describe the question with another way: also with the two images, i want to splice them together, how can do it with VC++?
thanks
|
|
|
|
|
if you don't or can't change the palette of the destination image, you'll have to use a method to take the color from the source image and find the closest color in the destination palette.
or, you could covert them all to RGB-24, combine the images, then use a color quantization and dithering function convert the result back to the palette you need.
splicing images depends on the format of the pixels in memory.
your best bet is to use one of the many image processing toolkits that are available.
|
|
|
|
|
thanks Chris Losinger, you have given me a big help!
|
|
|
|
|
Hello,
I have made an easy appliction using MFC, i sent only executable application to my friend, but the application is not working for him, and i found out that He doesnt have installed Visual c++ on his computer.
Does he have to install visual c++? or he need only mfc dll files, if so, which dll files?
thanks
|
|
|
|
|
Which version of Visual Studio did you use for the development ?
|
|
|
|
|
|
He'll need the MFC dlls plus any others that your program uses. There's a Visual Studio tool called 'depends.exe' which will tell you the Dlls that are loaded up automagically when the application starts (like msvcrt.dll for example) For any others you'll need to look for LoadLibrary calls in your code. Remember he'll already have most of those in your list as part of Windows so don't go overwriting vital items on his machine
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Please refer here[^].
Regards,
Paresh.
|
|
|
|
|
Hello,
I just made simple application using MFC database classes, so, then i have to move every MFC dll files, that is crazy, because my application is 500 kb, it will be 15 mb with MFC dlls, why every do i have to move the dlls?
what would u recommend me?
thanks
|
|
|
|
|
Gofur Halmurat wrote: why every do i have to move the dlls?
Because you're using code inside those DLLs by virtue of using an MFC database class. The code has to exist somewhere. By dynamically linking to MFC, the code is in the DLL which must be present on the executing machine. If you statically link, the code is pulled into your EXE and comes along for the ride when you move the executable to the executing machine.
Judy
|
|
|
|
|
Please click here[^] for more information.
Regards,
Paresh.
|
|
|
|
|
Wrong person - you need to reply to the original poster so that they get the notification email.
Judy
|
|
|
|
|
there is a wonderful artical about digit recognition at:
http://www.codeproject.com/library/NeuralNetRecognition.asp
in vc++6 language.
I want to use this wonderful program as a dll or ocx in c#.
can anyone help me?
has anyone done this work before?
and can anyone give me this dll or ocx?
(i'm not familiar with nor understand difficult vc++6 programs)
very thanks in advance.
|
|
|
|
|
There are a number of steps I would recommend if you want what I think you want.
Use VC++ 2005 or 2008 to create a simple Dll project using the wizard. Play around with this and understand what it gives you and how to use that Dll from another project.
Take a class or module at a time from the article and add it into a copy of your Dll project. For each object create the necessary externally callable Dll interface or a COM based wrapper and test it.
You should end up with a Dll with all the functionality in it and accessible from outside.
Using this from C# either by use of PInvoke calls or COM interop is one for the C# guys on the C# forum, I've only done a very little COM interop which is great once it's working.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
thank you very much Mathew.
excuse me for my late in respond (i did not have an internet connection for 1 day).
the main problem is that I want do this quickly and exactly and in a few efforts.
i try to test your useful and helpful way to do that.
if you or any other have better way or more comments i will thank.
thank you again.
|
|
|
|
|
hi friends,
Pgming Env. = VS 6.0
DataBase = MS Acess
My problem arised when i tried to fetch a coloumn in to combo box frm the acess, fetching is done fine. but when i click tw combo box next time all the values are getting repeated(adding up), how should i clear the old data or suggest me some ideas when playing around with combo box
thanks in advance....
||SnAkeBed||
|
|
|
|