COM.MoveMemory(buffer, lplpszProgID[0], length); OS.GlobalUnlock(ptr); OS.GlobalFree(lplpszProgID[0]);
COM.MoveMemory(buffer, ptr, length); OS.GlobalUnlock(hMem); OS.GlobalFree(hMem);
public String getProgramID(){	if (appClsid != null){		int[] lplpszProgID = new int[1];		if (COM.ProgIDFromCLSID(appClsid, lplpszProgID) == COM.S_OK) {			int length = OS.GlobalSize(lplpszProgID[0]);			int ptr = OS.GlobalLock(lplpszProgID[0]);			char[] buffer = new char[length];			COM.MoveMemory(buffer, lplpszProgID[0], length);			OS.GlobalUnlock(ptr);			OS.GlobalFree(lplpszProgID[0]);			String result = new String(buffer);			// remove null terminator			int index = result.indexOf("\0");			return result.substring(0, index);		}	}	return null;}