|
Check this.[^]. This is using windows sock function for file transfer.
writing a simple client or server is easy. you will get loads of code if you google for it.
Some sample source files
http://www.cs.rpi.edu/courses/sysprog/sockets/client.c[^]
http://www.cs.rpi.edu/courses/sysprog/sockets/server.c[^]
madhurgupta wrote: plz quickily before 30th june or 1st july....
if u can send it to maddy_manit@yahoo.co.in
Shall I point out one thing? Don't send a message on excitment. Sometimes it may feel bad to others. Here people are not answering as part of any contest. It would be nice if you specifically say what do you are bugging with or seeking for rather than what your feeling and urgency. Hope you will take it in its sense
SaRath.
"It is your attitude, not your aptitude, that determines your altitude - Zig Ziglar."
My Blog | Understanding State Pattern in C++
|
|
|
|
|
Hi all,
i need to execute code on the primary form
(the one the project start with, CalphaDlg in my case) from another
modal form.
I try with
CalphaDlg::OnBnClickedButton2();
including "alphsDlg.h" of course,
but i get the error
error C2352: "CalphaDlg::OnBnClickedButton2": not valid call to non static member function
What should i do ?
TIA,
Desmo16.
|
|
|
|
|
In the second dialog create a pointer to the CalphaDlg as member variable
CalphaDlg *m_pCalphaDlg;
now from the first dialog set this member variable
Now if u want to cal any function of the main dialog, use this pointer and call.
m_pCalphaDlg->OnBnClickedButton2();
nave
|
|
|
|
|
Sorry i made the first and the 3rd step but i don't understand the meaning of
"now from the first dialog set this member variable"
What should i do exactly ?
|
|
|
|
|
i hope u will be calling the DoMAodal of the second dialog from the first dialog. if so do like this
let m_SecDlg be the second Dialog then
m_SecDlg.m_pCalphaDlg = this; // this is what i mean
m_SecDlg.DoModal()
nave
|
|
|
|
|
Yes I understood that later.
Now it's ok.
Thanx.
|
|
|
|
|
Hi all ,
I created a dialog based application in MFC and added one menu item (ID_MENUTEST_MENU1 )
after hitting on that menu only ON_UPDATE_COMMAND_UI andON_COMMAND gets called .
i want to know the use of ON_COMMAND_EX and when it gets called?
CODE:
ON_COMMAND(ID_MENUTEST_MENU1 ,OnCommand1)
ON_COMMAND_EX(ID_MENUTEST_MENU1 ,OnCommandEx1)
ON_UPDATE_COMMAND_UI(ID_MENUTEST_MENU1 ,OnCommandUI1)
void CDataExchangeDlg::OnCommand1()
{
AfxMessageBox("Oncommand1");
}
BOOL CDataExchangeDlg::OnCommandEx1(UINT nID)
{
AfxMessageBox("OnCommandEx1");
return true;
}
void CDataExchangeDlg::OnCommandUI1(CCmdUI* pCmdUI)
{
AfxMessageBox("OnCommandUI1");
}
|
|
|
|
|
In think in case of handlers defined with ON_COMMAND_EX macro, the MFC message dispatcher is able to process your commands in chain manner.
For instance, if you have two handlers for some command -- one in a view class and another in main application frame -- and use ON_COMMAND macro, then after processing the message by the view, no other handler will be called.
But if you use ON_COMMAND_EX macro, and the view’s handler returns FALSE , then MFC will continue routing and will call the main frame’s handler too.
In your sample, the OnCommandEx1 handler will be never called because of previous OnCommand1 , even if both of them were declared with ON_COMMAND_EX . This macro has effect only in case of different command target objects.
That’s my opinion.
|
|
|
|
|
Thanks Viorel.
I removed ON_COMMAND then ON_COMMAND_EX taking effect .And as it is tanking nID so it is useful
and proves that it is just an extension to ON_COMMAND .
|
|
|
|
|
Suppose send buffer has 2 bytes free
n=send(s,buf,16,0)
Will 2 bytes of buf be sent?
I call send in FD_READ according to the received data. If I can't send the data entirely, how can I send it after that.
-- modified at 3:02 Thursday 29th June, 2006
|
|
|
|
|
followait wrote: Suppose send buffer has 2 bytes free
n=send(s,buf,16,0)
Will 2 bytes of buf be sent?
I call send in FD_READ according to the received data. If I can't send the data entirely, how can I send it after that.
Since it's not possible to send/receive whole data at a time subject to size of the data.
so before sending or putting the data into buffer, clean up the buffer and after put the data into it or simply use some delimiters to identify the end of the data.
and wait and receive until you will get all the data based on delimiter(s).
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
The send buffer of the socket depends on the system--be cleaned when the data is really sent, I shouldn't clean it manually.
-- modified at 3:48 Thursday 29th June, 2006
|
|
|
|
|
followait wrote: The send buffer of the socket depends on the system--be cleaned when the data is really sent, I shouldn't clean it manually
Agreed,
But i am talking about buf which you are using..it should be clean up before puting the data into it.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
followait wrote: Suppose send buffer has 2 bytes free
n=send(s,buf,16,0)
Will 2 bytes of buf be sent?
Normally, the send() function will block until threre's enough room in the buffer (16 bytes in this case). If the socket is in nonblocking mode, then send() might send 2 bytes or it could return SOCKET_ERROR with errno set to WSAEWOULDBLOCK .
If you are using non-blocking sockets, you must handle WSAEWOULDBLOCK situations and partial sends.
|
|
|
|
|
Thanks.
I use a nonblocking mode. If send return SOCKET_ERROR which is WSAEWOULDBLOCK, how can I handle this situation? I don't know how to take use of FD_WRITE. Could you give me some help? Thanks a lot.
|
|
|
|
|
Hi,
How to change the color of a dialog box, I need to change the Color of dialog box to the background color of window. Any help can be appreciated.
Thanks,
Krishna.
|
|
|
|
|
Use SetDialogBkColor() to set the color of the dialog box.
Regards,
Brahmma
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
WM_CTLCOLOR WM_PAINT WM_ERASEBKGND and see COLOR_WINDOW
whitesky
|
|
|
|
|
Krishnatv wrote: How to change the color of a dialog box, I need to change the Color of dialog box to the background color of window. Any help can be appreciated.
See the following code:
BRUSH CMyDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if(nCtlColor==CTLCOLOR_DLG)
hbr=CreateSolidBrush(RGB(128,45,128));
return hbr;
}
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
I think this is better
COLORREF Color;
Color=GetDC()->GetBkColor();
<code>(1)
void CtetDlg::OnPaint()
{
CPaintDC dc(this);
dc.FillSolidRect(0,0,GetSystemMetrics (SM_CXSCREEN),GetSystemMetrics (SM_CYSCREEN),
Color);
CDialog::OnPaint();
}
-------------------------------
(2)
HBRUSH CtetDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
return (HBRUSH)GetStockObject(WHITE_BRUSH);
}
(3)
BOOL CtetDlg::OnEraseBkgnd(CDC* pDC)
{
return CDialog::OnEraseBkgnd(pDC);
}
</code>
whitesky
|
|
|
|
|
|
Hi,
I have a problem with app icons. I developed an app that can be compiled for different users. Each of this users has it's own app icon and a splash screen. The splash screen is not a problem but the icon is. For now I'm doing the copy/paste of user icons over the old ones before compiling the app. Is there a way to automate this (set an ifdef in the rc file, set some precompile options in VS...)?
I,m using VS.NET 7.0
Thanks
|
|
|
|
|
yea,
use #ifdef to do the same.
On Loading Icon,
#ifdef __CUSTOM1
HICON hIcon LoadIcon(ICON_CUSTOM1);
#else __CUSTOM2
HICON hIcon LoadIcon(ICON_CUSTOM1);
SetIcon(hICon,true);
SaRath.
"It is your attitude, not your aptitude, that determines your altitude - Zig Ziglar."
My Blog | Understanding State Pattern in C++
|
|
|
|
|
I suppose that this works when I must load the icon on app runtime or not ... (if not where I must put this code)? I have to compile the app with the selected icon - the selected icon must be visible in windows explorer (explorer, desktop...)
|
|
|
|
|
Hello Friends,
I am working on Outlook Object Model(Beginner).
I am developing Addin for Outlook 2002.(There is No Version problem.I think So)
If I create a project in VC6.0 Environment then its DLL works properly in Outlook .
But if I develop same type of project In Visual Studio.NET environment it does not give any error but unable to work in Outlook.
What is the problem with .Net Environment?
Please Tell Me.
Thanking You.
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|