|
I am trying to create a statusBar in the dialog but it's returning false. not creating the status bar please tell me whats going wrong in this. Thanks for any help. I am creating the status bar in the OnInitDialog() function
[code]
CStatusBar m_wndStatusBar; // member variable in the dialog header.
BOOL CDlgsViewDlg::OnInitDialog()
{
CDialog::OnInitDialog();
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return FALSE; // fail to create
}
m_wndStatusBar.SetPaneText(0,L"MainWindow Initialized");
}
[/code]
it's returning false. please help me.
|
|
|
|
|
|
You can create status bar by calling
m_wndStatusBar.Create(WS_CHILD|WS_VISIBLE|SBT_OWNERDRAW,
CRect(0,0,0,0), this, 0);
You can have a look at Toolbar & StatusBar on Dialog[^]
|
|
|
|
|
thanks a lot it's working now.
|
|
|
|
|
I am disabling some menu items based on a condition but after some dialog launch in the application, these menu item appearance changes to those of enabled.
However, when I click them their appearance changes to that of a disabled button. I can also do this by simply switching focus or simply by minimize-restore of application.
Why does the menu item change appearance? How can I prevent that from happening?
|
|
|
|
|
Is this an MFC application? How are you disabling the menu items? From where, and how, are you launching the dialog box?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Yes this is a MFC application which works similar to the CProperty sheet wizard style but with CDialogs.
I am disabling the menu items in the frame class when the first dialog appears at start of the application but somewhere in between when other dialogs come up the appearance of the disabled menu items is changing from disabled to enabled.
|
|
|
|
|
To enable/disable menu items it is best practice to use the ON_UPDATE_COMMAND_UI message.
It also best practice to use a SDI (with a CFormView) application if menus are needed.
Watched code never compiles.
|
|
|
|
|
|
Hi,
It sounds to me as if your doing something that is screwing up the MFC command routing. However based on your brief description I have no ideas as to what it could be. Did you check to see if the menu items have a unique resource ID?
Best Wishes,
-David Delaune
|
|
|
|
|
|
|
Hi,
I see that you showed your EnableMenuItem() function on stackoverflow. If you would have gave us a better description and shown that function here on codeproject you would have recieved a much better response.
Best Wishes,
-David Delaune
|
|
|
|
|
Sorry for the confusion, let me explain. The StackOverflow post was not me, it was a reference. I could not post my code online... Company policy. However, thanks for your concern in trying to help me solve my problem. I shall continue to approach you guys in future.
|
|
|
|
|
I am doing a project in college in which i have to extract a bit or a group of bits from a Ethernet frame in C PROGRAMMING. Can someone please provide an example in writing the code? Thank you.
Pavan
|
|
|
|
|
prathapkumar334 wrote: I am doing a project in college... What class?
What does the frame look like? What code have you put together so far?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
prathapkumar334 wrote: I am doing a project
This means you are expected to do it, people here will not write your code for you. However, if you have specific technical questions people will try to help you.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Extracting bits from a group of bytes it is the daily delight of the C programmer. However without knowing what your data structure (that is the frame) and what are the bits you're interested in, we can't help a lot.
Veni, vidi, vici.
|
|
|
|
|
What a pathetic request.
Have you thought of looking on line at the ethernet protocol, and the various other protocols that could be caried by it?
So is it Ethernet IP? Then what? TCP? UDP? RTP....
See, you havent even started yet. Grow a pair and go out find the info yourself. After that its a simple case of writing a few structs and casting the data packet to access whats inside...
==============================
Nothing to say.
|
|
|
|
|
Erudite_Eric wrote: What a pathetic request.
let me refer you to this : HOW-TO-ANSWER-A-QUESTION[^]
Watched code never compiles.
|
|
|
|
|
Sorry, a quick slap acorss the face can do wonders for peoples attitude.
==============================
Nothing to say.
|
|
|
|
|
Here's a bit of a hint...
0. Define a structure that is representative of the data that you're expecting.
1. Take data from your socket.
2. Cast your data bytes onto your data structure.
3. Interpret and use data however you need to.
4. Do it all over again for any number of packets transferred.
|
|
|
|
|
You might want to have a look at this link.
http://simplestcodings.blogspot.in/2010/10/create-your-own-packet-sniffer-in-c.html
Moreover there are a few open source libraries (pcap libraries). I would suggest you to use open source libraries for capturing packets. For your project do something which has not been done before. Packet capturing has been done earlier. In Windows you have the WireShark Tool which does it.
--Edwin.
|
|
|
|
|
You might want to have a look at the following open source libraries.
Separating bits from the ethernet is already done by many. So open source libraries are available.
I came across a good looking solution though. The links is given below.
http://www.binarytides.com/blog/packet-sniffer-code-in-c-using-linux-sockets-bsd/
Thanks,
Edwin.
|
|
|
|
|