Click here to Skip to main content
15,922,696 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
QuestionWindows Services: User account management Pin
tony_Udz15-Mar-08 23:27
tony_Udz15-Mar-08 23:27 
GeneralRe: Windows Services: User account management Pin
led mike17-Mar-08 4:43
led mike17-Mar-08 4:43 
GeneralRe: Windows Services: User account management Pin
tony_Udz17-Mar-08 19:46
tony_Udz17-Mar-08 19:46 
GeneralRe: Windows Services: User account management Pin
led mike18-Mar-08 5:13
led mike18-Mar-08 5:13 
GeneralPlease help me [modified] Pin
Rahul Vaishnav7-Mar-08 22:45
Rahul Vaishnav7-Mar-08 22:45 
GeneralRe: Please help me Pin
Dr. Emmett Brown10-Mar-08 10:44
Dr. Emmett Brown10-Mar-08 10:44 
GeneralRe: Please help me Pin
Rahul Vaishnav10-Mar-08 18:36
Rahul Vaishnav10-Mar-08 18:36 
GeneralProblem in getting data from server Pin
MANISH RASTOGI7-Mar-08 18:28
MANISH RASTOGI7-Mar-08 18:28 
Hi Friends,
I am using VC++ 6.0 I careated an exe server using ATL. It has one interface mdethod "ComputerName". Prototype of method is :

[id(1), helpstring("ComputerName")] HRESULT ComputerName([out] short *pnSize, [out, size_is(1, *pnSize)] unsigned char **ppszComputerName);

Server implementation of this function is :

STDMETHODIMP CTestServer::ComputerName(short *pnSize, unsigned char **ppszComputerName)
{
TCHAR szBuffer[100] = {0};
DWORD dwSize = 0;
int iLength = 0;

dwSize = sizeof(szBuffer);

GetComputerName(szBuffer, &dwSize);
iLength = ::lstrlen(szBuffer);

*pnSize = iLength;
*ppszComputerName = (unsigned char *) CoTaskMemAlloc(iLength + 1);
::lstrcpy((char *) *ppszComputerName, szBuffer);

return(S_OK);
}

Client Side Implementation is :

ITestServer *pITestServer = NULL;
HRESULT hResult = NULL;
short int nSize = 0;
unsigned char *pszComputerName = NULL;

CoInitialize(NULL);

hResult = CoCreateInstance(....);
if(SUCCEEDED(hResult))
{
pITestServer->ComputerName(&nSize, &pszComputerName);
// Here is problem only pszComputerName[0] contains valid data. other contains invalid data. nSize contains valid length.
pITestServer->Release();
}

CoUninitialize();


I am unable to get the reason. Anyone can help me please.

Manish Rastogi
GeneralRe: Problem in getting data from server Pin
Ernest Laurentin10-Mar-08 4:47
Ernest Laurentin10-Mar-08 4:47 
GeneralRe: Problem in getting data from server Pin
MANISH RASTOGI11-Mar-08 21:06
MANISH RASTOGI11-Mar-08 21:06 
GeneralEvent Map of an ActiveX control Pin
AbbyIndian6-Mar-08 6:58
AbbyIndian6-Mar-08 6:58 
GeneralError while creating object using CreateInstance() Pin
KASR16-Mar-08 0:31
KASR16-Mar-08 0:31 
GeneralRe: Error while creating object using CreateInstance() Pin
Nathan Holt at EMOM6-Mar-08 4:42
Nathan Holt at EMOM6-Mar-08 4:42 
GeneralBug in atlhost.h Pin
imagiro29-Feb-08 0:51
imagiro29-Feb-08 0:51 
GeneralRe: Bug in atlhost.h Pin
Michael Dunn29-Feb-08 9:29
sitebuilderMichael Dunn29-Feb-08 9:29 
GeneralReporting Bugs Pin
imagiro6-Mar-08 21:57
imagiro6-Mar-08 21:57 
GeneralGetting element id on click event from web browser in ATL Pin
ashish@indianic27-Feb-08 20:28
ashish@indianic27-Feb-08 20:28 
QuestionHow to use messagebox in ATL Pin
KASR126-Feb-08 21:41
KASR126-Feb-08 21:41 
AnswerRe: How to use messagebox in ATL Pin
ThatsAlok26-Feb-08 21:59
ThatsAlok26-Feb-08 21:59 
AnswerRe: How to use messagebox in ATL Pin
prasad_som5-Mar-08 4:57
prasad_som5-Mar-08 4:57 
AnswerRe: How to use messagebox in ATL Pin
dfz6-Mar-08 0:11
dfz6-Mar-08 0:11 
GeneralRe: How to use messagebox in ATL Pin
KASR16-Mar-08 0:14
KASR16-Mar-08 0:14 
AnswerRe: How to use messagebox in ATL Pin
Hamid_RT14-Apr-08 21:53
Hamid_RT14-Apr-08 21:53 
QuestionHow to handle strings in ATL. Pin
KASR126-Feb-08 19:23
KASR126-Feb-08 19:23 
AnswerRe: How to handle strings in ATL. Pin
MANISH RASTOGI26-Feb-08 21:09
MANISH RASTOGI26-Feb-08 21:09 

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.