I'm hoping someone might be able to point me in the right direction
with this.
I'm using C# and the .NET framework, but WITHOUT MapXtreme or whatever
it's called. I've managed to work out how to do the equivilant of
CreateObject("MapInfo.Application") in C#, and I have my app working
perfectly, the only thing I can't do is get Callbacks to work.
I've created a new class with a WindowContentsChanged(int intVal)
method and I've instantiated the class and handed it to
MapInfo.SetCallBack, but I just get an exception when I run it.
I guess my callback class needs to have something else in it (something
to do with OLE?), but I don't know where to start. I've tried
searching google for "c# ole server", but nothing helpful comes up.
Any ideas?
Littlecharva
This was discussed a while back. Try this MapInfo-L archive URL -
http://www.directionsmedia.net/pipermail/mapinfo-l/2006-May/002382.html
As an aside, I don't know if the MapInfo-L archives are guaranteed to be
preserved )on DirectionsMag or elsewhere).
IL Thomas
GeoSciSoft - Perth, Australia
Hi everyone,
Any ideas?
Littlecharva
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.16.3/614 - Release Date: 2/01/2007
2:58 PM
Thanks for the reply, though the linked article is in VB.NET, and while
it's usually a straightforward task to convert VB to C#, this is one of
the areas where it has me baffled, especially since the linked article
seems to make use of a LibPinvokelib.dll, which doesn't appear on my
system.
Does anyone have any C# examples, or can give me a little more
information on what I'm supposed to be doing? Is there a .NET class I
can inherit from? Do I need to use delegates? Interfaces?
Thanks again,
Littlecharva
There is very little difference between C# and VB.NET - if you really want
to, you can use a conversion routine for VB.NET to C# (or vice versa). There
are many (for free, online or downloadable).
I suggest that you read the URL that I quoted to you, then go to the parent
thread and read all 4 or 5 postings (my conversation with Mr Hebblethwaite).
Then go to the referenced thread from ?February/March 2006 which teases out
all of the requirements for a successful .NET and COM and MapInfo
conversation, and although that is using the VB.NET language, it will give
you everything that you need to know.
Look for these keywords and people -
"Callback in vb.net" (subject)
Milo van der Linden
Christian Singer*
* Christian Singer has provided some important notes on what is needed for
this to be successful.
Please read all of the van der Linder / Singer correspondence, else you are
unlikely to understand what the code is about.
IL Thomas
GeoSciSoft - Perth, Australia
-----Original Message-----
From: mapi...@googlegroups.com [mailto:mapi...@googlegroups.com] On
Behalf Of littlecharva
I looked at the MSDN article you recommended and by using it with
David's code I came up with the following:
public delegate void pWindowContentsChanged(int intValue);
public class CallbackWrap
{
[DllImport("..\\LIB\\PinvokeLib.dll")]
public static extern void
WindowContentsChanged(pWindowContentsChanged cb, int intValue);
}
class MICallbacks
{
public void WindowContentsChanged(int intID)
{
Console.WriteLine("Callback Sucessful");
}
}
... And added the following to the Form_Load of my main form:
objMICallbacks = new MICallbacks();
pWindowContentsChanged objCB = new
pWindowContentsChanged(objMICallbacks.WindowContentsChanged);
objMapInfo.SetCallback(objMICallbacks);
Which didn't work, so I hunted down the other article you mentioned and
saw that Christian Singer used a ComClass, so after googling that for a
while I discovered that VB has a wizard available to create one,
whereas C# doesn't. I tracked down how to create one in C# and used
the GUIDs provided in Christian's post and came up with this:
using System;
using System.Runtime.InteropServices;
namespace MapInfoTest
{
[Guid("2A765F7E-E628-4427-A730-A695543EDB79"),
InterfaceType(ComInterfaceType.InterfaceIsIDispatch) ]
public interface MIEventInterface
{
}
[Guid("CC6697F7-968D-47dc-9B5B-84DEF8FD5D6B"),
InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface MIComInterface
{
[DispId(1)]
void WindowContentsChanged(int intID);
}
[Guid("9CC9946D-C1E4-4f42-9E8C-C4693BD04577"),
ProgId("MapInfoTest.MICallbacks"),
ClassInterface(ClassInterfaceType.None),
ComSourceInterfaces(typeof(MIEventInterface))]
public class MICallbacks : MIComInterface
{
public MICallbacks()
: base()
{
}
public void WindowContentsChanged(int intID)
{
Console.WriteLine("Yeah Baby!");
}
}
}
Then using the following in my Form_Load:
objMICallbacks = new MICallbacks();
objMapInfo.SetCallback(objMICallbacks);
Which causes the same error I've been getting all along:
TargetInvocationException: Exception has been thrown by the
target of an invocation.
So I've followed both of your suggestions to the best of my ability,
but still can't get anywhere; can you see where I'm going wrong?
Littlecharva
Use the second example of code in my post above (the ComClass one),
then in VS2005 go to Project -> myProject Properties. Under the
Application tab, click the "Assembly Information..." button and in the
next dialog make sure there is a tick in the "Make Assembly COM
Visible" box.
One bloody tick box!!!
Thanks again IL Thomas, I wouldn't have got there without your help. I
hope this thread helps someone else down the line.
Littlecharva
Is MapInfo threaded?
Regards,
Nick Lawrence
************************************************************
Opinions contained in this e-mail do not necessarily reflect
the opinions of the Queensland Department of Main Roads,
Queensland Transport or Maritime Safety Queensland, or
endorsed organisations utilising the same infrastructure.
If you have received this electronic mail message in error,
please immediately notify the sender and delete the message
from your computer.
************************************************************
I have a dual processor machine, and MapInfo doesn't generally use the
second processor. It does not appear to threaded. However some tools
external to MapInfo Pro do use the extra processor. The same thing
applies with Hyper threading, I have turned it off because MapInfo
doesn't use it and it adds extra overheads. I have just purchased a
Core Duo 2 laptop and this is no different to my workstation.
This is probably one area where MapInfo could make performance gains to
MapInfo Pro.
Cheers Ian
______________________
Ian Tidy
GIS Administrator
Works Asset Department
Napier City Council
mailto:ia...@napier.govt.nz
http://www.napier.govt.nz
-----Original Message-----
From: mapi...@googlegroups.com [mailto:mapi...@googlegroups.com] On
Is MapInfo threaded?
Regards,
Nick Lawrence
######################################################################
This e-mail message has been scanned and cleared by MailMarshal
######################################################################
######################################################################
Attention:
This e-mail message and accompanying data may contain information that
is confidential and subject to legal privilege. Any information
provided is given in good faith. However unless specifically stated to
the contrary, Napier City Council accepts no liability for the
content of this e-mail or for the consequences of any action taken on
the basis of the information provided, unless that information is
subsequently confirmed in writing. If you are not the intended recipient,
you are notified that any use, dissemination, distribution or copying
of this message or data is prohibited. If you received this e-mail
message in error, please notify us immediately and erase all copies
of this message and attachments. Thank you.
but you other apps will not suffer and move in/out of the duals
I run SimplyMEPIS Linux with VMware running Win2ksp4 and MI6.5 just fine
on a AMX XP 4200+, 2gig dual channel ram, dual 320gig SATA3 drives with
on board nVidia 6800 graphics set for 128mem
[2gig is the key for using VMware otherwise 1gig is fine]
I looked at "Link Utility for Google Earth" but that one puts mapinfo data
into google
earth, while I want to go the other way, ie put google earth data into
mapinfo.
Cheers,
Arne
On 10/01/07, nicholas....@mainroads.qld.gov.au
Be careful with GML, there are several versions and MapInfo Pro doesn't
support them all.
Cheers Ian
-----Original Message-----
From: mapi...@googlegroups.com [mailto:mapi...@googlegroups.com] On
Behalf Of Arne Scherrenberg
Sent: Wednesday, 10 January 2007 3:38 p.m.
To: mapi...@googlegroups.com
Cheers,
Arne
######################################################################
FME will do the conversion from KML to Tab files. I think you can
download a time-limited version to try out, if you don't have it.
Greg Driver
System Administrator
Applications Support
ICT
NOT PROTECTIVELY MARKED
Regards
Uffe Kousgaard
Best regards / Med venlig hilsen
Lars I. Nielsen
GisPro
At InterGeo in Muenchen in October both ESRI and Bentley Systems were
demonstrating Google Earth being used as a background image within their GIS
system. So if they can do it then it should also be possible somehow in
MapInfo. Does Google provide the imagery in the form of a WMS feed, for
example?
If you need satellite imagery in the short term then you could open up
Global Explorer, I think it is called, within MapInfo by going to the
File>Open Web Mapping Service command. Select it from the list of available
servers. It has complete imagery and some air photos too (e.g. for the USA).
You just have to put up with a diagonal copyright statement plastered on the
image every so often, but I guess that goes away if you sign up for the paid
for version. Anyway, I have used it to get the alignment of the new Lhasa
railway in Tibet, for example.
There is a whole issue here about the terms of use, though. Google is only
for non-commercial use. So much of the things we might want to do with a
Google Earth image are a copyright violation of the image owner. In the
longer term these images are expensive to create and somebody somewhere has
to pay for them, otherwise they will not be created. Neither Google nor
Microsoft are paying their suppliers anywhere near the full cost of the
imagery, so we are all relying on commercial users continuing to buy
imagery, and effectively subsidise Google so we can then get free private
use of it.
Regards
Tim
Dr Tim Rideout
Director
Half Price SkyView Posters at
http://xyzmaps.com/acatalog/skyview_posters.html
Visit XYZ at the International Map Trade Show, Salzburg Feb 23-24th 2007 and
the Cape Town Book Fair 16-19th June 2007.
The XYZ Digital Map Company
Unit 9 Phase 2 Hardengreen Business Park
Dalhousie Road
Dalkeith Scotland EH22 3NX
Tel +44 131 454 0426
Fax +44 131 454 0443
Mobile + 44 7766 825937
E-mail tim.r...@xyzmaps.com
http://www.keyhole.com/body.php?h=products&t=keyhole2LT
Our company looked into licensing this product, but it was too expensive
for our small budget.
If you're looking for free satellite images for MapInfo, use MapInfo
Pro's WMS Map Servers (MI Pro 8.5).
GlobeXplorer Map Server
Microsoft Terraserver Map Server
Those are two of the WMS servers that provide satellite images for free
to MapInfo and I'm sure a few of the other servers provide them for
other areas as well.
-Evan MacDougall
GIS Supervisor
"Gentlemen, we may not make history tomorrow, but we shall certainly
change the geography."
> I'm almost sure Nick Lawrence is interested in bringing in the satellite
> images from Google Earth and not the vector layers on top of it (KML
files).
> Only option seem to be a simple non-georeferenced jpg export.
> Regards
> Uffe Kousgaard
Yes, I want to bring in the satellite images from either google earth or
google maps and display them as a non-editable background raster layer
inside mapinfo. I want a live link so that as I zoom and pan, the
google earth/google maps layer updates itself appropriately.
Specifically I want to create a .tab file that prints a message in the
message window and nothing else.
nick
!Workspace
!Version 300
!Charset WindowsLatin1
Print "This is a message"
Run Application "....\message1.wor"
Best regards / Med venlig hilsen Lars I. Nielsen GisPro
Peter Horsbøll Møller
GIS Developer, MTM
Geographical
Information & IT
COWI A/S
Odensevej 95
DK-5260 Odense
S.
Denmark
Tel
+45 6311 4900
Direct +45 6311
4908
Mob +45 5156
1045
Fax +45 6311
4949
E-mail p...@cowi.dk
http://www.cowi.dk/gis
--
No virus found in this incoming message.
Checked by AVG
Free Edition.
Version: 7.5.432 / Virus Database: 268.16.7/620 - Release Date:
1/8/2007 4:12 PM
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.16.7/620 - Release Date: 1/8/2007 4:12 PM
print chr$(12)
Regards
Uffe
----- Original Message -----
From: David Reid
To: mapi...@googlegroups.com
Sent: Monday, January 15, 2007 9:05 AM
Subject: [MI-L] Re: anatomy of a .tab file
Regards,
David
-----Original Message-----
From: mapi...@googlegroups.com [mailto:mapi...@googlegroups.com] On
Behalf Of Uffe Kousgaard
Sent: Monday, January 15, 2007 2:16 AM
To: mapinfo-l
Subject: [MI-L] Re: anatomy of a .tab file
That is
print chr$(12)
Regards
Uffe
----- Original Message -----
From: David Reid
To: mapi...@googlegroups.com
Sent: Monday, January 15, 2007 9:05 AM
Subject: [MI-L] Re: anatomy of a .tab file
Speaking of printing Message Windows... How does one "clear" the message
window of all previous listings?
Example:
ClearMessageWindow
Print "New Clean Message Window"
David
How can I make Google Maps or Google Earth into a layer inside MapInfo?I looked at "Link Utility for Google Earth" but that one puts mapinfo data
into google
earth, while I want to go the other way, ie put google earth data into
mapinfo.
Regards,
Nick Lawrence
************************************************************
Opinions contained in this e-mail do not necessarily reflect
the opinions of the Queensland Department of Main Roads,
Queensland Transport or Maritime Safety Queensland, or
endorsed organisations utilising the same infrastructure.
If you have received this electronic mail message in error,
please immediately notify the sender and delete the message
from your computer.
************************************************************