|
Anyone know how I can implement this in code?
Trying to synchronize data samples from two different hardware devices. One device is sampling around 10pt/s and the other device is sampling at 50pt/s. These samples are displayed on a graph in realtime.
|
|
|
|
|
Can someone explain what "callback functions" are and how they are used? Or, point me to a good "callback functions for Dummies" web-site?
Thank you in advance
Pierre
|
|
|
|
|
|
|
vHi. I'm working on an MFC project in a company and we're stuck with Visual Studio 7.0 (2002/.Net) for the time being. I added an STL::map to a dll to hold some strings. The code compiles fine but falls over with an access violation whenever I try to do anything with the map (add items, call find() etc). It's like the container is corrupted somehow.
I've googled the problem and I've read a few other articles (eg. http://support.microsoft.com/kb/q168958/) and I think everything is set up correctly. Here's my code:
<br />
header of DLL:<br />
<br />
#pragma once<br />
<br />
namespace RegUtils<br />
{<br />
CString getRegCachedValue(const CString& p_strID);<br />
<br />
..<br />
<br />
}<br />
<br />
CPP of DLL:<br />
<br />
typedef std::map<CString, CString> RegKeyMap;<br />
typedef RegKeyMap::iterator RegKeyMapIter;<br />
RegKeyMap gRegKeyMap;<br />
<br />
CString RegUtils::getRegCachedValue(const CString& p_strID)<br />
{<br />
CString strValue = _T("");<br />
<br />
RegKeyMapIter iter = gRegKeyMap.find(p_strID);
if (gRegKeyMap.end() != iter) {<br />
strValue = iter->second;<br />
}<br />
<br />
return strValue;<br />
}<br />
As soon as the code gets to the find() method, it falls over. Ditto for any other operation on the map. Please help this is driving us nuts and I feel I've tried everything.
It's been suggested we switch to MFC maps as they apparently don't have this problem but that would be a LOT of work.
I'm using the 'Multi-threaded Debug DLL (/MDd)' runtime lib to build the DLL. I've read about problems associated with copying STL objects back and forth over DLL boundaries but I'm not doing that here - the map and this function is private to the DLL (it is not exported) and is used only internally. The code is being called by other DLLs (also built using /MDd).
Please help!
|
|
|
|
|
I'm not going to be able to find anything specific but I am sure I have done something like that in the past without problems. The most obvious difference is that I would have used a Singleton Pattern[^] rather than a global. Perhaps you might give that a try.
|
|
|
|
|
The problem is that we cannot read the < and > in your code (and for templates, it is quite annoying). Please, replace them by the two symbols that are above the emoticons.
Now for your problem, can you give a better description of the exception ? What is the exact error ? When you use the debugger, where does it crashes ? The more info you provide, the more chances you'll get help.
|
|
|
|
|
Cedric Moonen wrote: The problem is that we cannot read the < and > in your code
This is one of my pet hates. It seems that no matter how many people complain about it or how often they do so, it has little effect.
Steve
|
|
|
|
|
I don't know if this pertains to your problem but I tried using std::vector<char> in a DLL and had to do the following:
template class __declspec(dllexport) std::vector<char>;
before using it.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
What is the best way to transfer some data from one PC to another in a LAN.
I have a IP address and a Port Number.
I used to send/receive data using sockets, many years ago, but if using Visual Studio 2005 C++ MFC Dialog application, could I have a good suggestion as to what component to use.
I assume that the data interface structure needs to be defined and aggreed; i.e. I could do this and send a copy to the s/w developer on the other PC.
Many thanks,
Andy.
|
|
|
|
|
|
I can't say what the best way is for your application, but here's a description of some of the
methods available with Windows:
Interprocess Communications[^]
Given an IP and a port number (which combined, nicely defines a complete socket address)
I'd say sockets is a good option.
Regardless, both ends generally (always?) need to agree on the protocol.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi, it's me... again
I've now added GDI+ to an existing application, to allow the display of TIFF images (and other reasons). So the old "OleLoadPicture" and the IPicture have to be replaced.
I've a global var as a buffer for the image:
Gdiplus::Image *m_image;
I display the image with this code:
graphics.DrawImage(&m_image, x, y, size_x, size_y);
When I load a test image this way, it works (= it is displayed):
Gdiplus::Image m_image(L"testSMALL.TIF");
But of course I have to replace the old code, where the image is save out from a stream with the help of OleLoadPicture. I tried it this way:
LPSTREAM pstm = NULL;<br />
HRESULT hr = CreateStreamOnHGlobal(hGlobal, TRUE, &pstm);<br />
if (SUCCEEDED(hr) && pstm)<br />
{<br />
Gdiplus::Image m_image(pstm);<br />
}
But it won't compile this way. It says it has an error at the line where the "DrawImage" is:
error C2664: 'Gdiplus::Status Gdiplus::Graphics::DrawImage(Gdiplus::Image *,Gdiplus::REAL,Gdiplus::REAL,Gdiplus::REAL,Gdiplus::REAL)': Konvertierung des Parameters 1 von 'Gdiplus::Image **__w64 ' in 'Gdiplus::Image *' nicht möglich
-> in english: cannot convert the first parameter 'Gdiplus::Image **__w64 ' in 'Gdiplus::Image *'
And please don't bash me, I know that I don't have a clue about C++
Thx and Greets, Shi
|
|
|
|
|
See the double * in the error message? If you look at the start of it, the function expects the first parameter to be of type Image* , and you are passing it &m_image , and since m_image is already a pointer (its type is Image* ), you are passing the function the address of a pointer (a pointer-to-a-pointer).
Change the first parameter from &m_image to just m_image .
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> 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! See DeleteFXPFiles
|
|
|
|
|
What happens if you run this code
graphics.DrawImage(m_image, x, y, size_x, size_y);
instead
graphics.DrawImage(&m_image, x, y, size_x, size_y);
|
|
|
|
|
then it works!
Thank you very much. All of you.
|
|
|
|
|
|
Hello,
Is there a way to open an explorer folder, for example C:\myprojects, inside a tabbed window of IE7; so I can save screen realestate? Because currently, when I type in "c:\myprojects" in address bar of from a new tab in IE7 it opens up a Explorer folder outside of IE7. Why not, doesn't explorer and ie7 use same underlying browser? if this is not possible how can I write a small C++ progie to do this for me? I know, microsoft will steal it and package it under WGA but it would be a nice convenience.
JavaME (J2ME), Java, C & C# Developer
CV: http://docs.google.com/Doc?id=dt6fqcn_51dn8gds
|
|
|
|
|
I use a browser called Opera. It is an excellent browser and solves your problem, allowing you to view folders in an explorer-style manner. Download it from http://www.opera.com/download/
It was also one of the first browsers to implement tabbed windows.
Hope this helps!
--PerspX
"Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates
BSoD during a Win98 presentation
|
|
|
|
|
No, this will not help me. Neither Opera nor Firefox will work because my companies website is not compatible with them.
BTW: I also use Opera
Thanks
JavaME (J2ME), Java, C & C# Developer
CV: http://docs.google.com/Doc?id=dt6fqcn_51dn8gds
|
|
|
|
|
Well it SHOULD be compatible with them
It seems like the Internet revolves around Internet Explorer.. which so happens to be the worst browser out there..
--PerspX
"Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates
BSoD during a Win98 presentation
|
|
|
|
|
hi
Is it possible to add check to for each tree items in CTreeCtrl instead of all
EmptyBox
|
|
|
|
|
The check boxes in trees and list controls are done by creating an image list. The image list is applied to every item in the same manner.
To get check boxes for individual items, you cannot use this feature. Instead, create your own image list for the blank (no checkbox), empty check box and filled checkboxes, and whenever you insert an item into the tree, set the appropriate image to check box or no checkbox.
It does mean, though, that you will need to process NM_CLICK to 'toggle' the check state by updating the item's image accordingly.
|
|
|
|
|
hey Jason, you are so clear, thx for your reply
|
|
|
|
|
Hi guys
I want to stop Autorun through my Application.
Thanks in advance
RYK
|
|
|
|