Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Uwe Heyer" Newsgroups: comp.lang.clipper.visual-objects Subject: Re: TAPI and FormatMessage Date: 7 Nov 2014 21:24:54 GMT Lines: 71 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Trace: individual.net pmGJpEM4+pkFikBvnSWtZw8VsyT5S2yCpYLXharaDV6aMIY8iN Cancel-Lock: sha1:2+nKeHO+tGaI7v6oY2W3gUvXPaE= User-Agent: XanaNews/1.18.1.6 Xref: csiph.com comp.lang.clipper.visual-objects:7403 Kai Michael Poppe wrote: > > > FUNCTION TapiErrorMessage(dwError AS DWORD) AS STRING PASCAL > > LOCAL pMsgBuffer AS PSZ > LOCAL cMessage AS STRING > > FormatMessage(_OR(FORMAT_MESSAGE_FROM_HMODULE, > FORMAT_MESSAGE_ALLOCATE_BUFFER, FORMAT_MESSAGE_IGNORE_INSERTS),; > GetModuleHandle(String2Psz("TAPI32.DLL")),; dwError,; > 0,; > @pMsgBuffer,; > 1024,; > NULL) > > cMessage := Psz2String(pMsgBuffer) > > LocalFree(pMsgBuffer) > > IF Right(cMessage, 2) = CRLF > cMessage := Left(cMessage, SLen(cMessage) - 2) > ENDIF > > RETURN cMessage > > Yet, no matter what dwError I put into the aforementioned function > from TapiErrorFormatMessage, i only get back empty strings. I tried > using GetModuleHandle for TAPI, TAPI3 and TAPIUI as DLLs also, but it > returns 0x0 so there's obviously no difference. Only TAPI32.DLL has a > ModuleHandle > 0. > > I would be grateful for any hints as to make this work in VO. > > Regards > > Kai -- Hi Kai, first of all I would inspect the return code from FormatMessage if FormatMessage(...) = 0 // Error ? GetLastError() // Get error number inspect error for description string using another FormatMessage call or let us know this error number else // ok > 0 == char/byte counter of pMsgBuffer second, I would use 0 for sizeof(buffer) (your 1024) Ahoj -Uwe