|
*if* your printer is connected to LPT1 you might be able to do the following:
<br />
ofstream printer;<br />
printer.open("LPT1");<br />
printer << "Hello World!" << '\n';<br />
And when your done streaming text to the printer you can try sending a control character of 0xC which was the old ASCII Form Feed[^] or (FF) character.
Best Wishes,
Randor (David Delaune)
|
|
|
|
|
Hello Friends,
I am been using CSocket in my application. But i want to know is CSocket a blocing socket or non-blocking socket, and what are the differences between them ?
Girish
Software Developer
|
|
|
|
|
Girish601 wrote: But i want to know is CSocket a blocing socket or non-blocking socket, and what are the differences between them ?
Hmmm MSDN->CSocket[^]
CSocket Class MSDN wrote: A CSocket object also provides blocking, which is essential to the synchronous operation of CArchive. Blocking functions, such as Receive, Send, ReceiveFrom, SendTo, and Accept (all inherited from CAsyncSocket), do not return a WSAEWOULDBLOCK error in CSocket. Instead, these functions wait until the operation completes. Additionally, the original call will terminate with the error WSAEINTR if CancelBlockingCall is called while one of these functions is blocking.
|
|
|
|
|
See Windows Sockets: Blocking[^]
CSocket is a high-level wrapper for a socket (SOCKET). To you, it's always blocking. Whether
the underlying SOCKET is in blocking mode or not is handled by the CSocket implementation.
For a non-blocking socket you can use the CAsyncSocket class or use Winsock APIs directly.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hey there. Can anybody tell me why, when you create a dialog app in VS2005 if you right-mouse click on the dialog in the resource editor then "Add Event Handler" menu option is greyed out? I want to be able to add OnInitDialog and OnPaint handlers to this dialog but cant!
If i drop a button control on the dialog through, and right click on that, then that works!!
thanks in advance.
|
|
|
|
|
To add non-control message handlers, you have to go to the source file, and place the cursor on the closing message map macro, and then go to the properties pane. At that point you hould be able to add the handler for that message.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: To add non-control message handlers, you have to go to the source file, and place the cursor on the closing message map macro, and then go to the properties pane. At that point you hould be able to add the handler for that message.
[sarcasm] Clearly that's so much easier than VS6[/sarcasm]
Thanks for the tip, not that I will remember it, just seams easier to write it out.
|
|
|
|
|
Yeah... This goes a long way to reinforce Microsoft's claim that they are eager to support their C++ developers. The 2005 IDE sucks if you're a MFC programmer. I seriously doubt that ORCAS would add any usability for us...
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hey John! No way, i would have never have found that out.. Thanks a million..
It all becomes clear (as mud!)
|
|
|
|
|
:omfg:
--
Now with chucklelin
|
|
|
|
|
John Simmons / outlaw programmer wrote: you have to go to the source file, and place the cursor on the closing message map macro, and then go to the properties pane.
You can also just click anywhere within the class definition in the .h file, and then go to the properties pane.
|
|
|
|
|
That doesn't always work. In fact, neither does my original response.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
hi i have read a file and then based on the result i have to add items in list control. the contents in the file can be changed. hence i have to read the file everytime. i dont know how to add the items in list control
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
Adding items to a List Control is simple, see for instance [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hi,
I'm facing a problem which i don't know how to solve...
I created a dialog which contains several edit boxes.
When activating the dialog , the first edit box automatically receives the input focus.
My problem is that I need to receive the ON_WM_KEYDOWN in the parent dialog,
but since the focus is on the first edit box - I will never get it.
I tried to catch the ON_WM_KEYDOWN message in PreTranslateMsg , but
I'm facing the same problem.
Anyone???
With best regards,
Eli
|
|
|
|
|
If you want to monitor when the text in the edit box changes, you could do something with the EN_CHANGE notification which is sent when the text in an edit box changes..
If you want to monitor keyboard messages, then i'm not sure that the WM_KEYDOWN message is applicable to dialog boxes.. You could try creating a window using the CreateWindow() or CreateWindowEx API, then programatically creating the controls, and then testing for the WM_KEYDOWN message..
Hope this helps!
--PerspX
|
|
|
|
|
Hi PerspX ,
First,thanks for your quick reply.
What is the difference between creating the control during the design time
and during runtime(the control is being created in a different way???).
Anyway,My problem is not catching the messages in the control,
but catching the messages in the dialog...
Thanks again,
Eli
|
|
|
|
|
No i mean creating the window using the CreateWindow() or CreateWindowEx() API as opposed to creating a dialog window. Creating a window like this will create a "proper" window as opposed to a dialog window - take a look at this article for more information. I think - but im not sure - that some window messages dont get passed to dialog windows and i think WM_KEYDOWN is one of them.. I think I have tried that in the past to no avail.. So create the window "properly", then create the controls in it using CreateWindow() and CreateWindowEx(), and specifying the control classes (see this article on MSDN if you do not know these classes).
Hope this helps!
--PerspX
|
|
|
|
|
eli15021979 wrote: I need to receive the ON_WM_KEYDOWN in the parent dialog,
but since the focus is on the first edit box - I will never get it.
May this link help you setting focus to dialog
Best Regards,
Suman
|
|
|
|
|
Hi Suman,
Thanks for the link...
However,it doesn't say how to set the focus to the dialog itself,but only
to one of the controls in the dialog(or maybe I didn't saw it?)
Thanks again,
Eli
|
|
|
|
|
Hi Eli,
I am very sorry, there is no information about how to set focus to dialog itself in the URL I provided . May you can try posting the same question again. I hope somebody will know answer and help you!!
Best Regards,
Suman
|
|
|
|
|
Try returning FALSE from your dialog's OnInitDialog() override.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Mark Salsbery wrote: Try returning FALSE from your dialog's OnInitDialog() override.
Dear Mark,
I created test application and tried returning FALSE, but the focus is still in edit box.
There should be some way to do this.
Best Regards,
Suman
|
|
|
|
|
hmmm Yes I tested that and I couldn't get it to work. The dialog wants the keyboard focus on a
control no matter what.
Trying to remove the focus was fruitless as well. I tried both SetFocus() and WM_NEXTDLGCTL.
*trying some more stuff...*
This looks promising ...
add a ON_WM_SETFOCUS() entry to the dialog's message map
Add an empty OnSetFocus() handler method:
void CMYDlg::OnSetFocus(CWnd*)
{
}
At the end of the dialog's OnInitDialog() override (instead of returning TRUE), add:
SetFocus();
return FALSE;
See if that works for you...
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi Mark,
Thanks, now there is no focus on controls in a dialog.
What is happening if you are not calling SetFocus() in OnInitDialog()?
I hope Eli can get the messages in dialog!
Best Regards,
Suman
|
|
|
|