Click here to Skip to main content
15,886,806 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionmaze in c Pin
hasani200714-May-10 2:00
hasani200714-May-10 2:00 
AnswerRe: maze in c Pin
CPallini14-May-10 2:05
mveCPallini14-May-10 2:05 
GeneralRe: maze in c Pin
Luc Pattyn14-May-10 8:08
sitebuilderLuc Pattyn14-May-10 8:08 
GeneralRe: maze in c Pin
CPallini14-May-10 10:19
mveCPallini14-May-10 10:19 
AnswerRe: maze in c Pin
Maximilien14-May-10 2:29
Maximilien14-May-10 2:29 
AnswerRe: maze in c Pin
Iain Clarke, Warrior Programmer14-May-10 4:50
Iain Clarke, Warrior Programmer14-May-10 4:50 
QuestionRe: maze in c Pin
David Crow14-May-10 8:00
David Crow14-May-10 8:00 
QuestionData communication between MFC and JavaScript for a Google Maps application Pin
ursular14-May-10 1:59
ursular14-May-10 1:59 
Hi all,

I'm new to JavaScript and Google Maps API. I got some problems but I cannot find out the reason. Hope someone can help me. Smile | :) Smile | :)

What I tried to do:
I'm trying to develop an application in MFC (Visual Studio 2005) with a html dialog showing a Google map. I will send location data from the MFC application to a JS function to calculate directions. Another JS function will return the number of routes and steps in the GDirection object. The result will be sent back as a message string. The codes I used for the HTML dialog was downloaded from CodeProject.

The problem I encountered:
If I open the html file using IE and manually input the location data and use alert function to show the message, everything works well. I can also send the location data from MFC to JS. However, after that, I cannot get the route number back... It always returns the number as "undefined".

Some codes:

function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
gdir = new GDirections(map, document.getElementById("directions"));
GEvent.addListener(gdir, "load", onGDirectionsLoad);
GEvent.addListener(gdir, "error", handleErrors);
}
}
function UpdateGPS(ar) // this is where MFC send the location data to JS
{
var a = new VBArray(ar);
var b = a.toArray();
rExp = /(\w|\s)*[^@]/ig;
var res = b[0].match(rExp); // Name @ size @ free_space
lan = parseInt(res[1]) / 1000000;
lon = parseInt(res[2]) / 1000000;
str = lan + "," + lon;
setDirections(str, "1.300983,103.772704");
}

function getRoute() // this is where JS should send information back to MFC
{
return message;
}
function setDirections(fromAddress, toAddress)
{
gdir.load("from: " + fromAddress + " to: " + toAddress, {getPolyline:true, getSteps:true, travelMode:G_TRAVEL_MODE_WALKING});
}
function onGDirectionsLoad()
{
n_route = gdir.getNumRoutes();
message = str + ". we have " + n_route + " route.";
alert(message);
}


Can someone help me here? Thanks a lot!
Questionpng button Pin
AbhiHcl14-May-10 0:23
AbhiHcl14-May-10 0:23 
AnswerRe: png button Pin
CPallini14-May-10 0:57
mveCPallini14-May-10 0:57 
QuestionThread local variables Pin
SelvaKr13-May-10 23:54
SelvaKr13-May-10 23:54 
AnswerRe: Thread local variables Pin
KellyR14-May-10 3:54
KellyR14-May-10 3:54 
AnswerRe: Thread local variables Pin
cmk14-May-10 12:35
cmk14-May-10 12:35 
GeneralRe: Thread local variables Pin
SelvaKr19-May-10 21:32
SelvaKr19-May-10 21:32 
QuestionSystem date and time c++ Pin
Member 365375113-May-10 21:55
Member 365375113-May-10 21:55 
AnswerRe: System date and time c++ Pin
Stephen Hewitt13-May-10 22:01
Stephen Hewitt13-May-10 22:01 
AnswerRe: System date and time c++ Pin
Richard MacCutchan13-May-10 22:58
mveRichard MacCutchan13-May-10 22:58 
Question#pragma warning(disable:4786) Pin
mesajflaviu13-May-10 20:37
mesajflaviu13-May-10 20:37 
AnswerRe: #pragma warning(disable:4786) Pin
mesajflaviu13-May-10 20:47
mesajflaviu13-May-10 20:47 
AnswerRe: #pragma warning(disable:4786) Pin
Nuri Ismail13-May-10 20:57
Nuri Ismail13-May-10 20:57 
GeneralRe: #pragma warning(disable:4786) Pin
mesajflaviu13-May-10 21:34
mesajflaviu13-May-10 21:34 
GeneralRe: #pragma warning(disable:4786) Pin
Stephen Hewitt13-May-10 21:55
Stephen Hewitt13-May-10 21:55 
GeneralRe: #pragma warning(disable:4786) Pin
Nuri Ismail13-May-10 21:58
Nuri Ismail13-May-10 21:58 
QuestionLoad PNG image on button Pin
AbhiHcl13-May-10 20:35
AbhiHcl13-May-10 20:35 
AnswerRe: Load PNG image on button Pin
Richard MacCutchan13-May-10 23:03
mveRichard MacCutchan13-May-10 23:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.