|
Hi me again with one another question.
I am writing a program which opens a serial port in order to write on it . I succed in opening the serial port and configuring it . Somebody wrote a function for me but this function sends integer to serial.I want to send string to serial . The code is bellow :
int CMC35ProjectDlg::Send(BYTE data)
{
///////////
//Begin
//////////
//Send Data to serial Port
DWORD dwBytes=0;
BYTE d=data;
int ret=d;
BYTE* sbuf=&d;
BOOL stest=WriteFile(hcom,sbuf,1,&dwBytes,NULL);
if ((stest&&dwBytes)==FALSE)
{
MessageBox("Connection between your PC and MC35 device connot be establish.\nPlease try again later.\nCheck the serail cabel.\n(ËÜèïò êáôÜ ôçí åêôÝëåóç ôçò óõíÜñôçóçò send).",
"Error!",MB_OK | MB_ICONSTOP);
ret=-1;
}
return ret;
//////
//End
//////
}
Any idea converting this function to send strings to serial?
Another problem I have is that I want a variable to take the follow content AT+CMGL="REC UNREAD".How can I succed it?
Thank you in advence.
X-The truth is out there.
|
|
|
|
|
The easiest solution is to loop over all the characters of the string and call CMC35ProjectDlg::Send to send them all one by one. This is highly inefficient, though, a better approach is to use WriteFile to write all the chars in one call. CHeck your documentation for this function.
As for your second question, I guess it's the embedded quotes that's causing you trouble. The syntax is as follows:
const char* command="AT+CMGL=\"REC UNREAD\""; Good luck.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thank you for your help.My second question was answered and I thank you.This works just fine.But I don't understand your help for my first question.Look my code above I use the WriteFile function.How can I use this function in order to send strings to serial port.Any idea?
Thank you in advance.
X-The truth is out there.
|
|
|
|
|
Hello,
Can anyone tell me why one should use this feature of declaring classes inside other classes. Apart from not having the namespace too big at least.
Because apparently there's no feature involved. You cannot have access to the enclosing member classes, which is a cool thing in Java I reckon.
Best regards,
Alexandru Savescu
|
|
|
|
|
The namespace issue is IMHO the main reason for having nested classes. Consider for instance different containers (vector , list , map ) like the ones provided by STL. Each container features a different iterator type, which is best defined as a nested class, so that yu name it vector::iterator , list::iterator and so on. This uniformity makes it simpler to write generic code, also.
Another point (not related with this) is that having a nested class in the private section of an enclosing class makes the nested class inaccesible (and not derivable) to external users.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I used BCGMenuBar in an SDI application.
I changed the layout of MenuBar by using
m_wndMenuBar.ModifyStyleEx(0,WS_EX_LAYOUTRTL);
where m_wndMenuBar is a pointer to CBCGMenuBar.
PROBLEM
........
The "POP UP MENU" when i have a click on menu bar, does not consider the Right to Left layout.
It pop up in the normal(left to right style).
How i change the style of pop up menu....
I mean how i open it in the (Right to Left)fashion.
|
|
|
|
|
You should post this question to the bcg forums on www.bcgsoft.com
Best regards,
Alexandru Savescu
|
|
|
|
|
hi every body
i had an old projects desgined with vc++5.0 (source code), when i built these projects I couldn't make an exe file for this project.
Best Regards
|
|
|
|
|
Any error messages, warnings etc???? What's in the output window?
|
|
|
|
|
Perhaps you could give more details about the errors... for example what does the compiler say? Linker error?
-Dominik
|
|
|
|
|
the problem happen when I press Go Button the program, i got the following message:
Unhandled exception in file.exe: 0xC0000005: Access Violation
Best Regards
|
|
|
|
|
This probably has to do with initialization. You are most likely referring to an object that has not yet been initialized. Try to step through your code instead of using GO and determine which statement results in the error.
Good luck
|
|
|
|
|
The error code as follow:
First-chance exception in 日记.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
How can I solute it?
Don't look at me in that way!
|
|
|
|
|
white jungle wrote:
How can I solute it?
A two fingered salute works for me
Seriously, how do you expect anyone to solve your problem ? Did you get this error running your own code ? If so, why didn't you post some code to show where it crashes ?
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
I debug the project!
And I haven't set any break point! So I don't know where throw the wrong code!
And the error code was put out in the output window,And the programsalon hadn't been stoped .So I can't find where the error occured!
If I post My code,Oh,My God!I can't Image!
Don't look at me in that way!
|
|
|
|
|
First, has the program crashed, or are you just seeing a First-chance exception in the output window?
When you are running a program in the debugger that throws exceptions, you will see a First-chance exception in the output window whenever the program throws an exception. This doesn't mean that anything is wrong. The debugger shows you this to tell you that an exception was thrown. The default action then is for the debugger to pass the exception on to the program. If the program has a catch handler for the exception, it then processes it and the program continues to run.
Some parts of the run-time library use exceptions as part of their normal execution. As long as the program is working properly, I wouldn't worry too much about it.
The debugger also allows you to change the default action for exceptions to stop when an exception occurs (rather than only stopping if the exception is not handled). This is available under the "Debug" menu, as the sub-menu choice "Exceptions...". I wouldn't normally change these settings.
Best regards,
John
|
|
|
|
|
white jungle wrote:
If I post My code,Oh,My God!I can't Image!
Then don't bother asking for help - no-one can help you without seeing the code.
You can also sprinkle your program with message boxes as another way to find where the error is, or even better, with TRACE statements, which output to the debug window when you run in debug mode.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
Look at the stack window. This will tell you which function the exception occurred in. Then look at all of the functions below the stack to see if you can find any thing that has invalid data.
This should get you started.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Hi,
with this message, when I compile my soft, he can't recognize my members variable from a class.
How can I do for recognize it ?
Best Regards
youssef
|
|
|
|
|
Are you talking about in debug? Well, /OPT:REF is usually found with release mode builds and thus you wouldn't have any debug information by default.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Can someone please help me, I'm trying to edit the poperties of an exe file. Right clicking the icon only brings up the general properties and not the other tabs. I want toget the program tab up so I change the path name. And there is also a check box for ms dos programs "Exit after Run" I want to uncheck that.
|
|
|
|
|
You want to edit the path name of an executable ? To change the path, you need to cut and paste the file.
Klara wrote:
And there is also a check box for ms dos programs "Exit after Run" I want to uncheck that.
Where have you seen this dialog ? If you want a program to wait for you after it finishes running, you'll need to put in the code to wait for a keypress. As I've said already, I can't help you because I only know how to do that in C++, that is, using iostreams.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
Christian wrote:
Where have you seen this dialog ?
When you right click on an icon of an exeyou can select the properties. There are several tabs usually and the second one concerns the program. For my exe I only see the general properties..file size etc.
Anyway thanks for your help.
|
|
|
|
|
I've worked it out - you want the tab you get for a shortcut, and it allows you to set the directory that it links to. Like I said, you can't change the folder of an exe, except by moving it.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
i am writing a Drawing program, i use Layers in it
how should i do if i want to erase some parts of current layer and leave
other layers without changing, which means their graphics still show as
before. i want to do as the Flash's eraser.
thank u for help
BTW: i used CTypedPtrArray to store every layer
|
|
|
|