|
Hi to all,I facing some problems when i executed a source code in Visual C++ under MFC environment.Hope someone can help me to solve it.
Well actaully this file is running fine if i compile it under Visual C++ Win32 console application.
But once i put it into Visual C++ MFC environment,it didn't show any error,but it just not fuctioning.
char c;
ofstream modem("COM1:");
printf("Resetting MODEM\n to Dial");
modem << "ATZ\n";
modem.flush();
c = getchar(); // wait for modem to finish
modem <<"ATDT0123246448\n";
modem.flush();
printf(" to Hang-UP\n");
c = getchar(); // wait for modem to finish
modem <<"ATH0\n";
modem.flush();
Hope guru's can help me on this.
Thank you.
|
|
|
|
|
Try using OpenFile() instead. I've used it to talk to a printer on an LPT: port.
/ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
Hi guys, I actually have three unrelated questions that I would like answered, they are :
1.) Can you have ranges in a switch statment, i.e.
switch (i)
{
case 0..20 : do something;
case 20..120 : do something;
case 170..450 : do something;
}
Obviously the dotted line doesn`t work, but what do I have to do to get such a switch statement to work?
2.) Is there any way of getting the maximized state of a child window, without using one of the OnDoSomething() functions, i.e. is there a function in MFC which will tell me, true or false, the current child window is maximized?
3.) How can I create one control that holds separate integers in the format :
1 | 2 | 3
3 | 2 | 1
2 | 1 | 3
oh I also would like to know how to make it change size, say to hold five integers accross, and maybe three down.
Thanks for reading this far guys, if you know the answer to any of the three questions, or merely have an idea, please let me know, I would be very grateful.
Thanking you all,
Alan.;)
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|
|
2. Look up CWnd::IsZoomed in MSDN
Michael
|
|
|
|
|
Michael your answer to question was Perfect! What a weird name to call it though? I was looking through the MSDN help for IsMaximized etc etc.., ah well you live and learn,
Thanks for the response Michael,
Alan.
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|
|
1) Nope, you can't do ranges, unfortunately. You need to use an "if" statement.
2) IsZoomed, as answered by Michael.
3) I don't know. You want to create a custom data entry control? Why not use several edit controls placed next to each other?
Regards,
Alvaro
|
|
|
|
|
1.)
switch (i)
{
case 0:
case 1:
case 2:
...
case 20:
break;
case 21:
case 22:
...
case 450:
break;
}
Though you should just use an if statement.
if ()
else if ()
else
3.) Try Chris Maunder's Grid Control.
Jon Sagara
"Ninety percent of baseball is mental, the other half is physical." -- Yogi Bera
|
|
|
|
|
Thanks for the responses guys, especially for the Grid control link (Jon) cos its pretty much what I need (i need a simplified version, but I`ll just cut it down to that). I didn`t think you could have the ranges in a switch statement (since there are no books that describe how to) so thanks to both Alvaro and Jon for reaffirming my doubts. Oh and thanks to Chris Mauder for actually producing the Grid Control and making it freely available.
Cheers guys,
Alan.
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|
|
- Yes, if you use Pascal instead of C/C++ . (Silly answer).
- You can also use GetWindowPlacement() for the general case, but IsZoomed() as pointed out earlier, is definitely easier.
- In general, you need to override the control's WM_PAINT handler to "do the right thing", i.e. display the numbers in an appropriate format. You can use Chris' grid control, but if you want your class to be lightweight, you'll probably want to just override OnPaint().
/ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
In response to your answers :
1. Yep, thats why I asked if you could do it in C++.
2. Its definately the easiest function, and the most appropriate for what I want.
3. I am seriously thinking of doing your OnPaint overriding advice, cos I've had a look at Chris's non-MFC code, and I must be honest, I`m struggling to understand it.
Thanks for your response though,
Alan.
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|
|
HI, All!!!
=======
MyApp.exe arg1 arg2 arg3
To get those arguments in a console application we do it like this:
void main (int x, char ** y)
{
... y[1] ...
... y[2] ...
... y[3] ...
}
How do we do it in MFC basedialog application ???
Thanks.
BTW: come to #CodeProject on DalNet (mIRC)
|
|
|
|
|
Have a look at CWinApp::ParseCommandLine in MSDN.
Michael
|
|
|
|
|
You can use ParseCommandLine like Michael mentioned or the __argc and __argv macros.
Regards,
Alvaro
|
|
|
|
|
I have used GetCommandLine() to do that, but it may not be exactly what you are looking for..
It maybe another option
Rob
|
|
|
|
|
Do you know how can i have my resources (ex. a Button in a dialog box) in a language such as Greek which needs Unicode?
I want to have buttons in Greek
|
|
|
|
|
Hi,
How do I pass on a variable argument list to another function?
E.g. In the example below I want to pass the variable argument list passed through to PrintOutput() onto fprintf.
PrintOutput(char * format, ...)
{
//I want to pass variable list through to fprintf????
fprintf(stderr, format, ...); //This does not work as it is???????
}
Thanks in advance
Neil
|
|
|
|
|
Here's an example from the MFC CString class.
void AFX_CDECL CString::Format(LPCTSTR lpszFormat, ...)
{
ASSERT(AfxIsValidString(lpszFormat));
va_list argList;
va_start(argList, lpszFormat);
FormatV(lpszFormat, argList);
va_end(argList);
}
look up va_list and va_arg in MSDN for more info.
Hope this helps,
Bill
|
|
|
|
|
hi guys,
i'd like to know how to display a static text in bold (italic, etc.) and also how to change its colour, is it possible ?
thanks to you
Fred
|
|
|
|
|
|
thanks Michael, that looks exactly what i want to do.
see you.
|
|
|
|
|
Hi!
I have got a subclassed CEdit control. When trying to scroll to the last line nothing happens. Also, when inserting text with SetWindowText I get an extra linebreak at the top of the Edit box. Anyone got an idea?
Cheers,
/Fredrik
|
|
|
|
|
Generally, if you visit to website, the site's information is saved in cookies.
now, I have many buttons.
When each button click, my computer call IE window.
I want to give a indication in saved cookie.
The indication is a meaning to come from my computer.
how to?--;
please give a courage.
|
|
|
|
|
To send cookies, you need to add them to the header of your http request. I got this from MSDN:
Cookie Header
The Cookie header is included with any http requests that have a cookie whose domain and path match the request. The Cookie header has the following format:
Cookie: <name>=<value> [;<name>=<value>]...
One or more string sequences, using the format <name><value>, contain the information that was set in the cookie.
You would use it like this:
header = "Cookie: Button1:state1;Button:state2";
then include the header in your Navigate call.
Thanks for the help,
Bill
|
|
|
|
|
To send cookies, you need to add them to the header of your http request. I got this from MSDN:
Cookie Header
The Cookie header is included with any http requests that have a cookie whose domain and path match the request. The Cookie header has the following format:
Cookie: <name>=<value> [;<name>=<value>]...
One or more string sequences, using the format <name><value>, contain the information that was set in the cookie.
You would use it like this:
header = "Cookie: Button1:state1;Button:state2";
then include the header in your Navigate call.
Hope this helps,
Bill
|
|
|
|
|
i have got two scrollviews on my dialog. (used them as two scrollcontrols.. but don't mind that..)
the fact is that they are both intended to work together -> the one shows the headlines, the other one shows the data (something like a report generator).
My question now was how to link these two scrollviews, that the user can scroll either of them, and the other one would scroll too...
another question would be (but this is not really important) how to hide the scrollbar of the upper scrollview..
is there anybody having an approach for this ?
thank in advance and have a nice day
Bernhard
"There are three roads to ruin: women, gambling and technicians. The most pleasant is with women, the quickest is with gambling, but the surest is with technicians." Georges Pompidou
|
|
|
|