16,012,116 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by mehdishahgholi (Top 4 by date)
mehdishahgholi
7-Jul-15 1:24am
View
@Kornfeld Eliyahu Peter: Dear Peter
Yes I know I try this before:
Dim Bitmap As New Bitmap(100, 100, System.Drawing.Imaging.PixelFormat.Format16bppGrayScale)
Dim a As Integer = System.Drawing.Imaging.PixelFormat.Format16bppGrayScale
Dim BitmapData As BitmapData = Bitmap.LockBits(New Rectangle(0, 0, Bitmap.Width, Bitmap.Height), ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format16bppGrayScale)
Dim GrayLevelMap(100 * 100 - 1) As Short
Dim R As New Random
For i = 0 To GrayLevelMap.GetUpperBound(0)
GrayLevelMap(i) = R.Next(0, 32768)
Next
Marshal.CleanupUnusedObjectsInCurrentContext()
Marshal.Copy(GrayLevelMap, 0, BitmapData.Scan0, GrayLevelMap.Length)
Bitmap.UnlockBits(BitmapData)
PictureBox2.Image = Bitmap
but picturebox show a white box with a red x on it !!!
mehdishahgholi
6-Jul-15 7:38am
View
sorry I update the question
mehdishahgholi
21-Oct-14 7:45am
View
:) sure, Here is the code:
<DllImport("VADAV.DLL", EntryPoint:="VD_GetHomeDirectory", SetLastError:=True, CharSet:=CharSet.Auto, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)>
Public Shared Sub VD_GetHomeDirectory(ByRef Dir As StringBuilder)
End Sub
Private Sub HomeButton_Click(sender As System.Object, e As System.EventArgs) Handles HomeButton.Click
Dim Dir As New StringBuilder(100)
VD_GetHomeDirectory(Dir)
End Sub
AccessViolationException error happen and this is the message:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
I worked with two other function of this DLL with no problem as below:
<DllImport("VADAV.DLL", EntryPoint:="VD_GetImage", SetLastError:=True, CharSet:=CharSet.Unicode, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)>
Private Shared Function VD_GetImage(ByRef W As IntPtr) As IntPtr
End Function
<DllImport("VADAV.DLL", EntryPoint:="VDACQ_GetFrameDim", SetLastError:=True, CharSet:=CharSet.Unicode, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)>
Public Shared Sub VDACQ_GetFrameDim(ByRef W As IntPtr, ByRef H As IntPtr)
End Sub
Collapse | Copy Code
Private Sub CheckDetectorButton_Click(sender As System.Object, e As System.EventArgs) Handles CheckDetectorButton.Click
Dim W As IntPtr
Dim H As IntPtr
VDACQ_GetFrameDim(W, H)
DimentionTextBox.Text = W.ToString + ";" + H.ToString
Me.Cursor = Cursors.WaitCursor
If VD_ConnectRestore() Then
CheckDetectorButton.BackColor = Color.Green
Else
CheckDetectorButton.BackColor = Color.Red
End If
Me.Cursor = Cursors.Default
End Sub
But with VD_GetHomeDirectory I get into hot water. Any idea please :(
mehdishahgholi
21-Oct-14 3:28am
View
I tried but does not work. Could you please explain more or write the code