|
can i use u r serial communication class directly ,instead of developing new one..?
-- modified at 19:21 Thursday 29th June, 2006
|
|
|
|
|
Serial communication in Windows is handled just like a file. You use OpenFile/CreateFile to open the port, and ReadFile/WriteFile to read from and write to it. The classes people develop just wrap these operations into easy to use methods.
So, yes, you can easily just use the Win32 API directly if you would like.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
yeah i am planing to use OpenFile/CreateFile,ReadFile,WriteFile and other API functions,do we need to write two threads,for reading and writing and how do we spool the data.I want write everthing in a DLL and use this DLL,in a client application,by calling respective functions,i want to open com port,send,and read from it....
Thanks in Before
james
|
|
|
|
|
need to add some images thumbnail to CImageList
|
|
|
|
|
If you use the Bitmap class instead of the Image class you can use the GetHBitmap or GetHIcon methods to get an HBITMAP or HICON that you can add to your image list. The Bitmap class inherits from the Image class so all the functionality of the Image class is available in the Bitmap class.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Hello everyone,
I am working on a code related to binary trees (data structures) and there is a small part of it that I can't undserstand because of its strange syntax.
To make things easier for somebody who may help I abstracted this part of code and made it simple and stand alone but still keeping that strange syntax! Looking the output I know what the code does but I cannot understand its syntax at all. I am giving the code below with questions for the lines I don't understand:
<br />
#include <iostream><br />
#include <string><br />
<br />
using namespace std;<br />
<br />
void PreOrder(void(Visit_) (int *s), int *s){<br />
<br />
Visit_(s); <br />
}<br />
<br />
static void Output_(int *t)<br />
{cout << *t << 'Z';} <br />
<br />
<br />
int main(){<br />
<br />
<br />
int *p;<br />
int i=5;<br />
<br />
p=&i;<br />
<br />
PreOrder(Output_, p);<br />
<br />
<br />
getchar();<br />
return 0; <br />
}<br />
I would appreciate it a lot if anyone could explain even a single line, maybe then I can understand the whole image my self.
Thank you all in advance,
Melsi
|
|
|
|
|
void(Visit_) (int *s) is the function pointer (which accepts int* as its paramter) declared (very firstly) as the function parameter.
You are passing PreOrder(Output_, p);
Output_ as the function address to execute
Visit_(s);
here the execution begins.
There's nothing strange inside. the confusing thing nobody is used to define the function poiner as the parameter.
Hope I answered you
SaRath.
"It is your attitude, not your aptitude, that determines your altitude - Zig Ziglar."
My Blog | Understanding State Pattern in C++
|
|
|
|
|
Sarath.<fon wrote:<="" div="">There's nothing strange inside. the confusing thing nobody is used to define the function poiner as the parameter.
Usually these are typedef'd to make the code easier to read.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Exactly. most of the people declare the function pointer as typedef one.
this is most used way
typedef void(*Visit_) (int*) ;
void PreOrder(Visit_ fxn, int *s)
{
fxn(s);
}
SaRath.
"It is your attitude, not your aptitude, that determines your altitude - Zig Ziglar."
My Blog | Understanding State Pattern in C++
|
|
|
|
|
Thank you all very much!
Sarath I see what you mean you are clear, you know it may sound stupid but although I have done some coding in different language (as a c.science student) it is the first time to hear this term "function pointer", it is strange to hear that there are pointers to functions.
What is more, I am going to check out this tutorial (thanks led mike, it was a brilliant idea to indicate this tutorial) about "function pointer" and connect all the pieces together, there are a lot of new things to learn now.
Thank you again! I appreceate it very much guys, the answers came so fast!
Melsi
|
|
|
|
|
|
Now I have all the "iamge pieces" conected together, I checked the original code I am working and now it is obvious what it does and how.
Thank you all again!
Melsi
|
|
|
|
|
Can me somebody give an example of an simple iterator (such as STL but simple) ?
Thanks.
-:KNOX:-
|
|
|
|
|
list<char> charList;
for( int i=0; i < 10; i++ ) {
charList.push_front( i + 65 );
}
list<char>::iterator theIterator;
for( theIterator = charList.begin(); theIterator != charList.end(); theIterator++ ) {
cout << *theIterator;
}
SaRath.
"It is your attitude, not your aptitude, that determines your altitude - Zig Ziglar."
My Blog | Understanding State Pattern in C++
|
|
|
|
|
An example of what an iterator class looks like or how to use them?
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Yes an class example.
-:KNOX:-
-- modified at 13:39 Thursday 29th June, 2006
|
|
|
|
|
The most basic example of an iterator is just a pointer:
char buffer[100] = "0";
char* it = buffer;
for (int i = 0; i < 100; ++i)
{
*(it++) = 'a';
}
A more indepth example would include writing a basic container class and an iterator class (iterators don't mean much without a corresponding container).
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hey guys I am having a bit of syntax problem
File: ObjectRoot.h
Class ObjectRoot {<br />
<br />
static RTI::RTIambassador* ObjectRoot::ms_rtiAmb; <br />
...............<br />
.........<br />
}
I was just wondering why you would have ObjectRoot:: included in the declaration.
Thanks
|
|
|
|
|
|
Most likely (and you see this a LOT in the RTI codebases), it is a copy-paste thing. When initializing a static member variable, you have to specify the class it belongs to:
static RTI::RTIambassador* ObjectRoot::ms_rtiAmb = NULL;
Someone probably wrote the initialization prior to adding the member to the class and just copied it.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Maybe they have ObjectRoot:: in the class because ms_rtiAmb might be used as a global variable and didn't want it mixed up. That could be a possibility
Thanks for your reply Zac
|
|
|
|
|
The compiler would not get mixed up. Did you mean a maintenance engineer?
If a member variable and a global variable share the same type and name, the member variable takes precedendce within the member functions of the same class. To access the global variable you would need to put the :: in front of the name.
I've seen better runs in my shorts! - Patches O'Houlihan
|
|
|
|
|
I want to change my dialog window class name dynamically, please tell me how, thanks.
virtual
|
|
|
|
|
VC 6.0
- right-click on the top level node in "ResourceView" window and choose "Properties" menu item
- in the "Resource File Properties" dialog, uncheck "Enable MFC features".
- right-click on dialog template and choose "Properties".
- in "Dialog Properties" dialog, type the class name, e.g. "Mama Leone"; NOTE: unless the first two steps "Class name" field is disabled.
- in InitInstance of your application add the following
WNDCLASS wc;
::GetClassInfo(AfxGetInstanceHandle(), _T("#32770"), &wc);
wc.lpszClassName = _T("Mama Leone");
AfxRegisterClass(&wc);
VC .NET
Like in VC6.0 except, instead of type the new dialog's class name in resource editor/"Dialog Properties", you have to add by hand CLASS statement in resource file:
IDD_MY_DIALOG DIALOGEX 0, 0, 320, 200
STYLE DS_SHELLFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION
| DS_MODALFRAME
| WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "My Dialog"
CLASS "Mama Leone"
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
Wow. I did not know one could do that. But, please can you tell me in what situation would one need to change a window class name?
Fortitudine Vincimus!
|
|
|
|