hi, i tried migrating my VB.net code to get the computers IP address to C++
and it doesnt work, so im wonderign if anyone knows how to do it in
C++.net...thank s
--
-iwdu15 5 2197
"iwdu15" <jmmgoalsteraty ahoodotcom> wrote in message
news:6C******** *************** ***********@mic rosoft.com... hi, i tried migrating my VB.net code to get the computers IP address to C++ and it doesnt work, so im wonderign if anyone knows how to do it in C++.net...thank s
What did you do in VB.Net? You should be able to do tha same things with
either Managed C++ (VS2003) or C++/CLI (VS2005).
On the other hand, if your migration was to native C++ under Win32, you will
likely need to make use of a completely different set of services.
If you are thinking to yourself - "Great, Will. That's none too specific to
help me" - then you'd be right. To get good advice you need to explain a
little more about what you want or how what you tried failed.
Regards,
Will
my mistake, sorry about that... heres howi tried it in vb:
''Global Var
Dim homeip As IPAddress
''In form load
homeip =
Net.Dns.GetHost ByName(Net.Dns. GetHostName).Ad dressList.GetVa lue(0)
in C++ i tried:
//Global Var
System::Net::IP Address * homeip;
''in formload
homeip =
Net::Dns::GetHo stByName(Net::D ns::GetHostName ())->AddressList->GetValue(0);
it throws this build error
c:\Documents and Settings\User\D esktop\Final_Pr oject\Final
Project\Final\F orm1.h(4029): error C2440: '=' : cannot convert from
'System::Object __gc *' to 'System::Net::I PAddress __gc *'
let me kno if u need anymore info
--
-iwdu15
iwdu15 wrote: my mistake, sorry about that... heres howi tried it in vb:
''Global Var Dim homeip As IPAddress
''In form load homeip = Net.Dns.GetHost ByName(Net.Dns. GetHostName).Ad dressList.GetVa lue(0)
in C++ i tried:
//Global Var System::Net::IP Address * homeip;
''in formload homeip = Net::Dns::GetHo stByName(Net::D ns::GetHostName ())->AddressList->GetValue(0);
it throws this build error
c:\Documents and Settings\User\D esktop\Final_Pr oject\Final Project\Final\F orm1.h(4029): error C2440: '=' : cannot convert from 'System::Object __gc *' to 'System::Net::I PAddress __gc *'
Try this:
homeip = (System::Net::I PAddress
*)Net::Dns::Get HostByName(Net: :Dns::GetHostNa me())->AddressList->GetValue(0);
VB.NET automatically inserts a cast for you, C++ does not.
-cd
Carl Daniel [VC++ MVP] a écrit : iwdu15 wrote: my mistake, sorry about that... heres howi tried it in vb:
''Global Var Dim homeip As IPAddress
''In form load homeip = Net.Dns.GetHost ByName(Net.Dns. GetHostName).Ad dressList.GetVa lue(0)
in C++ i tried:
//Global Var System::Net::IP Address * homeip;
''in formload homeip = Net::Dns::GetHo stByName(Net::D ns::GetHostName ())->AddressList->GetValue(0);
it throws this build error
c:\Documents and Settings\User\D esktop\Final_Pr oject\Final Project\Final\F orm1.h(4029): error C2440: '=' : cannot convert from 'System::Object __gc *' to 'System::Net::I PAddress __gc *'
Try this:
homeip = (System::Net::I PAddress *)Net::Dns::Get HostByName(Net: :Dns::GetHostNa me())->AddressList->GetValue(0);
Or better :
homeip=__try_ca st<System::Net: :IPAddress*>
(Net::Dns::GetH ostByName(Net:: Dns::GetHostNam e())->AddressList->GetValue(0)) ;
Arnaud
MVP - VC
<ad******@clu b-internet.fr> wrote in message
news:11******** *************@z 14g2000cwz.goog legroups.com...
Carl Daniel [VC++ MVP] a écrit : Try this:
homeip = (System::Net::I PAddress *)Net::Dns::Get HostByName(Net: :Dns::GetHostNa me())->AddressList->GetValue(0);
Or better :
homeip=__try_c ast<System::Net ::IPAddress*> (Net::Dns::Get HostByName(Net: :Dns::GetHostNa me())->AddressList->GetValue(0)) ;
Yep, that's better - always prefer the new cast syntax so the intent and
behavior of the cast is apparent.
-cd This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: YAN |
last post by:
Hi,
I want to get the mac address from a machine, which i have the IP address of
that machine, how can i do that?
I know how to get the mac address of the local machine from the following
code:
Dim mc As System.Management.ManagementClass
Dim mo As System.Management.ManagementObject
mc = New
System.Management.ManagementClass("Win32_NetworkAdapterConfiguration")
|
by: johny smith |
last post by:
I am trying to figure out a way to print the address of what called a
certain function once inside the function.
I am assuming that this information is on the stack somewhere. But can
someone give me some
advice? I don't know where to go to look this information up.
Do I need to access the stack, and hence do some kind of inline assembly
code to get the calling address?
|
by: ypjofficial |
last post by:
Hello All,
While readling the C and C++ literature i came to know that the OS
allocates separate protected memory space for each running program and
the program do not interfare into one another's address space.
Also the address space allocated for each program is totally relative.
Now i want to know that from what address value does the stack starts
and the heap actually start?
What is at address 0(first address) in a program?
|
by: Tom Warren |
last post by:
About once a year or so for the last 10 years, I update my street
address parser and I'm starting to look at it again. This parser
splits a street address line into its smallest common elements
(number, trailer, pre, name, suffix, post, unit, unit id). I always
start this update process by searching Google-Groups and Google-web
for anything new out there, but there is never very much.
Has anyone run into anything in their travels?...
|
by: farqs |
last post by:
I've got a form with feilds: Address, Suburb, State, Pcode (for the
Location Addres) and then: PAddress, PSuburb, PState, PPcode (for the
Postal Address).
When the postal address is the same as the location address, it becomes
cumbersome to retype/copy the address into the postal address fields so
I created a tick box (like a 'same as above' thingy) where on
'afterupdate' i've put the following code as an Event Procedure:
Private Sub...
| |
by: hasho |
last post by:
Why is "call by address" faster than "call by value"?
|
by: candy |
last post by:
hi all,
Is there is any way in the C language by which I can get the
address of a statement? For eg,consider the following simple program:
1. #include<stdio.h>
2.
3. int main(void){
4. int variable;
|
by: Todd A. Anderson |
last post by:
I have a function foo of which I need to get the address. The problem
is that when you say "&foo" (or just foo for that matter), you get the
address of this function's entry in a jump table and not the address of
the function itself. Are there any BKMs for getting the real address or
am I going to have to write a function that looks to see whether the
address is a jump instruction and if so compute the real address from
the jump target?...
|
by: kumarsssss |
last post by:
I have just new to degugger.
It shows the data registers and address registers.
Data registers contatin the data values for the different variables.
But what the address registers holds?
Does address register A1 holds the address for the Data register D1?
what is the exact relationship between the data register and address
register?
Please Help
|
by: saravanatmm |
last post by:
I need javascript code for validate the email address.
Email address field cannot allowed the capital letters, special characters except '@' symbol.
But can allowed the small letters, numeric numbers.
Now i use this script for validate the email address. But it allows the cpital letters otherwise its working correctly.
SCRIPT FUNCTION
************************************************
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |