|
I have problem with socket functions.
Does anyone know what I am doing wrong?
I tried simple client (SMTP)
TCP/IP (SOCK_STREAM)
how program looks:
m_hSocket = socket(... //OK
connect(m_hSocket... //OK
send(m_hSocket... //OK
recv(m_hSocket... //OK
send(m_hSocket... //still OK
recv(m_hSocket... //error !!!!!
What's the problem:
I am conected.
I can send my request.
I can read answer.
I can send another request,
but I am not able to read answer.
There is some error.
( WSAGetLastError return zero ??)
How I can keep connection?
Thank you
|
|
|
|
|
The other side of the connection closed the request.
Make sure that you have a supporting reciprocator, sometimes your peer will close the connection and thats something you should detect. Remember, SMTP is not a connection based protocal, but connectionless in the sense that you don't maintain a TCP connection with the server.
|
|
|
|
|
Hello, please help me!
I want to allow a User to resize an EditControl in my SDI - Application at runtime.
I create a CEdit control with editcontrol.create(........)
when I use the Style WS_THICKFRAME all is correct and I can handle the Message WM_NCMOUSEMOVE, but I have an ugly border around my EditBox.
When I create a CEdit Box without WS_THICKFRAME no WM_NC... message is sent to my box.
How can I manage that a WM_NC... message is send to box without using WM_THICKFRAME.
(I dont know how to use WM_NCCALCSIZE)
|
|
|
|
|
Hi,
I am sending data to a dB which represents monetary values. And am using the Period (.) as the decimal symbol. But notice that the values entered into the dB vary depending on the Regional settings and the decimal symbol selected.
How do I obtain what the current settings are?
Or how does one solve the problem?
Thanks in advance
Rui
|
|
|
|
|
GetLocaleInfo gives you this kind of information in it's rawest form.
Depending on how you're talking to the DB (ODBC, OLE DB, DAO) it's normally avoidable, unless you're actually submitting raw SQL requests yourself.
Steve S
[This signature space available for rent]
|
|
|
|
|
I am trying to determine the best way to dynamically display text in a docking control bar.
I have a VC++ MFC application that is continually sent text from a separate process. I need to display this text on a multi window UI. I would like to provide a number of docking windows on the display and display the text in these windows.
I have implemented a test application by deriving my own class from CDialogBar and creating a CClientDC object to display the text in my docking Dialog Bar window.
Is this the best way to achieve my desired result?
Secondly I want to have a scroll bar on my docking control bar window so I can scroll the displayed text. So far I have not been able to create a scroll bar on a Control Bar window.
What is the best way to achieve this?
Any suggestions on the above to points would be greatly appreciated.
Thanks,
David
|
|
|
|
|
DavidH wrote:
Is this the best way to achieve my desired result?
There are quite a few ways to achieve your result - the best one is the one that works for you. Sounds like you have a good start, perhaps simply creating an Edit control on your dialog bar would suffice (and take care of your scrollbar problem).
For a fancier solution, check out this:
http://www.datamekanix.com/[^]
Shog9
------
Rather hammer futiley at the locked door than just sit and ignore it. Obviously finding a way to get through the locked door would be even better though. - Paul Watson, My Ignorance
|
|
|
|
|
Ok,
I hope someone can help. I have a small app written in C++ in Visual Studio 6 which has to to ported to C++ in Visual Studio .Net Everything comiles fine apart from the call to the HtmlHelp. The line of code in VS6 look likes this :
HtmlHelp(NULL, "unitshelp.chm::/Unit_Definitions_Dialog.htm", HH_DISPLAY_TOPIC, 0);
Now when this compiles in VS.Net it just says that HtmlHelp does not take 4 parameters. I can't find anything on MSDN that tells me how to display my HtmlHelp file. All it says is that HtmlHelp takes a DWORD_PTR and a UINT!!! My app contains all the necessary includes and libraries because it was working just fine when compiled in VS6. Any help greatfully received;)
Jeremy
___________________________
Jeremy Preston
|
|
|
|
|
Hi dear,
How can I change a directory security programmatically?
Thank you in advance.
|
|
|
|
|
:(I need to draw an icon using BitBlt function so to draw it within limited rectangle and I need the exact width and height of the icon. I noticed that if the icon is drawn using the standard colors, Ipicture.get_Width and Ipicture.get_Height will return the exact width and height of the icon, but if the icon is drawn using 265 colors, Ipicture.get_Width and Ipicture.get_Height will not return the correct values. What can I do to overcome this problem?
Julia
|
|
|
|
|
Does anyone know a product (free or not) like a C++/MFC library, ActiveX control, etc. that is a mathematical equation editor? I also need a mathematical expression evaluator. My problem is that I have a set of equations that have to be input in an MFC application. For this, I need an equation editor. Then, I need to evaluate the equations in a certain order that is why I need the expression evaluator. I will appreciate any help you can give me.
|
|
|
|
|
I've written a bunch of them. Currently I was working on one that would compile the expression into actual machine code so it would (hopefully) be able to evaluate the expressions faster (i.e, wouldn't have to traverse the parse tree each time). If you're interested, I might write an article on it.
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
First of all, thanks for your help. As I understand you have written the lexer and parser for mathematical functions/expressions. I really would be interested in that. In my case, I don´t think machine code is necessary because the number of equations is not very high but if you have a lexer and parser and it works... then I am interested. Hope you have the time to write an article. I will also be interested in a graphical equation editor to make a nice GUI. Do you know any of this?
|
|
|
|
|
Yes, I have written the lexer and parser for the expressions. I've actually started working (just yesterday), on a new expression parser for a C++ preprocessor I'm working on. The new expression parser won't be recursive descent like my others, but will use operator precedence parsing. The current expression parsers that I have all use recursive descent techniques. I use the same lexer in either project (an almost complete C++ lexer I'm working on).
I had planned on writing a demo application with my article which would show graphs of equations, so it sounds like it's just what you are looking for (minus the machine code generation).
Anyways, if you are in a hurry to get some source code (don't want to wait for the article), I can package the lexer and expression parser up for you in a sample project. However, this wouldn't include any graphing abilities yet. Keep in mind, that I don't make any warranties concerning the software though. It's only been tested by me, and may (probably does) still have bugs in it.
Let me know what I shall do
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
As I see the problem, I can have a graphical equation editor as complex as is needed but the equation can be stored in any format I want. I will appreciate it if you can send me a project example. This way I can see if it is what I need. Of course, something like Mathematica (from the graphical point of view) would be great but in this case it is too much. I just need a nice GUI and an evaluator for the equations. In the problem, the result of evaluating an equation can be an input variable for another equation. If you want to write an article i guess i can wait another week or so. If you can send an example in advance, I will be able to check it and may be to give you some feedback or ideas for your article.
In any case, here are my thanks for your help.
Best Regards,
Miguel Segarra
|
|
|
|
|
The idea just came to me that you may be looking for something way more complicated than I originally had in mind. Are you looking for something like Mathematica[^], which will let you input and parse equations just like you would on paper? If so, I'm afraid I've mislead you. What I have written is something which will parse C/C++ style expressions. If this isn't what you are looking for, I'm sorry. If it is, however, then I'll be glad to help.
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
I have an MDI MFC app where for "ease of use" I want the MDI child windows to stay maximized. When I create them, the frames are initially maximized (WS_MAXIMIZE is set as a style), and they have no minimize or maximize button.
So far so good, but when I use the "Windows" menu to switch between them, it insists on restoring all the MDI child frames.
I hacked around this by handling the OnMDIActivate, and if the frame is being activated, I do a ShowWindow(SW_MAXIMIZE).
Only problem is that this shows as a set of restored windows (as the other MDI children are repainted), and then the active window repaints itself maximized. This leaves a flickering effect on screen for around a quarter of a second
Is there a way I can suppress this?
Steve S
[This signature space available for rent]
|
|
|
|
|
You're must add red line
void CChildFrame::ActivateFrame(int nCmdShow)
{
<code>nCmdShow = SW_SHOWMAXIMIZED;</code>
CMDIChildWnd::ActivateFrame(nCmdShow);
}
Best regards,
Eugene Pustovoyt
|
|
|
|
|
Thanks, Eugene, but that was the first thing I'd tried.
I still get the flashing effect. (Presumably it's something to do with the way the windows are being managed). I think I might be able to get around it by making the (other) frames invisible, rather than having them switched to restored size. It wouldn't be a problem, but one of the panes in the child frame is a form, and I don't want the user to have to scroll it, as there's no non-mouse interface to achieve that, and at least one of the users cannot use a mouse or pointing device.
Steve S
[This signature space available for rent]
|
|
|
|
|
Hi Steve,
This MDI behavior is a pain, and varies across Windows versions. The snippet below is what I do in ED (see sig) to try and handle this. Hope it helps.
CWnd* pMDIClient = NULL;
BOOL bMaximized;
pMF->MDIGetActive( &bMaximized );
if ( bMaximized )
{
pMDIClient = pMDIChild->GetParent();
pMDIClient->SetRedraw( FALSE );
}
pMF->MDIActivate( pMDIChild );
if ( bRestoreMinimized and pMDIChild->IsIconic() )
pMDIChild->MDIRestore();
if ( bMaximized )
{
pMDIClient->SetRedraw( TRUE );
pMDIClient->RedrawWindow( NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE | RDW_ALLCHILDREN );
}
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
I have a thread handle,when the thread exit.the handle is invalid(0xfeeefeee).
and i want to clearly when is it valid and when is it invalid.
please show me a solution,thanks.
Scratch
|
|
|
|
|
A Thread handle IS valid even after the Thread exits. There is an error in your code that's corrupting the handle value.
But, answering your question: you can always call a harmless API function that needs a thread handle, say GetThreadPriority. If it returns ERROR_INVALID_HANDLE, you know the handle is invalid.
lazy isn't my middle name.. its my first.. people just keep calling me Mel cause that's what they put on my drivers license. - Mel Feik
|
|
|
|
|
thank you for your help,but my code goes like:
In main thread.
<br />
if(m_pScanThread && m_pScanThread->m_hThread != NULL)<br />
{<br />
m_pScanThread->PostThreadMessage(UWM_TIMERON,0,0);<br />
}<br />
else<br />
{<br />
m_pScanThread = AfxBeginThread((AFX_THREADPROC)fnScanProc,NULL);<br />
if(m_pScanThread && m_pScanThread->m_hThread != NULL)<br />
m_pScanThread->PostThreadMessage(UWM_TIMERON,0,0);<br />
}<br />
Thread function.
<br />
CoInitializeEx(NULL,COINIT_MULTITHREADED );<br />
try<br />
{<br />
DWORD dwRet;<br />
MSG msg;<br />
while(dwRet = GetMessage(&msg,NULL,0,0) != 0)<br />
{<br />
if(dwRet == -1)<br />
{<br />
continue;<br />
}<br />
else<br />
{<br />
if(msg.message == UWM_TIMERON)<br />
Scan(...);<br />
else<br />
DispatchMessage(&msg);<br />
}<br />
}<br />
}<br />
catch(...)<br />
{<br />
return -1;
::CoUninitialize();<br />
}<br />
::CoUninitialize();<br />
return 0;
Scratch
|
|
|
|
|
I never use MFC thread classes, for me they are just so much trouble for a simple _beginthread. But I'm sure that you can store the m_hThread in another variable just before the thread starts.
and, beware of this code:
m_pScanThread = AfxBeginThread((AFX_THREADPROC)fnScanProc,NULL);
if(m_pScanThread && m_pScanThread->m_hThread != NULL)
m_pScanThread->PostThreadMessage(UWM_TIMERON,0,0);
IIRC, you need a small Sleep or a Sleep(0) just after the AfxBeginThread for the other thread begin starting, otherwise in a 100% CPU machine you'll have problems.
lazy isn't my middle name.. its my first.. people just keep calling me Mel cause that's what they put on my drivers license. - Mel Feik
|
|
|
|
|
Be warned!
Using ::BeginThread with mfc corupts the mfc state handling!
As far as I understand _beginthread is a wrapper for the Win32 API.
|
|
|
|