|
Dear all
I have a little problem about reading a file from the network. I made a sniffing program to read the network packets for further processing. I want it to be able to read a script file to start working. My question is how to determine that the incoming traffic is the script file contents? i.e. how to know its name, its extension, etc.
I developed the sniffer in VC++ and used the winpcap library to read the network packets.
Regards
islam
-- modified at 13:00 Saturday 26th November, 2005
|
|
|
|
|
Hi,
I created a text control from CWnd.
I assigned a font to the object of this class using SetFont(CFont*) in the main window which uses this control.
But I cannot get the font inside the class OnPaint method using GetFont(). It always returns NULL.
But I can change the button font by using SetFont(CFont*).
What could be wrong...?
Thank you.
- NS -
|
|
|
|
|
|
I failed to solve the problem...
The font object is class member. So no chance to missing the font when my control is active. Also the same font is assigned to the buttons and they are working fine...
Can you suggest another solution, please?
Thank you.
- NS -
|
|
|
|
|
Can you gives us a little bit more details on the class you are using (from what class is it derived actually)?
SkyWalker
-- modified at 0:46 Monday 28th November, 2005
|
|
|
|
|
Yes, sure...
class header is:
class CTextExtCtrl : public CWnd, public CColorMgr
{
...
...
};
In CPP:
bool CTextExtCtrl::Create( CWnd* pWndParent,
LPCTSTR lpctszMsg )
{
...
...
CString csClass( AfxRegisterWndClass( CS_VREDRAW |
CS_HREDRAW | CS_PARENTDC, LoadCursor( 0, IDC_ARROW )));
CWnd::Create( csClass, _T( "" ), WS_CHILD |
WS_VISIBLE, CRect( 0, 0, 0, 0 ), pWndParent, 0 ))
...
...
}
In main wnd class, Called from OnInitDialog:
m_arBtn[nIdx].SetFont( &m_fontDlg );
if( !m_textctrl.Create( this, ptcErrMessage ))
{
return false;
}
m_textctrl.SetFont( &m_fontDlg );
The font is valid and the buttons' text are changed with assigned font type.
The last line of code was replaced by me as following, to debug the result:
CFont* pFont = &m_fontDlg;
m_textctrl.SetFont( pFont );
pFont = m_textctrl.GetFont();
On debugging the values of pFont and pFont->m_hObject are valid. But after the last line (GetFont) it become null.
I use the the assigned font to draw the text in the control.
void CTextExtCtrl::OnPaint()
{
...
...
CFont* pOldFont = dcMem.SelectObject( GetFont());
dcMem.DrawText( m_csMsg, &rect, DT_WORDBREAK );
...
- NS -
|
|
|
|
|
|
The problem is that there is no CWnd default implementation for the WM_SETFONT and WM_GETFONT messages. You need to cache the HFONT in response to WM_SETFONT, and you need to return it in response to the WM_GETFONT. In order for that to happen,
WNDCLASS<code> must implement a handler to cache the HFONT.<br />
<br />
In your case, you can simply solve the problem by using a CFont object as a data member and select / deselect it in your dc whenever you need it, instead of using <code>GetFont() .
SkyWalker
|
|
|
|
|
Thank you.
I can solve it by overriding the setfont and storing it to class member.
I would like to know your words -
"In order for that to happen, WNDCLASS must implement a handler to cache the HFONT." Could you clarify it?
- NS -
|
|
|
|
|
The CP servers seems to work under high load all the time. I can hardly access the site.
It's about fnWndProc() refered by WNDCLASS .
Please see MSDN for that.
SkyWalker
|
|
|
|
|
Thank you.
You are right. I'm also tired with the CP access!!!
From your words I understand that we must write codes to handle the WM_GETFONT and WM_SETFONT messages, and these messages have no default implementations. Am I right?
Then how do the button window classes manages there fonts?
Are they keeping the fonts internally? Same case is for all the controls known to me...
Please answer only if you could access the "Replay to a Message" easily...
- NS -
|
|
|
|
|
hi ,
i want to make an application in which i am receiving a file on unicast port and send it to multicast .
means receiving from one user and sending it to many users of a multicast group.
plz respond urgently
Sachin Gupta
|
|
|
|
|
Hi
I am trying to develop a Database app with simple querying capabilities. I would like to work with relational databases and have the ability to visually and graphically connect fields of two different tables (similarly to what is available in the query engine of MS ACCESS or MS SQL Server). Any help is welcome
thanks
jac
|
|
|
|
|
I want to kown that, too
|
|
|
|
|
|
I am now trying to write a program. It need to lock the computer and show a logining window to check the identity of the user ,then does different work accordingly.I don't know how.Will someone kindly help me?Thank you.My E-mail:17877127@qq.com.
|
|
|
|
|
Go for GINA ie customize the Gina DLL according to ur needs
|
|
|
|
|
Thank you very much!
I will send the highest score to you;)!
Could you tell me where are you from?
How I hope to you to be a friend of me!
Above all,thank you very much for your help.
|
|
|
|
|
I belong to one of ur neighbouring countries
|
|
|
|
|
luyongxing wrote: I will send the highest score to you!
Could you tell me where are you from?
here is sample for same :-
http://www.codeproject.com/useritems/GINA_SPY.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
how to know if CFtpConnection is disconnected?
I want a fast method to know.
for example, GetCurrentDirectory() can return FALSE to know connectin is closed, but it is too slow - sometimes it needs over 60 seconds.
includeh10
|
|
|
|
|
|
Hi all,
Please tell me the parameters of DoCmd.OpenTable & DOCmd.Printout methods used in access 2000 automation in vc++. Lot of info is given on net for vb which really doesn't work out for vc++.An example will be appreciated.
Also, is there any way in vc++ to get the names & no. of tables in an access database.
Please help because my previous query regarding this has remained unanswered.
Thanks n Regards,
Ankush Mehta
|
|
|
|
|
Can u tell me if i dont want to use any server in between &
want to send an email direcly with my application , how can
i do that . Assuming my compter has a internet connection .
I mean can i direclty subit an email to the yahoo server or
at pop3.yahoo.com .
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|