Hi,
I was wondering if there was a way to programmatically the toolbar buttons.
I want to make my own custom toolbar instead of using mappoint's navigation and drawing toolbars.
TIA
This is a discussion on Programmatically calling Toolbar buttons within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi, I was wondering if there was a way to programmatically the toolbar buttons. I want to make my own ...
Hi,
I was wondering if there was a way to programmatically the toolbar buttons.
I want to make my own custom toolbar instead of using mappoint's navigation and drawing toolbars.
TIA
Hi,
You can send messages for it. There is an article somewhere on this site. Try a search on 'accessing hidden features' or something similar.
rgds, Wilfried Mestdagh
www.mestdagh.biz
www.comfortsoftware.be
www.expertsoftware.be
MapPoint coding demo
MapPoint 2011 available, buy now
rgds, Wilfried Mestdagh
www.mestdagh.biz
www.comfortsoftware.be
www.expertsoftware.be
MapPoint coding demo
MapPoint 2011 available, buy now
thanks for the quick response
i tried downloading the zip files, but it seems like the URL is no longer valid...![]()
Hi,
This article points the things out: Extending the MapPoint ActiveX Control - Pt. I - MapPoint Articles - MP2K Magazine
I dont know about the Url. Can you maybe try to contact the author?
rgds, Wilfried Mestdagh
www.mestdagh.biz
www.comfortsoftware.be
www.expertsoftware.be
MapPoint coding demo
MapPoint 2011 available, buy now
Thanks WilFried
I read Extending the MapPoint ActiveX Control - Pt. I and Extending the MapPoint ActiveX Control - Pt. II and I think I understand how it works.
I'm trying to implement this in C#.
I saw your code in the "Access some hidden features" thread and it was pretty helpful.
I think I have all the pieces, but I'm not sure how to FindChildWindow in C#...
Hi,
I think it is just a class method to return the windows handle. I think you can use FindWindow. It take the classname and windowcaption, both are optional, it returns the handle. In C# like this:
Code:[DllImport("User32.dll")] public static extern IntPtr FindWindow(string ClassName, string WindowName);
rgds, Wilfried Mestdagh
www.mestdagh.biz
www.comfortsoftware.be
www.expertsoftware.be
MapPoint coding demo
MapPoint 2011 available, buy now
thanks so much for all your help Wilfried
i got most of the stuff i wanted to work
i pretty much used the Extending the MapPoint ActiveX control guide to understand the concept.
from there, i did my code in C#
these are the class method i used
i found the map point handle as mentioned in the article (i'm using mappoint 2006)[DllImport("user32.dll", EntryPoint = "FindWindowA")]
private static extern IntPtr FindWindow(string className, string windowTitle);
[DllImport("user32.dll")]
private static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string className, IntPtr windowTitle);
[DllImport("user32.dll")]
private static extern Boolean PostMessage(IntPtr hWnd, uint Msg, int wParam, int lParam);
i used spy++ to find the WM_COMMANDs and used PostMessage to invoke the command i wanted in my programprivate const uint WM_COMMAND = 0x111;
IntPtr hwnd;
IntPtr mapPointHwnd ;
hwnd = FindWindow(null, Resources.APP_TITLE);
hwnd = FindWindowEx(hwnd, IntPtr.Zero, "ATL:10024320", IntPtr.Zero);
hwnd = FindWindowEx(hwnd, IntPtr.Zero, "ATL:100240A0", IntPtr.Zero);
mapPointHwnd = FindWindowEx(hwnd, IntPtr.Zero, "AfxFrameOrView70", IntPtr.Zero);
// this invokes the scribble draw tool
PostMessage(mapPointHwnd, WM_COMMAND, 58205, 0);
Hi,
thx for feedback it sure will benefit other user.
rgds, Wilfried Mestdagh
www.mestdagh.biz
www.comfortsoftware.be
www.expertsoftware.be
MapPoint coding demo
MapPoint 2011 available, buy now
A small change to Kevin's code made it work for me.
If the map control is contained on any other component than the form (or window) itself it did not work for me:
Code:hwnd = FindWindow(null, Resources.APP_TITLE);
This line of code finds the handle to the form your control is contained on and can be replaced by:
Code:hwnd = myForm.Handle;
SO: if your control is on anything other than the form you can use:
Code:hwnd = myPanel.Handle;
or
Code:hwnd = myToolStripContainer1.ContentPanel.Handle; //in my case
Then the rest is as Kev had it before:
Code:hwnd = FindWindowEx(hwnd, IntPtr.Zero, "ATL:10024320", IntPtr.Zero); hwnd = FindWindowEx(hwnd, IntPtr.Zero, "ATL:100240A0", IntPtr.Zero); mapPointHwnd = FindWindowEx(hwnd, IntPtr.Zero, "AfxFrameOrView70", IntPtr.Zero);
Thanks for all the posts and code to solve this. It makes life easier...
There are currently 1 users browsing this thread. (0 members and 1 guests)