|
messagehandler is always like:
afx_msg LRESULT OnDrawCursorOnPlot2(WPARAM subsetIndex,LPARAM sampleNum);
and in the handler you have to get the float value back as below:
LRESULT CMagAnView::OnDrawCursorOnPlot2(WPARAM subsetIndex, LPARAM location){<br />
float *fX = (float*)location;<br />
}
and sendmessage format is:
m_pParentWnd->SendMessage(UDM_DRAWCURSOR,(WPARAM)&subsetIndex,(LPARAM)&fX);
(hope you haven't declared subsetIndex as a poniter, if so no need to put & for subsetIndex )
cheers ...mil10.
|
|
|
|
|
Ah! Thanks!
I guess I got overawed by the LPARAM and didn't realize I needed to dereference the value.
I thank you much for the help.
|
|
|
|
|
Hi there,
meanwhile I've tested a couple of serial communication classes that I've found in the web. Some work and some not.
However, I couldn't find a working example that can transmit single characters. Many support sending strings, but I would need single characters, because I'd like to send to send data from a structure in this manner:
// pointer to structure for sending
const unsigned char *p = (const unsigned char *) &gKupParam;
uart_putc ('<'); // start character
for (i=0;i<sizeof(gKupParam);i++) {
uart_putc (*p++);
}
uart_putc('>'); // end character
|
|
|
|
|
Well, as this is a win32 machine, talking to a serial port is just lake writing data to a file. And sending a character is just like sending a *really* short string! And sending the contents of a structure is like sending it byte by byte...
void SendMyStruct (HFILE hComPort, MyStruct *myStruct)
{
WriteFile (hComPort, &myStruct, sizeof (MyStruct), NULL, NULL);
}
I'm doing the parameters by memory, so you will need to loom them up for yourself.
Iain.
|
|
|
|
|
Thank you for your advice. What class do you use?
|
|
|
|
|
fambi_mail wrote: What class do you use?
Actually, I don't use any classes for my serial communications. I've used MFC for the front end of any application, and a separate thread with overlapping I/O to deal with the serial port side of things. But then again, most of the comms has been *into* the PC, rather than fully two way. When you are multithreading, it can be a problem accessing MFC classes from more than one thread...
But I'm also a bit of a dinosaur control freak, and like doing things the raw way...
I've just a had a peek, and there are several classes to talk with the serial ports in http://www.codeproject.com/system/#Hardware[^]. Unfortunately, I haven't looked at them for quite some time, so I can't recommend any particular one.
Good luck!
|
|
|
|
|
|
A CEdit redraws itself if I call Invalidate, but then it creates its own PaintDC.
I would like to draw the CEdit to a memory DC to prevent flickering, but I can't find any CWnd method that accepts a DC for painting.
Thanks
Andre
|
|
|
|
|
I guess there is no "CWnd method that accepts a DC for painting".
if u only want "to prevent flickering" of the CEdit, I think you are in a hard way.
u may get better solution if u post the reason why you want to redraw the CEdit - normally CEdit can redraw itself if its text is changed.
A special image tool for Windows C++ programmers, don't miss it!
The world unique Software Label Maker is waiting for you and me ...
A nice hyper tool for optimizing your Microsoft html-help contents.
|
|
|
|
|
Hi, how can i access a usb device with winapi?
a short example will be very helpful!
bye
|
|
|
|
|
Have you searched CP, or Googled, for USB-related articles?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
|
If you want to read/write from/to a USB HID device a suggest to take a look on Jan Axelson's The HID Page[^]
BTW, a mouse is a HID device (I'm using his code in a big commercial project and it's working very good)
|
|
|
|
|
hi, which example do you use?
Visual C++ 6
Usbhidio_vc6 ???
at
------ Build started: Project: usbhidioc, Configuration: Debug Win32 ------
Compiling...
usbhidioc.cpp
c:\download\usbhidio_vc6\usbhidioc.cpp(12) : fatal error C1083: Cannot open include file: 'hidsdi.h': No such file or directory
usbhidiocDlg.cpp
c:\download\usbhidio_vc6\usbhidiocdlg.cpp(57) : fatal error C1083: Cannot open include file: 'hidsdi.h': No such file or directory
Generating Code...
Creating browse information file...
Microsoft Browse Information Maintenance Utility Version ..................
BSCMAKE: error BK1506 : cannot open file '.\Debug\usbhidioc.sbr': No such file or directory
where can i download the Windows Driver Development Kit for win xp??? hm at the microsoft page i only found ... to order...
cu
-- modified at 7:17 Tuesday 4th April, 2006
|
|
|
|
|
Hi,
what is the reason for the Cxyz& return value with *this parameter of = operators?
Dr-Kuulun
|
|
|
|
|
Not sure exactly what you are asking, but this is a pointer while *this is the actual object being pointed to. Since the operator= method is returning a reference to the actual object, that's why *this would need to be returned.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
if u define return type as Cxyz&, u should return *this, otherwise what you can return?
u can define return type other way, such as void or BOOL.
A special image tool for Windows C++ programmers, don't miss it!
The world unique Software Label Maker is waiting for you and me ...
A nice hyper tool for optimizing your Microsoft html-help contents.
|
|
|
|
|
The reason is simpler than you may think. Its is so that you can make multiple assignment work efficiently.
You expect this to work:
int a, b, c;
a = b = c = 1;
So you also accept this to work:
CFwibble a, b, c;
c.DoSomethingtoInitialisethestruct;
a = b = c;
But the last line is equivalent to:
a = (b = c);
which means b = c has to be something you can assign to another struct / class / object of the same kind.
You could make the return value xyz , but that would mean creating a temporary copy on the stack, which is inefficient. The xyz & means a reference to b is passed, so no temporary copy is made.
For proper purity, you should also make the reference const, to prevent b from being messed about with...
class xyz
{
...
const xyz &operator=(const xyz &rhs)
{
...
return *this;
}
};
I hope that made sense for you!
Iain.
-- modified at 19:54 Monday 3rd April, 2006
|
|
|
|
|
Iain Clarke wrote: CFwibble a, b, c;
5 just for the class name!
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
That's it! Thanx!
Dr-Kuulun
|
|
|
|
|
hi
I have developed an ActiveX control using MFC and i am using it in IE. The control has a boolean property ShowThumbNail which i am able to set through scripting, but when i set this property using < PARAM > tag it seems that the property is not set and nothing happens.
please tell me how to set exposed properties of an ActiveX using < Param > tag. The control is developed using MFC
thanks
Azam
|
|
|
|
|
override DoPropExchange and call PX_ functions.
Regards
Microsoft MVP in Visual C++
http://blog.joycode.com/jiangsheng
|
|
|
|
|
thanks Sheng
it worked
Azam
|
|
|
|
|
I am using CListCtrl.
I would like to handle single click event and double click event on list controls.
Is that possiable.
List control's property is set to report style.
How to handle single click and double click on list view?
In single click I want to display the values of that colomn in the same dialog.
In double click I want to open another dialog and show related details.
Is this possiable.
What are the events I need to handle.
At Present I am using only one event
"ON_NOTIFY(LVN_ITEMACTIVATE, IDC_LIST_GROUPS, OnLvnItemActivateListGroups)"
to display colomn values in same dialog.
Please let me know any one.
Nice talking to you.
If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
G Haranadh wrote: t Present I am using only one event
Handle NM_DBLCLK message
|
|
|
|