Community of VE/MapPoint Users and Developers
This is a discussion on synchronous error within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hi, Anyone has seen this error, or can give me an explanation what it really means ? An outgoing call ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| synchronous error Anyone has seen this error, or can give me an explanation what it really means ? An outgoing call cannot be made since the application is dispatching an input-synchronous call It happens in a mappoint create object model. I do nothing special, it is in a event from a serial port. Nothing blocking or synchronous. When I execute same code from eg a button click everytinng is fine. Any idea ? If I at least should understeand this phrase then I could debug better, if someone can explain it in simple english ?
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
Hi Wilfried, You seems often talking to yourself I found the reason, however I dont know wy mappoint give this error. The serial port receive in a background thread and uses SendMessage win32 call to fire an DataAvailable event. Now there sits the problem. If I Post a message from that event to do the job the problem is gone. SendMessagei is of cource a synchronious call while PostMessage is asynchronious. But there shoul not be any problem, wy ahould mappoint complain, and also how can it detect it is called from within a SendMessage event ? any toughts ? I find it so stupid to post a message from within an event that is fired from a send message
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| Any example please?
Hi Wilfried, Thank you very much for your help. I read your second post and now I understand the reason for that problem, but, could you please give us an example of code in which you use Win32 API PostMessage to call mappoint functions or an url where we could find documentation about this? Thanks in advanced! |
| |||
|
Hi, Yes of course. Here it comes. This is the class you need to call Win32 API. I did part of it, but some more as the PostMessage, because these are often used routines: Code: using System.Runtime.InteropServices; // needed to call external application (winAPI dll)
namespace Mestdagh.biz
{
public static class Win32
{
[DllImport("kernel32.dll")]
public static extern Boolean AllocConsole();
[DllImport("User32.dll")]
public static extern IntPtr FindWindow(string ClassName, string WindowName);
[DllImport("User32.dll")]
public static extern Boolean PostMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
[DllImport("User32.dll")]
public static extern Boolean PostMessage(IntPtr hWnd, uint Msg, int wParam, int lParam);
[DllImport("User32.dll")]
public static extern Boolean SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
[DllImport("User32.dll")]
public static extern Boolean SendMessage(IntPtr hWnd, uint Msg, int wParam, int lParam);
[DllImport("User32.dll")]
public static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);
}
Code: protected override void WndProc(ref Message m)
{
switch (m.Msg) {
case WM_UPDATEMP:
WMUpdateMP();
break;
default:
base.WndProc(ref m);
break;
}
}
Code: const int WM_USER = 0x400; const int WM_UPDATEMP = WM_USER + 1; Code: Win32.PostMessage(Handle, WM_UPDATEMP, 0, 0); One last thing to say is that this is the way to go if you have threaded code and you have to call eg a mappoint function in main thread. A custom message handler is always executed in the trhead context of the destination window. In this example a form, so it is UI thread. I hope this answers the question..
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
![]() |
| Tags |
| error, synchronous |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Mappoint Error | Mudrover | MapPoint 2006/2009 Discussion | 5 | 01-20-2005 03:59 PM |
| error 4014 | SimonPearse | MapPoint 2006/2009 Discussion | 3 | 01-17-2005 11:47 AM |
| About ERROR 4-40028-1. Error or Bug ? | Anonymous | MapPoint 2006/2009 Discussion | 12 | 01-11-2005 10:32 AM |
| I get this following error | ananthdeena | MapPoint 2006/2009 Discussion | 3 | 01-01-2005 03:46 AM |
| Runtime Error 462 | Anonymous | MapPoint 2006/2009 Discussion | 0 | 09-02-2004 05:07 AM |