Click here to Skip to main content
15,902,636 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Variable Depth For Loop to create a number sequence...how?! Pin
Christian Graus17-Aug-09 14:56
protectorChristian Graus17-Aug-09 14:56 
GeneralRe: Variable Depth For Loop to create a number sequence...how?! Pin
Aaron @ Think Software17-Aug-09 14:59
professionalAaron @ Think Software17-Aug-09 14:59 
AnswerRe: Variable Depth For Loop to create a number sequence...how?! Pin
Aaron @ Think Software17-Aug-09 15:38
professionalAaron @ Think Software17-Aug-09 15:38 
GeneralRe: Variable Depth For Loop to create a number sequence...how?! Pin
Luc Pattyn17-Aug-09 15:46
sitebuilderLuc Pattyn17-Aug-09 15:46 
AnswerRe: Variable Depth For Loop to create a number sequence...how?! Pin
Moreno Airoldi18-Aug-09 3:50
Moreno Airoldi18-Aug-09 3:50 
QuestionAccessViolationException when resizing an image Pin
Sonhospa17-Aug-09 12:02
Sonhospa17-Aug-09 12:02 
AnswerRe: AccessViolationException when resizing an image Pin
Christian Graus17-Aug-09 13:40
protectorChristian Graus17-Aug-09 13:40 
AnswerRe: AccessViolationException when resizing an image Pin
Luc Pattyn17-Aug-09 14:42
sitebuilderLuc Pattyn17-Aug-09 14:42 
Hi,

that is what documentation is for. MSDN on the Bitmap constructor that takes an IntPtr says: "The caller is responsible for allocating and freeing the block of memory specified by the scan0 parameter, however, the memory should not be released until the related Bitmap is released."

Hence you can't unpin the data as long as the bitmap is alive.
One solution could be to create a second image from the first one, like so (not tested, and C# syntax):

Bitmap bm1 = new Bitmap(Width, Height, 3 * Width, Imaging.PixelFormat.Format24bppRgb, pBuf);
Bitmap bm2 = new Bitmap(bm1);
bm1.Dispose();
gch.Free();
PictureBox1.Image=bm2;


Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.

GeneralRe: AccessViolationException when resizing an image Pin
Sonhospa17-Aug-09 19:15
Sonhospa17-Aug-09 19:15 
QuestionUsing %windir% in File.copy Pin
Ghost_80717-Aug-09 11:03
Ghost_80717-Aug-09 11:03 
AnswerRe: Using %windir% in File.copy ... oppps VB Pin
Adam R Harris17-Aug-09 11:29
Adam R Harris17-Aug-09 11:29 
AnswerRe: Using %windir% in File.copy Pin
Sonhospa17-Aug-09 11:36
Sonhospa17-Aug-09 11:36 
AnswerRe: Using %windir% in File.copy Pin
Ghost_80717-Aug-09 12:03
Ghost_80717-Aug-09 12:03 
GeneralRe: Using %windir% in File.copy Pin
Dave Kreskowiak17-Aug-09 14:34
mveDave Kreskowiak17-Aug-09 14:34 
GeneralRe: Using %windir% in File.copy Pin
Ghost_80718-Aug-09 3:06
Ghost_80718-Aug-09 3:06 
GeneralRe: Using %windir% in File.copy Pin
Dave Kreskowiak18-Aug-09 4:20
mveDave Kreskowiak18-Aug-09 4:20 
GeneralRe: Using %windir% in File.copy Pin
Ghost_80718-Aug-09 6:44
Ghost_80718-Aug-09 6:44 
GeneralRe: Using %windir% in File.copy Pin
Ghost_80718-Aug-09 9:53
Ghost_80718-Aug-09 9:53 
QuestionAutomatically starting VB 6 application at Windows Start Up Pin
RyJaBy17-Aug-09 7:02
RyJaBy17-Aug-09 7:02 
AnswerRe: Automatically starting VB 6 application at Windows Start Up Pin
Dave Kreskowiak17-Aug-09 8:07
mveDave Kreskowiak17-Aug-09 8:07 
QuestionHow to print page with Visual Basic 2008? Pin
Mohamed_Khalil17-Aug-09 6:31
Mohamed_Khalil17-Aug-09 6:31 
AnswerRe: How to print page with Visual Basic 2008? Pin
Henry Minute17-Aug-09 7:06
Henry Minute17-Aug-09 7:06 
QuestionAdding a Positive Double to Negative Double Pin
KeithF17-Aug-09 3:43
KeithF17-Aug-09 3:43 
AnswerRe: Adding a Positive Double to Negative Double Pin
Luc Pattyn17-Aug-09 4:12
sitebuilderLuc Pattyn17-Aug-09 4:12 
GeneralRe: Adding a Positive Double to Negative Double Pin
KeithF17-Aug-09 4:16
KeithF17-Aug-09 4:16 

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.