Click here to Skip to main content
15,918,808 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: vectors. Pin
markkuk16-Aug-03 6:29
markkuk16-Aug-03 6:29 
GeneralRe: vectors. Pin
ZoogieZork16-Aug-03 6:32
ZoogieZork16-Aug-03 6:32 
GeneralWorked like a charm! Pin
WREY16-Aug-03 7:37
WREY16-Aug-03 7:37 
Generalproblem in creating Modeless window Pin
Ph@ntom15-Aug-03 19:30
Ph@ntom15-Aug-03 19:30 
GeneralRe: problem in creating Modeless window Pin
Steve Mayfield15-Aug-03 20:16
Steve Mayfield15-Aug-03 20:16 
GeneralRe: problem in creating Modeless window Pin
Ph@ntom15-Aug-03 23:57
Ph@ntom15-Aug-03 23:57 
GeneralVB to C++ help... Pin
JoeSox15-Aug-03 19:00
JoeSox15-Aug-03 19:00 
GeneralRe: VB to C++ help... Pin
J. Dunlap15-Aug-03 19:25
J. Dunlap15-Aug-03 19:25 
Aha! Trying to port the classic VB DibSection code into C++, eh? Well, in C++, you can either use raw pointers, or you can use the SafeArray, just as VB does.

What's going on in the VB example:
'a 2D SAFEARRAY descriptor
Dim tSA As SAFEARRAY2D
'an array used to access the bitmap's bits
Dim bDib() As Byte
Dim cDib As New cDIBsection (which I have converted to [^] m_DIBSection.Load(my.bmp); )
 
'fill in the SafeArray descriptor struct
With tSA
.cbElements = 1
.cDims = 2
.Bounds(0).lLbound = 0
.Bounds(0).cElements = cDib.Height
.Bounds(1).lLbound = 0
.Bounds(1).cElements = cDib.BytesPerScanLine
.pvData = cDib.DIBSectionBitsPtr
End With
 
'copy the descriptor over the descriptor in the bDib SafeArray
CopyMemory ByVal VarPtrArray(bDib), VarPtr(tSA), 4

Partial C++ port:
//a 2D SAFEARRAY descriptor
SAFEARRAY2D* tSA;
 
//declare and load the DIB here
 
//fill in the SafeArray descriptor struct
tSA->cbElements = 1;
tSA->cDims = 2;
tSA->Bounds[0]->lLbound = 0;
tSA->Bounds[0]->cElements = cDib->Height;
tSA->Bounds[1]->lLbound = 0;
tSA->Bounds[1]->cElements = cDib->BytesPerScanLine;
tSA->pvData = cDib->DIBSectionBitsPtr;
 
//now use the SAFEARRAY functions to access array elements



"Blessed are the peacemakers, for they shall be called sons of God." - Jesus

"You must be the change you wish to see in the world." - Mahatma Gandhi







GeneralRun application in safe mode !! Pin
rohit.dhamija15-Aug-03 18:28
rohit.dhamija15-Aug-03 18:28 
GeneralCan't generate release version - VC++6, multi-monitor app, Win98 Pin
normanS14-Aug-03 8:56
normanS14-Aug-03 8:56 
GeneralRe: Can't generate release version - VC++6, multi-monitor app, Win98 Pin
Tim Smith14-Aug-03 9:24
Tim Smith14-Aug-03 9:24 
GeneralNo - SDK is NOT for Win95, 98, ME Pin
normanS15-Aug-03 21:01
normanS15-Aug-03 21:01 
GeneralRe: Can't generate release version - VC++6, multi-monitor app, Win98 Pin
Michael Dunn15-Aug-03 18:57
sitebuilderMichael Dunn15-Aug-03 18:57 
GeneralRe: Can't generate release version - VC++6, multi-monitor app, Win98 Pin
normanS15-Aug-03 21:05
normanS15-Aug-03 21:05 
GeneralProblem Solved Pin
normanS15-Aug-03 23:51
normanS15-Aug-03 23:51 
GeneralCTreeCtrl Notification Messages Pin
Chris Meech14-Aug-03 8:46
Chris Meech14-Aug-03 8:46 
GeneralRe: CTreeCtrl Notification Messages Pin
Michael Dunn15-Aug-03 18:59
sitebuilderMichael Dunn15-Aug-03 18:59 
GeneralDirectShow PushSource Example Pin
Andy Beamish14-Aug-03 6:24
Andy Beamish14-Aug-03 6:24 
GeneralHide tree item Pin
orcun colak14-Aug-03 6:18
orcun colak14-Aug-03 6:18 
GeneralRe: Hide tree item Pin
valikac14-Aug-03 6:34
valikac14-Aug-03 6:34 
GeneralRe: Hide tree item Pin
orcun colak14-Aug-03 6:42
orcun colak14-Aug-03 6:42 
GeneralRe: Hide tree item Pin
Neville Franks14-Aug-03 10:03
Neville Franks14-Aug-03 10:03 
GeneralRe: Hide tree item Pin
J. Dunlap15-Aug-03 18:42
J. Dunlap15-Aug-03 18:42 
GeneralVirtualQueryEx Pin
Blake Miller14-Aug-03 5:57
Blake Miller14-Aug-03 5:57 
GeneralRe: VirtualQueryEx Pin
Alexander M.,16-Aug-03 14:54
Alexander M.,16-Aug-03 14:54 

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.