OLE: how to set a (OLECHAR **ppchURLOut) parameter? [message #462620] |
Sat, 15 October 2005 03:58 |
Michael Sizaki Messages: 1 Registered: July 2009 |
Junior Member |
|
|
Hi,
I want to implement the IDocHostUIHandler::TranslateUrl Method
http://msdn.microsoft.com/workshop/browser/hosting/reference /ifaces/idochostuihandler/translateurl.asp
As a test I tool WebSite and modified the TranslateUrl method
How do I assign a pointer to a **OLECHAR?
int TranslateUrl(int dwTranslate, int pchURLIn, int ppchURLOut) {
if (pchURLIn != 0) {
int length = OS.IsUnicode ? OS.wcslen (pchURLIn) : OS.strlen (pchURLIn);
TCHAR buffer = new TCHAR (0, length);
int byteCount = buffer.length () * TCHAR.sizeof;
OS.MoveMemory (buffer, pchURLIn, byteCount);
String url = buffer.toString (0, length);
// translate the URL
String newURL=url;
int ptr=COM.CoTaskMemAlloc(newURL.length()* TCHAR.sizeof);
buffer=new TCHAR (ptr, newURL, true);
byteCount = buffer.length () * TCHAR.sizeof;
OS.MoveMemory (ptr, buffer, byteCount);
OS.MoveMemory (ppchURLOut, new int[]{ptr}, 1);
}
return COM.S_OK;
}
Unfortunately, this crashed the VM :-(
Michael
|
|
|
|
Powered by
FUDForum. Page generated in 0.03707 seconds