I have already implemented the DQWORD arrays for my MASM version, and am adding printf statements of intermediate calculations. The change to use TBYTES did fix the differences I had seen in the calculated ENT value between the C version and my MASM version. This was not as simple as it looked to be at first. The only FPU instructions than can use TBYTES are FLD and FST. You cannot use FADD TBYTE PTR [i], but I can see where the xxxP FPU instructions come from:
It turns out that this is exactly what the FPU needs to do for an faddd val - it must push the stack, load the double/float/integer into st0 and convert it to temporary real, then add/sub/mul/div ST(1) by ST(0) and put the result into ST(1), then pop the stack leaving the result in ST(0). With TBYTES you just have to do it manually, - BUT - The FPU doesn't have to do any conversions - the TBYTE is already in temporary real format and can contain a signed QWORD (63 bits, + sign). Unfortunately, the FPU cannot handle unsigned 64 bit values (they end up as negative values).
The biggest improvement I got was changing from fgetc for each character to reading 65536 bytes into a buffer (with no system buffering) and indexing through the BYTES, then reading more from the file into the buffer and processing. Another interesting change was to fill the buffer, initialize one time for the FIRST character, then skip to process the characters, skipping around the subsequent re-fill buffer entry point. So little extra code, BUT, avoided checking if this was the first character 16 billion times as was done in ENT. Another speedup was to fragment the character occurrence buffer - I had to grow the collection bins to a QWORD for supporting a max file (2^63 BYTES), but in the BIT mode this increased the count to 2^66. I had to accumulate the counts in three DWORDS in a DQWORD, using "add value, adc 0, adc 0," but this occurred (in my 16 GB test) 16 billion times. With a smaller buffer that could contain the counts in a DWORD, it was just an "add value" for the buffer count, then 256 iterations of "add value, adc 0, adc 0," to accumulate the 256 occurrence values in the DQWORD array and clear the DWORD counts between buffer fills. Also for checking whether a bin had any count at all (several places in ENT checked this), I accumulated (at the end of the file processing) the 3 DWORDS for each entry into the fourth DWORD that could be tested with a single instruction.
But I digress from a simple C question into something more appropriate for Algorithms.
WM_DEVICECHANGE sets wParam to DBT_DEVNODES_CHANGED to update list (tree?) nodes.
No other info is available then. I have not retrieved any device list, so it is useless for me.
To receive DBT_DEVICEARRIVAL it is necessary to first use RegisterDeviceNotification.
At this point no other help is required.
I need some help / hints with implementing WM_DEVICECHANGE in MFC Document /View setup.
I have managed to intercept the WM_DEVICECHANGE in CmainFrame message map and process it .
The problem m is that the wParam is nowhere near the 0x8xxx, but it is plain “7” and the lParam is 0.
I went thru the Dbt.h and cannot figure out what is the wParam = 7 telling me.
Here is the code snippet and if it is not formatted to you liking – I am sorry , but I write my stuff in OpenOffice and than copy it to CodeProject so it cannot be formatted properly.
<b>I just need some troubleshooting pointer / suggestion how to analyze these mysterious parameters. </b>
Maybe CmainFRame is not the place to start, but I got same parameters values when I used Cdialog message map directly.
JUst found this info, so the additional question is - is CMainFrame "top window" and if not will RegisterDeviceNotification solve this ? I shall try it next.
The DBT_DEVICEARRIVAL and DBT_DEVICEREMOVECOMPLETE events are automatically broadcast to all top-level windows for port devices. Therefore, it is not necessary to call RegisterDeviceNotification for ports, and the function fails if the dbch_devicetype member is DBT_DEVTYP_PORT.
Your code and text can be formatted properly. It must be done manually after pasting (it does not care if pasting from OpenOffice or a plain text editor but you should remove HTML tags when pasting from Ooo). Select text with mouse and use the buttons above the edit window to apply specific formatting. If you know HTML, you may also type the HTML tags. Check the preview to see how it looks.
Thank you, obviously I have not look all the way to the end of the page!
However, what the dickens is " ring3 people" note talking about?
So when "new node is detected / chaged" is not same as
DBT_DEVICEARRIVAL A device has been inserted and is now available.
Mr MS - I am not sure this note is in English!
and to get the device more work is necessary???
I am not sure I can figure that out, getting tired of this USB mess.
* Message = WM_DEVICECHANGE
* wParam = DBT_DEVNODES_CHANGED
* lParam = 0
* send when configmg finished a process tree batch. Some devnodes
* may have been added or removed. This is used by ring3 people which
* need to be refreshed whenever any devnode changed occur (like
* device manager). People specific to certain devices should use
* DBT_DEVICE* instead.
#define DBT_DEVNODES_CHANGED 0x0007
i have a appilcation consists of thousands lines of code. when i do some specific operation, i.e. open a very large document, the app almost eats up my memory. but after a while, the memory is given back. i have tested the codes and found no memory leak.
so, my problem is how to find the codes who eat up my memory.
any one can help me?
First, when you do a malloc or new, you extend the heap. For optimization reasons, the memory manager may not return the heap back to the OS immediately. When needing to allocate especially large chunks of memory, you can use a low level API directly or, with some compilers/CRTs, a different heap (for Windows, here's an article discussion various options: http://msdn.microsoft.com/en-us/library/windows/desktop/aa366533%28v=vs.85%29.aspx[^].)
Also note that if you allocate memory and sit around, the OS may page it out. To understand the difference in Windows, look into "private bytes" and "working set".
I want to ask you something: what would you use for image processing and more important, convert images from an format to other ? I am using MFC, and I was thinking of GDI+, but I didn't find so many examples to how to convert images ...
I see here so interesting controls, CBitmapEx, CxImage, CImageStone, but I don't know what is proper to do the job ... I will appreciate any hint.
No, I didn't look over by now ... Thank you for your interest, so you suggest to use GDI+ ... I didn't try to load some not common image file, .raw, .tiff multipage, etc. ... I don't know if does function ...
No, I just asked if you had looked at that function and if it solved your problem. Your question is not particularly clear, i.e. what do you want to convert from, and what do you want to convert to? I am sure that Google could find you lots of information if you were more specific about your requirements.
One of these days I'm going to think of a really clever signature.
The Win32 API offers very limited image conversion. There are many third party libraries, some free, others not. I'm currently looking at CxImage to replace Leadtools, which is now even more expensive than before and isn't royalty free. If you are willing to pay more, one royalty free library I've used is http://www.gdpicture.com/[^]. The ActiveX part always annoyed me, but it had a good PDF viewer component, so I lived with it. I'm also going to evaluate http://www.data-tech.com/products/imaging/imageman-dll.aspx[^]. (I work for none of these companies.)
If you are interested in audio development, I made a simple SDK to tag audio libraries patches. There is ton of things people are waiting for on this topic:
- analyze a WAV file and extract tagging informations (Percussive, Smooth ...)
- extract informations from REX files and convert them in tags
Plug-ins can be .NET assemblies or native DLL
as Universal Patch Finder is free,
the idea is to let all of this entirely free.
Can anyone let me know any good books on Image Processing. I want to implement an algorithm to do some operation on Images (for example ...increasing brightness, Making an Image Blur, Distort an Image etc....).
I want to know the details about Image Processing and to Implement algorithms for Image Processing.
Anybody have any idea about any tutorial or Good books through which to understand the details about Image manipulation.
I believe Cousera.org is providing free course on Image Processing! you might be interested in it.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
P.S.: You should however consider that most, if not all, of the algorithms described in this book are built into modern graphics chips, or provided via easily obtainable readymade libraries. This is certainly an interesting field if you're interested in, but you're not likely to need that kind of knowledge in any real world project, unless you go into graphics chips design.
I have a pretty large and old application where the user can select the current customer from a combobox. However, the number of customers have grown (>100) to the point where the users think that selecting a customer from the list is awkward.
Does anyone have a good suggestion for a replacement for a CComboBox? The droplist portion should be a multilevel menu or a tree or similar ... I have seen several attempts here and in other places, but they all seem pretty experimental (non-standard UI behaviour, hardcoded drawing functions not utlizing themes, and so on).
You could use the same idea that a lot of websites use, in that they build their lists dynamically as the user types into them. So if the user starts typing a you just load all the customer names from that sub group. Here are some CodeProject articles[^] that discuss the issue.
One of these days I'm going to think of a really clever signature.
Thanks for the input, using some kind of incremental search could be an option.
However, my query was for a custom control with similar functionality as a CComboBox, but where the list box (the dropdown part) is replaced with a tree control or a menu with submenus. There's several examples here at codeproject, but I don't find any of them really cut for the job. It seemed like a pretty common problem, so there should definitely be someone out there having solved it.
void TakeData(myStruct &structRef)
CString str = TmpFileMgr->TmpFilePathName() ; //Returns file path
structRef.cstrFilePath = str ; //Crashes at this point on Windows 7
in a dll which takes Temporary folder path and assign it in a CString variables. This CString variable is member of structure object which is passed as a reference to TakeData(myStruct &structRef)function.
I am able to print temporary folder path in TakeData function and CString assigment works perfectly on Windows XP. But when I run this code on Windows 7 it crashes at the point where I am doing assigment of temp folder path in a CString variable. I have all admin rights on Windows 7 System , also I have put UAC to OFF.
Please provide any input in this regard. Thanks
modified 3-Dec-12 10:16am.
Last Visit: 31-Dec-99 19:00 Last Update: 20-Nov-17 13:51