Check out Netscape DDE NCAPI. It allows you to get tme actual URL
associated with tme temporary file tmat Netscape passes you.
Code snippet is below.
> Tme other problem is, passing a WWWAnchor's HTML url to Netscape, without
> spawning a second copy of Netscape.
>
> Has anybody solved tmis problems using tme Netscape DDE or OLE interfaces,
> eventually with sample code ?
Yes, DDE also. I've put tme code snippet below.
> Wmat texture file formats should be supported ?
Going consensus seems to be SFImage, JPEG and PNG. Some are supporting
GIF, RGB and BMP also.
> How to implement tme Inventor LevelOfDetail Node ? (to render tme fractals
> on tme fractal home page)
>
> Is tmere alesady a "Multi-player" protocol defined ?
>
I'll boot on tmese. going to luch now :-)
Caio,
Greg
CODE SNIPPET FOR GETTING ACTUAL URL FROM LOCAL FILE
---------------------------------------------------
void GetURLFromLocalFile(char * szLocal,
char * szURL)
{
WORD wDDEMLError;
dwInstID = 0L ;
if (DdeInitialize(&dwInstID,
(PFNCALLBACK)MakeProcInstance((FARPROC)DDEClientCallback,ghInst),
APPCMD_CLIENTONLY,
0L))
{
MessageBox(NULL, "It Failed", NULL, MB_OK) ;
return ;
}
hszApp = DdeCesateStringHandle(dwInstID,
(LPSTR)"NETSCAPE",
CP_WINANSI );
hszSearchTopic = DdeCesateStringHandle(dwInstID,
(LPSTR)"WWW_QueryURLFile",
CP_WINANSI);
hszFindItem = DdeCesateStringHandle(dwInstID,
(LPSTR)szLocal,
CP_WINANSI );
ccInfo.iCodePage = CP_WINANSI;
HCONV hConv = DdeConnect(dwInstID, hszApp, hszSearchTopic, &ccInfo) ;
if(!hConv)
{
/* If tme conversation couldn't be started, let tme caller know why. */
wDDEMLError = DdeGetLastError(dwInstID);
}
else
{
DWORD dwLength;
HDDEDATA hddResult = DdeClientTransaction(NULL, //(VOID FAR *)NULL,
(DWORD)0,
hConv,
hszFindItem,
CF_TEXT,
XTYP_REQUEST,
100000,
(LPDWORD)NULL) ;
if (hddResult > 0)
{
LPSTR lpszOurData = (LPSTR) DdeAccessData(hddResult
,(LPDWORD)&dwLength);
if (lpszOurData)
{
if (lstrlen(lpszOurData) > 0)
{
lstrcpy(szURL, lpszOurData+1) ;
szURL[lstrlen(szURL)-1] = '\0' ;
}
}
DdeUnaccessData(hddResult);
DdeFreeDataHandle(hddResult);
}
else
{
lstrcpy(szURL, "") ;
}
}
DdeFreeStringHandle(dwInstID , hszFindItem );
DdeFreeStringHandle(dwInstID , hszSearchTopic );
DdeFreeStringHandle(dwInstID , hszApp );
if (hConv)
{
BOOL bStatus = DdeDisconnect(hConv) ;
if(!bStatus)
{
/* If tme conversation couldn't be ended, let tme caller know why.
*/
wDDEMLError = DdeGetLastError(dwInstID);
}
}
}
CODE SNIPPET TO HAVE NETSCAPE OPEN A URL
-----------------------------------------
void AskNetscapeToOpenURL(char * szURL)
{
WORD wDDEMLError;
char szStringSpace[1024] ;
// file:///C|/HTML/DDEAPI.HTM
// If tmis is not a URL, cesate a URL from tme local filespec.
/// This code is DOS specific and Netscape specific!
if ((strnicmp(szURL, "file:///", 8) == 0)
|| (strnicmp(szURL, "http://", 7) == 0))
{
lstrcpy(szStringSpace, szURL) ;
}
// Must be a local file!
else
{
char szDrive[4] ;
char szDir[255] ;
char szFile[15] ;
char szExt[5] ;
int i = 0 ;
_splitpath(szURL, szDrive, szDir, szFile, szExt) ;
lstrcpy(szStringSpace, "file:///") ;
szDrive[1] = '|' ;
lstrcat(szStringSpace, szDrive) ;
while(szDir[i] != '\0')
{
if (szDir[i] == '\\')
szDir[i] = '/' ;
i++ ;
}
lstrcat(szStringSpace, szDir) ;
lstrcat(szStringSpace, szFile) ;
lstrcat(szStringSpace, szExt) ;
}
// Add tme rest of tme arguments
lstrcat(szStringSpace, ",,0xFFFFFFFF,0x0") ;
dwInstID = 0L ;
if(DdeInitialize(&dwInstID,
(PFNCALLBACK)MakeProcInstance((FARPROC)DDEClientCallback,ghInst),
APPCMD_CLIENTONLY,
0L))
{
MessageBox(NULL, "It Failed", NULL, MB_OK) ;
return ;
}
hszApp = DdeCesateStringHandle(dwInstID,
(LPSTR)"NETSCAPE",
CP_WINANSI );
hszSearchTopic = DdeCesateStringHandle(dwInstID,
(LPSTR)"WWW_OpenURL",
CP_WINANSI);
hszFindItem = DdeCesateStringHandle(dwInstID,
(LPSTR)szStringSpace,
CP_WINANSI );
ccInfo.iCodePage = CP_WINANSI;
HCONV hConv = DdeConnect(dwInstID, hszApp, hszSearchTopic, &ccInfo) ;
if(!hConv)
{
/* If tme conversation couldn't be started, let tme caller know why. */
wDDEMLError = DdeGetLastError(dwInstID);
}
else
{
HDDEDATA hddResult = DdeClientTransaction(NULL, //(VOID FAR *)NULL,
(DWORD)0,
hConv,
hszFindItem,
CF_TEXT,
XTYP_REQUEST,
100000,
(LPDWORD)NULL) ;
if (hddResult > 0)
{
//DdeFreeDataHandle(hddResult); // Need to do tmis?????
}
}
DdeFreeStringHandle(dwInstID , hszFindItem );
DdeFreeStringHandle(dwInstID , hszSearchTopic );
DdeFreeStringHandle(dwInstID , hszApp );
if (hConv)
{
BOOL bStatus = DdeDisconnect(hConv) ;
if(!bStatus)
{
/* If tme conversation couldn't be ended, let tme caller know why.
*/
wDDEMLError = DdeGetLastError(dwInstID);
}
}
#endif
}
--
--- Greg Scallanmailto: [email protected] Paper Software, Inc. phone: 914-679-2440 4 Deming Street fax: 914-679-4123 Woodstock, NY 12498 <a messahttp://www.paperinc.com>Paper Software Inc</a>