|
WM_SETFOCUS is a message, not a function. moreover, you can call SetFocus() anywhere (in a handler you created for example)
TOXCCT >>> GEII power
|
|
|
|
|
It is right, WM_SETFOCUS is a message.
When a window receive this message, it can reject its focus by calling SetFocus!
|
|
|
|
|
i need c++ source code (library) to covert bitmap file to gif file, the code is in c or c++ style, not COM or ActiveX.
thanks for any link
cheers
includeh10
|
|
|
|
|
|
Dear Friends,
I am using CAsyncSocket and CSocket for writting a server program. In AsyncSocket I am using
virtual void OnAccept(int nErrorCode);
virtual void OnClose(int nErrorCode);
virtual void OnReceive(int nErrorCode); and also in Socket I am using
virtual void OnAccept(int nErrorCode);
virtual void OnClose(int nErrorCode);
virtual void OnConnect(int nErrorCode);
virtual void OnReceive(int nErrorCode);
Also in the dlg.cpp file,
At InitDialog I am writting
m_cSocketServer.Create(4000);
m_cSocketServer.Listen();
m_cAsyncSocketServer.Create(4000);
m_cSocketServer.Listen();
Also at the Onbutton message I am checking and writting a message into a display like this
void CMFCServerDlg::OnButtonConnection()
{
// TODO: この位置にコントロール通知ハンドラ用のコードを追加してください
char DispBuf[256];
if(m_cSocketServer.Create(4000) && m_cSocketServer.Listen()){
sprintf(DispBuf, "Server Started");
AfxGetMainWnd()->GetDlgItem(IDC_STATIC)->SetWindowText(DispBuf);
}
else{
sprintf(DispBuf, "Connection Failed");
AfxGetMainWnd()->GetDlgItem(IDC_STATIC)->SetWindowText(DispBuf);
}
For other reference....
LRESULT CMFCServerDlg::OnAccept(WPARAM wParam, LPARAM lParam)
{
m_cSocketServer.Accept(m_cAsyncSocketServer);
DestroyFlag = TRUE;
return 0;
}
This is a user message send by the AsyncSocket and Socket from OnAcceptMessage....
My applicaion is very simple and with the above code it is not working. Will you please help to detect the error. Why this code is not suitable to develop a simple server.
Here, I have a dialog box with one button and a text box. Button is for to start a server and text box is nothing but to display a message that server is started.
Please help me to find out the solution.
Thanking You in advance.
Billar
|
|
|
|
|
there are few samples in MSDN (VC CD), you can learn from those samples, they are not complex.
cheers
includeh10
|
|
|
|
|
Hi includeh10
I don't have msdn. So if you can provide the such samples, it will be a great help to me.
Waiting for your reply.......
Billar
|
|
|
|
|
I didn`t get your question. where did it not work? Do u hawe IIS or PWS? Change the port ? I`m just guessing, cause i don`t know where is the problem. So the me the detail
|
|
|
|
|
Dear Friends,
I am using CAsyncSocket and CSocket for writting a server program. In AsyncSocket I am using
virtual void OnAccept(int nErrorCode);
virtual void OnClose(int nErrorCode);
virtual void OnReceive(int nErrorCode); and also in Socket I am using
virtual void OnAccept(int nErrorCode);
virtual void OnClose(int nErrorCode);
virtual void OnConnect(int nErrorCode);
virtual void OnReceive(int nErrorCode);
Also in the dlg.cpp file,
At InitDialog I am writting
m_cSocketServer.Create(4000);
m_cSocketServer.Listen();
m_cAsyncSocketServer.Create(4000);
m_cSocketServer.Listen();
Also at the Onbutton message I am checking and writting a message into a display like this
void CMFCServerDlg::OnButtonConnection()
{
// TODO: この位置にコントロール通知ハンドラ用のコードを追加してください
char DispBuf[256];
if(m_cSocketServer.Create(4000) && m_cSocketServer.Listen()){
sprintf(DispBuf, "Server Started");
AfxGetMainWnd()->GetDlgItem(IDC_STATIC)->SetWindowText(DispBuf);
}
else{
sprintf(DispBuf, "Connection Failed");
AfxGetMainWnd()->GetDlgItem(IDC_STATIC)->SetWindowText(DispBuf);
}
For other reference....
LRESULT CMFCServerDlg::OnAccept(WPARAM wParam, LPARAM lParam)
{
m_cSocketServer.Accept(m_cAsyncSocketServer);
DestroyFlag = TRUE;
return 0;
}
This is a user message send by the AsyncSocket and Socket from OnAcceptMessage....
My applicaion is very simple and with the above code it is not working. Will you please help to detect the error. Why this code is not suitable to develop a simple server.
Here, I have a dialog box with one button and a text box. Button is for to start a server and text box is nothing but to display a message that server is started.
Please help me to find out the solution.
Thanking You in advance.
Billar
|
|
|
|
|
do you have an error at compile time or run time ?
what does it say to you ?
TOXCCT >>> GEII power
|
|
|
|
|
Dear Freinds,
Thank you all for the information and kind response. MY problem is solved. Actually the problem was at the client side. I was not initializing the socket at the client side at InitInstance.
But now it is solved.
Thank you once again for everything.
Bye
Billar
|
|
|
|
|
when you first run a MDI app you have the empty space, the dark gray background. I'm wondering if it's possible to draw in that space. For example is it possible to paint it white and place text, perhaps a bitmap, or just paint it white period.
thanks!
|
|
|
|
|
Yep, sure can. The MainFrame (or CMDIFrameWnd) will have a m_wndClientArea variable. From that you can either subclass that window and do what you want, or create a sub-control to place onto it. I used the sub-control method to create a "start page" that had a MRU list and stuff that really wasn't a document.
--
Joel Lucsy
|
|
|
|
|
I guess I'm a little ignorant on implementing that solution. Do you have a sort of "sub-control for dummies" article on what you did? That is pretty much what I am looking for.
Thanks!
|
|
|
|
|
|
|
How do i go about adding a skin to windows? For example, make the window background and it's button controls have picture in them.
|
|
|
|
|
Search in codeproject there are about 10 skin examples with mfc and without...
Well... I am a beginner ...
|
|
|
|
|
You know how when you press the tab key on a window it goes through controls like buttons, radial buttons, and normal buttons in a certain sequence? Well, I have 3 edit boxes that I want to go in a certain sequence as I tab through them. How do I go about doing that?
Thank you in advance,
testtests
|
|
|
|
|
Under Resource Editor, press "Ctrl + D" to change the tab order.
Kuphryn
|
|
|
|
|
Thanks! that was easy
|
|
|
|
|
i'm starting to make a remote access control program, what should i need to learn to develope such program? any suggestions would be appreciated!
|
|
|
|
|
Kinda sounds like a RAT (Remote Administrations Tool) to me, if its anything like that then the first thing you need to learn is how to use sockets
|
|
|
|
|
I would like to know how to save BMP image from Clipboard to the disk
Michael Geffen
|
|
|
|
|
Hi!
You can use this. You can get the hdc by GetDC...
<br />
int Screenshotal(HDC hdc, char *pszflname)<br />
{<br />
HDC memdc;<br />
HANDLE hfl;<br />
DWORD dwBytes, dwWidth, dwHeight, dwNumColors, dwBPP, ColorSize;<br />
void *pBits;<br />
HBITMAP hbmp;<br />
BITMAPFILEHEADER fileheader;<br />
BITMAPINFOHEADER infoheader;<br />
RGBQUAD colors[256];<br />
BITMAPINFO bmpinfo;<br />
HGDIOBJ hret;<br />
<br />
dwWidth = GetDeviceCaps(hdc, HORZRES);<br />
dwHeight = GetDeviceCaps(hdc, VERTRES);<br />
dwBPP = GetDeviceCaps(hdc, BITSPIXEL);<br />
if (dwBPP <= 8)<br />
dwNumColors = 256;<br />
else<br />
dwNumColors = 0;<br />
if (!(memdc = CreateCompatibleDC(hdc)))<br />
return (0);<br />
bmpinfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);<br />
bmpinfo.bmiHeader.biWidth = dwWidth;<br />
bmpinfo.bmiHeader.biHeight = dwHeight;<br />
bmpinfo.bmiHeader.biPlanes = 1;<br />
bmpinfo.bmiHeader.biBitCount = (WORD)dwBPP;<br />
bmpinfo.bmiHeader.biCompression = BI_RGB;<br />
bmpinfo.bmiHeader.biSizeImage = 0;<br />
bmpinfo.bmiHeader.biXPelsPerMeter = 0;<br />
bmpinfo.bmiHeader.biYPelsPerMeter = 0;<br />
bmpinfo.bmiHeader.biClrUsed = dwNumColors;<br />
bmpinfo.bmiHeader.biClrImportant = dwNumColors;<br />
hbmp = CreateDIBSection(hdc, &bmpinfo, DIB_PAL_COLORS, &pBits, NULL, 0);<br />
if (!hbmp)<br />
{<br />
DeleteDC(memdc);<br />
return (0);<br />
}<br />
hret = SelectObject(memdc, hbmp);<br />
if (!hret || (hret == HGDI_ERROR))<br />
{<br />
DeleteDC(memdc);<br />
return (0);<br />
}<br />
if (!BitBlt(memdc, 0, 0, dwWidth, dwHeight, hdc, 0, 0, SRCCOPY))<br />
{<br />
DeleteDC(memdc);<br />
return (0);<br />
}<br />
if (dwNumColors)<br />
dwNumColors = GetDIBColorTable(memdc, 0, dwNumColors, colors);<br />
fileheader.bfType = 0x4D42;<br />
ColorSize = dwNumColors * sizeof(RGBQUAD);<br />
fileheader.bfSize = ((dwWidth*dwHeight*dwBPP) >> 3) + ColorSize + sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);<br />
fileheader.bfReserved1 = fileheader.bfReserved2 = 0;<br />
fileheader.bfOffBits = ColorSize + sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);<br />
infoheader.biSize = sizeof(BITMAPINFOHEADER);<br />
infoheader.biWidth = dwWidth;<br />
infoheader.biHeight = dwHeight;<br />
infoheader.biPlanes = 1;<br />
infoheader.biBitCount = (WORD)dwBPP;<br />
infoheader.biCompression = BI_RGB;<br />
infoheader.biSizeImage = infoheader.biClrImportant = 0;<br />
infoheader.biXPelsPerMeter = infoheader.biYPelsPerMeter = 0;<br />
infoheader.biClrUsed = dwNumColors;<br />
hfl = CreateFile(pszflname, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);<br />
if (hfl == INVALID_HANDLE_VALUE)<br />
{<br />
DeleteObject(hbmp);<br />
{<br />
DeleteDC(memdc);<br />
return (0);<br />
}<br />
}<br />
WriteFile(hfl, &fileheader, sizeof(BITMAPFILEHEADER), &dwBytes, 0);<br />
WriteFile(hfl, &infoheader, sizeof(BITMAPINFOHEADER), &dwBytes, 0);<br />
if (!dwNumColors)<br />
WriteFile(hfl, colors, ColorSize, &dwBytes, 0);<br />
ColorSize = (dwWidth * dwHeight * dwBPP) >> 3;<br />
WriteFile(hfl, pBits, ColorSize, &dwBytes, 0);<br />
CloseHandle(hfl);<br />
DeleteObject(hbmp);<br />
DeleteDC(memdc);<br />
return (1);<br />
}
Well... I am a beginner ...
|
|
|
|
|