|
am assuming that a 'struct' can be defined only once but not sure when / where it is defined.
Both 'IPHeader' and 'ICMPHeader' appear in 3 different files: rawping.cpp, rawping.h and rawping_driver.cpp .
My questions: assuming a 'struct' can be defined only once, when/where should it be defined?
(as the error appears in the header file, I'm guessing the compiler found the 'struct' in one of the .cpp files)
What other references to IPHeader and ICMPHeader need to be removed?
study everyday
|
|
|
|
|
do you have a multiple-include guard on that header file?
#ifndef ICMPHEADER_INCLUDED
#define ICMPHEADER_INCLUDED
... definitions for those structs
#endif
?
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
|
I assume that you are learning C++.
flybest wrote:
assuming a 'struct' can be defined only once, when/where should it be defined
Always in the header file! The rule of thumb is: Keep definition and implementation seperate. As you learn more about C++, you'll find exceptions to this rule.
flybest wrote:
(as the error appears in the header file, I'm guessing the compiler found the 'struct' in one of the .cpp files)
I think that this is not the case. Your problem probably is that you implicitly included the headerfile with the definition multiple times. One solution are the include guards as Chris pointed out. An other solution is (if you are using MS Visual Studio) to add the following line to your header files:
#pragma once
Hope this helps
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
ye
thank u!
study everyday
|
|
|
|
|
deflare it in only one header file, and include this header file from all cpp files that need to have the declaration!
Don't try it, just do it!
|
|
|
|
|
hi
I need DPI(Dots Per Inch) Values directly in the code like 72 or 96,120,144,192 DPI becoz the project i am working on needs it so that the controls will not be displaced and using DPI values i need to set the positions of some controls
Can anyone help me
Chethan
|
|
|
|
|
Call GetDeviceCaps(hdc, LOGPIXELSX) on any device context that refers to the screen. You can use GetDC to get a device context for a given window.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
This was answered for you more than once. Once here by Rick York, once here by me, and once here by Mike Dimmick. What part are you not understanding?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Help me! Blimey!
When my CDialog, which contains 3 CListCtrls, is first minimized and later restored the lists are gone away in the case there was an update of the lists during the minimizing time. I have tried to manual invalidate,redraw (-items),update the lists and also the whole dialog by catching the restore event in OnSysCommand - but nothing works. I can reenable the lists in two ways: 1. automatic with the next update, 2. manual change the content of the lists with a button with some filter action in the background. As an ugly workaround i also tried to simulate this manual action by direct calling of the functions but that also doesn't work - i must do an mouseclick. Befor the next step is to simulate that mouseclick (i hope no one will ever see that), i hope somone can help me with right action for that case. !
Greetings
Steffen
|
|
|
|
|
How to display a command prompt window in mfc ?
i am using mfc application wizard and MDI application in my project.
ditty grail
|
|
|
|
|
|
Dominik Reichl wrote:
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
Dunno if that'd been answered before, but looks to me like it'd disable the keyboard. Do I get a prize?
using System.Beer;
|
|
|
|
|
Jon Hulatt wrote:
Do I get a prize?
Yeah Here It is
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
I want to develop a command based vc++ MFC application.
How to create a command prompt in my window and execute the commands.
My application is using MFC Application wizard and MDI .
ditty grail
|
|
|
|
|
In the program ,I use a CListCtrl controler, sometimes I want to set the sort property enable or disable ,how to do it?
|
|
|
|
|
bghuang wrote:
CListCtrl controle
Look for CListCtrl::ModifyStyle(....) for values
LVS_SORTASCENDING : for sorting in ASCENDING order
LVS_SORTDESCENDING : for sorting in DESCENDING order
and remove both property to disable sort
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
I would try to use CListCtrl::ModifyStyle too, but by playing with the style LVS_NOSORTHEADER instead.
|
|
|
|
|
Stlan wrote:
by playing with the style LVS_NOSORTHEADER instead.
Correct!, My Nose is not working fine TODAY, I got cold from yesterday.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
|
bghuang wrote:
Thanks
Mr. Stlan deserve that more then me
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Hi all.
I am embedding media player 6.4 in my MFC ActiveX control.
It can successfully be used in any app.
Problem: (happens in XP only it seems)
When I embed my control in a web page, it works, but when the page is unloaded, or iexplore is closed, the application crashes and says:
Unhandled exception in IEXPLORE.EXE (WMPDXM.DLL): 0xC0000005: Access Violation.
The last code I can get to is:
File: comip.h
void _Release() throw()
{
if (m_pInterface != NULL) {
---> m_pInterface->Release(); <----- Here. line 662
}
}
If I release the IMediaPlayerPtr m_pPlayer; I got using QueryInterface:
IUnknownPtr pUnk;
pUnk = m_Player.GetControlUnknown();
pUnk->QueryInterface(IID_IMediaPlayer,(void**)&m_pPlayer);
like this: m_pPlayer->Release();
myself, then it crashes on this line.
I am using VC6 on xp.
This question belongs to the COM forum, but since it seems dead.
Thanks for your help.
this is this.
|
|
|
|
|
Something is better than nothing.
In the destructor, I used this hack.
try
{
m_pPlayer = NULL;
}
catch(...)
{
}
Instead of m_pPlayer->Release().
Ok, I know this is real bad code, but it seems to work. The release version does not crash, neither does debug version.
HeHe.
this is this.
|
|
|
|
|
Hello!
Is there a way to keep the mouse from moving in a particular direction? Here's my situation:
I have a dialog with two controls. I have a home-made splitter betwee the two controls (my splitter is simply a CRect that I create to fill the space between the two controls). I have minimum widths for each of the controls. When a minimum width for one of the controls has been reached, and the user still has the left mouse button down, I want to keep the mouse from continuing to move in the direction that would continue to make the window smaller.
Does that make sense? Basically, I only want the mouse to be able to go as far as the splitter can go (as long as the left button is still down).
Thanks!
-Ian
|
|
|
|
|
Ian Bowler wrote:
Does that make sense? Basically, I only want the mouse to be able to go as far as the splitter can go (as long as the left button is still down).
Thanks God, no, AFAIK no software can stop your mouse from working. What you should do is to stop the splitter, but let the mouse run free.
I see dead pixels
Yes, even I am blogging now!
|
|
|
|