|
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
|
|
|
|
|
I want to List all the shared folders on the computers which are connected in the LAN. We can access the shared folders through UNC naming like \\<computer name="">
I want to find all the computers inside LAN and the shared folders on them programmatically (VC++).
Thaks and Regards,
Shri
|
|
|
|
|
For each server, use NetShareEnum() to get shared resources.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thanks for your help. By using NetShareEnum() I could find the shared folder on the local PC (server_name = NULL). But when I specify server_name as some other machine on LAN it says "Access is denied"
Could you please suggest me some other way of doing this?
Also I want to list all computer on the LAN. Can you please tell me how to do this? as the above fuction requires server_name and only gives shared folder names on that machine.
Thanks,
Shri
|
|
|
|
|
shri_31 wrote:
But when I specify server_name as some other machine on LAN it says "Access is denied"
Do you have UNICODE and _UNICODE defined? What does you call to NetShareEnum() look like, including the variable types?
shri_31 wrote:
Also I want to list all computer on the LAN. Can you please tell me how to do this?
WNetOpenEnum() followed by WNetEnumResource() . See MSDN for examples.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hello,
What is the best way to make different processes send messages to one another?
I mean, I know how to make different threads within the same process (app) communicate with one another, but I really don't know what is the correct way of making different threads in different processes communicate with each other...
David
|
|
|
|
|
COM - Component Object Model
for more Info, check the articles on this page
regards WoodStock
|
|
|
|
|
Depends on what you are trying to do.
1. If all your processes are on the same machine, and you don't need a lot of data, or the data is of the same format every time, you can use memory mapped files.
2. You can use TCP/IP and sockets to send data back and forth, also works over the network.
3. If it is a TINY amount of infrequent data, with no return recipt required, you could look into MailSlots.
4. Hey, you can even use COM, but what a pain in the backside! (Marshaling data, getting hrreading mdoels and initialization to work right, DCOM settings, etc.)
5. You can use Local RPC (everything running on same computer) or Remote RPC (not necessarily on same computer).
6. WM_COPYDATA - sending data between windows of different processes.
Your question is impossible to answer appropriately without more details.
But you might want to read a little bit about each of the technologies mentioned here, and then you can make your own decision.
|
|
|
|
|
Hi Blake and thanks for the input.
Looking back at you posted, I think I will have to go for the COM solution as I think it is the best one.
Can I ask you one thing though? Do you know of any site(s) with the right technical content I could learn from?
|
|
|
|