Click here to Skip to main content
15,887,135 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Converting text file to xml Pin
c0712-Jan-06 16:14
c0712-Jan-06 16:14 
QuestionHow to dynamically retrieve ODBC parameters through code? Pin
Priya..k11-Jan-06 5:08
Priya..k11-Jan-06 5:08 
AnswerRe: How to dynamically retrieve ODBC parameters through code? Pin
Koushik Biswas11-Jan-06 16:10
Koushik Biswas11-Jan-06 16:10 
GeneralRe: How to dynamically retrieve ODBC parameters through code? Pin
Priya..k11-Jan-06 22:23
Priya..k11-Jan-06 22:23 
AnswerRe: How to dynamically retrieve ODBC parameters through code? Pin
Koushik Biswas12-Jan-06 5:48
Koushik Biswas12-Jan-06 5:48 
QuestionSerial Presence Detect Pin
André Ziegler11-Jan-06 4:46
André Ziegler11-Jan-06 4:46 
QuestionIStream class Pin
LCI11-Jan-06 4:17
LCI11-Jan-06 4:17 
AnswerRe: IStream class Pin
Stephen Hewitt11-Jan-06 15:28
Stephen Hewitt11-Jan-06 15:28 
Here is a program to show how this can be done:

#include "stdafx.h"
#include <objbase.h>

int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
CoInitialize(NULL);

char YourData[] = "Your data here.";

HGLOBAL hGbl = GlobalAlloc(GMEM_MOVEABLE, sizeof(YourData));
if ( hGbl )
{
LPVOID pMem = GlobalLock(hGbl);
if ( pMem != NULL )
{
memcpy(pMem, YourData, sizeof(YourData));
GlobalUnlock(hGbl);

IStream* pStream;
HRESULT hr = CreateStreamOnHGlobal(hGbl, TRUE, &pStream);
if ( SUCCEEDED(hr) )
{
// Use stream here!
char TestBuffer[1024];
ULONG Read;
hr = pStream->Read(TestBuffer, sizeof(TestBuffer), &Read);
if ( SUCCEEDED(hr) )
{
MessageBox(NULL, TestBuffer, "From the stream", MB_OK);
}

pStream->Release();
}
else
{
GlobalFree(hGbl);
}
}
}

CoUninitialize();

return 0;
}


Steve

QuestionDigital I/O and ActiveX Pin
sweep12311-Jan-06 3:57
sweep12311-Jan-06 3:57 
AnswerRe: Digital I/O and ActiveX Pin
James R. Twine11-Jan-06 5:15
James R. Twine11-Jan-06 5:15 
QuestionSinh Calculator Pin
Dylan06038811-Jan-06 3:42
Dylan06038811-Jan-06 3:42 
AnswerRe: Sinh Calculator Pin
Russell'11-Jan-06 4:17
Russell'11-Jan-06 4:17 
GeneralRe: Sinh Calculator Pin
Russell'11-Jan-06 4:38
Russell'11-Jan-06 4:38 
AnswerRe: Sinh Calculator Pin
Prakash Nadar11-Jan-06 4:39
Prakash Nadar11-Jan-06 4:39 
JokeRe: Sinh Calculator Pin
Eytukan11-Jan-06 4:49
Eytukan11-Jan-06 4:49 
GeneralRe: Sinh Calculator Pin
toxcct11-Jan-06 6:21
toxcct11-Jan-06 6:21 
GeneralRe: Sinh Calculator Pin
Eytukan11-Jan-06 20:02
Eytukan11-Jan-06 20:02 
General'1'... Pin
toxcct11-Jan-06 21:19
toxcct11-Jan-06 21:19 
GeneralRe: '1'... Pin
Eytukan11-Jan-06 21:52
Eytukan11-Jan-06 21:52 
GeneralRe: '1'... Pin
toxcct11-Jan-06 22:03
toxcct11-Jan-06 22:03 
GeneralRe: '1'... Pin
Eytukan11-Jan-06 22:17
Eytukan11-Jan-06 22:17 
GeneralRe: Sinh Calculator Pin
Eytukan11-Jan-06 22:01
Eytukan11-Jan-06 22:01 
GeneralRe: Sinh Calculator Pin
toxcct11-Jan-06 22:06
toxcct11-Jan-06 22:06 
AnswerRe: Sinh Calculator Pin
toxcct11-Jan-06 6:17
toxcct11-Jan-06 6:17 
Questionchar buf Pin
Smith#11-Jan-06 3:04
Smith#11-Jan-06 3:04 

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.