|
Hello,
In that case, you simply need to declare the function before you use it. The most common case would be in a header file. The implementation is done in the corresponding .cpp file. For exemple:
Consider your function MyFunc, in the header file (say MyHeader.h) you declare the function like this: void MyFunc();
You define the function in the implementation file say MyFunc.cpp like this:
<br />
void MyFunc()<br />
{<br />
}<br />
Whenever you want to use MyFunc, just include MyFunc.h at the top of the file where you use the function.
Multiply it by infinity and take it beyond eternity and you'll still have no idea about what I'm talking about.
|
|
|
|
|
Hai,
Thanks again..I tried this..but it gives an error that func redefined or already defined in obj..what am I missing here..
Thanks a lot.
|
|
|
|
|
Delete all the .obj files and do a completely rebuild the project...
Multiply it by infinity and take it beyond eternity and you'll still have no idea about what I'm talking about.
|
|
|
|
|
You probably still have a prototype at the top of main.cpp . If that is the case, delete the prototype and replace it with a #include statement instead.
You'll then need to modify the .h file so that it gets included only once. Check out the .h files that ClassWizard produces to see the directives that are used.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi,
I used next code:
<br />
if(labMask.hideemptyrows == true){<br />
mc_hideemptyrows.SetCheck(BST_CHECKED);<br />
OnCheckHideemptyrows();<br />
}
else{<br />
mc_hideemptyrows.SetCheck(BST_UNCHECKED);<br />
}
strange thing is: when labMask.hideemptyrows = true, the "else" statement is performed !!!
if I do this:
if(labMask.hideemptyrows){ ... }
then it works fine.
Can anyone tell me why this is?
tnx.
(oh btw labMask.hideemptyrows is of type bool)
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
What type is hideemptyrows ? Using a breakpoint at the if(...) statement, what value does it have?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I had the same problem a couple of weeks ago, and finally realized that I was stepping through the code in 'Release' mode. So the values it was giving me weren't correct. You may not be doing the same thing, but just to make sure, check and see if you're in debug mode while stepping through.
[insert witty comment here]
bdiamond
|
|
|
|
|
Nice suggestion, but you might want to reply to V. so that he is sure to see it.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Never ever compare for equality with true or TRUE . Always do if (labMask.hideemptyrows) . The reason is that, even with a bool variable, there's nothing stopping the variable from getting values other than 0 or 1. When you compare against true , the test will fail if the bool got some value other than 1.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
I just performed the Heimlich Maneuver on SQL #1.
-- Chris Maunder
|
|
|
|
|
Tnx for your reply.
However I do not agree on this one:
1. a BOOL is an "Integer", a bool a "Boolean" (true or false)
so it can't get another value then true or false. Can it?
2. even after casting (bool)labMask.hideemptyrows the if statement returned false (we saw it in the quickwatch window)
3. although I see your point (especially for BOOLs) I find it more readable to compare against true or false (you see instandly what type your variable is)
So idd if the bool class can have other values then true or false I see your point, but why use the bool and not the BOOL? (surely not memory?)
Personally I think the compiler is broken or something
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
V. wrote:
Personally I think the compiler is broken or something
..and that might just be it! I have had many a few hairy moments where the code being executed doesn't match the fragment being shown on the screen. A good cleanup and complete rebuild of the project should solve this.
If that doesn't work, then a good thumping of the PC should teach it to behave!
I Dream of Absolute Zero
|
|
|
|
|
I'm using Chris Maunder's MFC Grid control in a personal project and I'd like to override a virtual function:
virtual void OnFixedColumnClick(CCellID& cell);
I've made a derived class and everything seems to be working right except that I want to override that function so that I can set a different compare function if the column clicked is the one that has dates in it. None of the virtual functions show up in classwizard, and I'm trying to figure out if I do it manually, how to put this in the message map so that I can get this message. I know this is something that I should know how to do, but some days I'm dumber than others. Any help is appreciated. Thanks in advance!!!
[insert witty comment here]
bdiamond
|
|
|
|
|
you simply redefine the method in your new class.
something like :
clas YourClass
{
...
virtual void OnFixedColumnClick(CCellID& cell);
}
...
void YourClass::OnFixedColumnClick(CCellID& cell)
{
ChrisMaunderGridBaseClass::OnFixedColumnClick(cell);
}
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
I got it, what you said is exactly what I was doing, which was right. Except I should have been looking for OnFixedRowClick(), not OnFixedColumnClick(). Thanks
[insert witty comment here]
bdiamond
|
|
|
|
|
Hi
My computer is on LAN. I know my IP address. How can I get the corresponding MAC address, to which the particular IP is bound to ? ( if I have more than one ethernet card)
I have tried Netbios, GetAdaptersInfo etc.
Is there any solution for this, something similar to GetAdaptersInfo which will work in windows NT also. ?
Thanks in advance
Shiraz
The Best Relligion is Science.
Once you understand it, you will know God.
|
|
|
|
|
zainu wrote:
I have tried Netbios, GetAdaptersInfo etc.
These are the normal solutions. Are you saying they do not work for you?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Have you tried going through the ARP table using GetIpNetTable() ?
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Hi,
Thankyou all..
I tried these methods..all the three, netbios, GetIpNetTable(), GetAdapterInfo().
These are the problems I am facing:-
Netbios: I am not able to find MAC if there are more than one LAN card and multiple IP set for each card.
GetIpNetTable: Doesnt give me the particular MAC address of a IP Address.
GetAdapterInfo: Not supported in Windows NT
Is there anything Like GetAdapterInfo that will work in all windows platform ?
Thanks in advance
Shiraz
The Best Relligion is Science.
Once you understand it, you will know God.
|
|
|
|
|
|
Hi
Thankyou cmk. I will have a look at it.
Regards
Shiraz
The Best Relligion is Science.
Once you understand it, you will know God.
|
|
|
|
|
Hi,
It's here what you need
#include <windows.h>
#include <wincon.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
typedef struct _ASTAT_
{
ADAPTER_STATUS adapt;
NAME_BUFFER NameBuff [30];
}ASTAT, * PASTAT;
ASTAT Adapter;
void main (void)
{
NCB Ncb;
UCHAR uRetCode;
char NetName[50];
LANA_ENUM lenum;
int i;
memset( &Ncb, 0, sizeof(Ncb) );
Ncb.ncb_command = NCBENUM;
Ncb.ncb_buffer = (UCHAR *)&lenum;
Ncb.ncb_length = sizeof(lenum);
uRetCode = Netbios( &Ncb );
printf( "The NCBENUM return code is: 0x%x \n", uRetCode );
for(i=0; i < lenum.length ;i++)
{
memset( &Ncb, 0, sizeof(Ncb) );
Ncb.ncb_command = NCBRESET;
Ncb.ncb_lana_num = lenum.lana[i];
uRetCode = Netbios( &Ncb );
printf( "The NCBRESET on LANA %d return code is: 0x%x \n",
lenum.lana[i], uRetCode );
memset( &Ncb, 0, sizeof (Ncb) );
Ncb.ncb_command = NCBASTAT;
Ncb.ncb_lana_num = lenum.lana[i];
strcpy((char*)Ncb.ncb_callname, "* " );
Ncb.ncb_buffer = (unsigned char *) &Adapter;
Ncb.ncb_length = sizeof(Adapter);
uRetCode = Netbios( &Ncb );
printf( "The NCBASTAT on LANA %d return code is: 0x%x \n",
lenum.lana[i], uRetCode );
if ( uRetCode == 0 )
{
printf( "The Ethernet Number on LANA %d is: %02x%02x%02x%02x%02x%02x\n",
lenum.lana[i],
Adapter.adapt.adapter_address[0],
Adapter.adapt.adapter_address[1],
Adapter.adapt.adapter_address[2],
Adapter.adapt.adapter_address[3],
Adapter.adapt.adapter_address[4],
Adapter.adapt.adapter_address[5]);
}
}
}
Regards
Alpha
|
|
|
|
|
Sorry ,
Link with Netapi32.lib
the include files are missed bcz of HTML tag
they are
#include windows.h
#include wincon.h
#include stdlib.h
#include stdio.h
#include time.h
Regards
Alpha
|
|
|
|
|
Hi all
Thankyou very much.
The above method works for me.!
Regards
Shiraz
The Best Relligion is Science.
Once you understand it, you will know God.
|
|
|
|
|
Any time buddy
Keep in touch
Regards
Alpha
|
|
|
|
|
Hello there, please excuse my jumping in, I also have a similar requirement to build a list of MAC's but when I tried to compile your code I received the error "unresolved external symbol _Netbios@4", I'm using Visual Studio 6.0 SP1 under XP Pro SP1 any help much appreciated
Pete Kane
Pete Kane
|
|
|
|