|
In your protocol you could make it so that the first few bytes help determine or provide the size for the next command. The other end of the pipe would then always write an atomic operation for the protocol size. You then have this common header for your protocol in which you would read first to determine the size of the next packet. You could do it in 2 steps or you could allocate a buffer which reads as much data as it can off and parses the protocol through and if a packet is cut off then simply re-read. If you want to ensure that you would never get the packet cut off then simply ensure that all packets are the same size and create the buffer as a multiple.
Otherwise I do not know of an API to peek the amount of data in the pipe currently however it is a handle so you could attempt to experiment with some APIs to see what results they yeild.
8bc7c0ec02c0e404c0cc0680f7018827ebee
|
|
|
|
|
I have a graph control in my application where i plot a series of values .I need to show the specific x and y coordinate values on the graph.
For the code what i have written it is working fine for print preview but when i print the graph, i could just see a rectangle outline on the graph but not the text content in it.But its working fine for the print preview. i have written the same code for both, passing the respective DC values whenever the respective flag is set.
Pls let me know the reason .
Regards
James
|
|
|
|
|
Are u using MFC's Print & Print Preview functions?
|
|
|
|
|
i am calling the OnPrint() function where i have created a compatibleDC() using createCompatibleDC() for the printer and passed the dc to onDraw() along with the device-independent bitmap which i need to print.
The OnDraw() function handles the code for both printpreview and printing based on the appropriate flag.
|
|
|
|
|
i have create an win32 application with mfc as a shard dll option.i am not able to access classwizard.the menu is disabled.how can i use classwizard?
|
|
|
|
|
Try erasing the class wizard file(your_project.clw file)
and try enter again to class wizard(ctrl + w).
Regards,
Eli
|
|
|
|
|
there is class wizard file
|
|
|
|
|
sorry there is no class wizard file.
|
|
|
|
|
Is this MFC project?
if so,try ctrl + W to create new class wizard file and
choose "Add all" button to add al classes to class wizard.
|
|
|
|
|
|
HI,
How can I determinate the mouse click position within an CListCtrl::OnColumnClick handler relative to the upper left corner of the headers column rectangle.
It seems that the NMLISTVIEW ptAction member is not used for this notification message ?
Thx.
|
|
|
|
|
Use GetMessagePos() to get the mouse position of the last message retrieved with GetMessage() . This should solve your problem.
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"
|
|
|
|
|
Hello!
Suppose that we have a list of printer names and papers in CComboBox.
Is there a way to get the printer DC from these info or technically :
<br />
CDC* getPrinter(LPCTSTR printerName, LPCTSTR paper, int landscape=1);<br />
Your comments & ideas are really helpful.
Thanks
|
|
|
|
|
use CreateDC(...) and pass in a properly filled devmode.
Vipin - MVP
|
|
|
|
|
Thank you very much for your comments. It really works
Sovann.
|
|
|
|
|
Hello,
I'd like to have more information about Web-Style based GUI for MFC application. There is an article here at Codeproject. However, I need more information than it provides.
I'd be very pleased if you can give some sites or articles to read.
Thanks
Allad
|
|
|
|
|
The custom control is associated with a class derived from CScrollView,
works fine, but when I try to handle WM_CREATE in OnCreate, I found that OnCreate isn't called.
I don't know where to put the initial code after the control is created and before displayed.
Thanks for help.
|
|
|
|
|
You can try to call CView::OnInitialUpdate
It is called before the control is displayed.
Cheers,
Allad
|
|
|
|
|
It's not called either.
PreSubClassWindow is ok.
|
|
|
|
|
Because when your class is ready to handle messages, the control has already been created.
So you should insert your initlizing code in PreSubClassWindow().
|
|
|
|
|
If your custom control is on a dialog or form view (created from a dialog template) then your class's OnCreate() is never called. That is because the contol window is created when the dialog is created, and then your control subclasses the window. Use PreSubclassWindow to handle the code that you would normally handle in OnCreate .
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
|
I need a example for CopyFile() in MFC..
Anyone please....
|
|
|
|
|
in MSDN Samples, there s a sample pro named fibers, which copies a file frm a src dir, to a destn dir
the source filename, qualified with path and the destination path can be input as command line parameters..
hav a nice time copyin files
thanks,
-- ano
|
|
|
|
|
Hi all -
Here is the problem.
I need to create five worker threads in my win 32 dll and keep them alive throughout the host process life time. I need to call certain routines in these threads as per the host process's calls. I want to know what are the possible loopholes in this code. Is it correct or totally wrong? Your expert and experienced comments will be greatly appreciated..
The code looks like
HANDLE m_hThreadF1 = 0; //global thread handles
HANDLE m_hThreadF2 = 0;
HANDLE m_hThreadF3 = 0;
DLL::Function1() //this routine gets called by the host process
{
if (m_hThreadF1!=0)
ResumeThread(m_hThreadF1)
else
m_hThreadF1 = CreateThread(,,ThreadFuncF1,0); //not in
suspended mode
//Wait on the above thread to finish, then return, probably via an event
}
ThreadFuncF1() //thread handler
{
//do the intended processing
SuspendThread(m_hThreadF1)
}
|
|
|
|