Visual Basic Issues
Posted: 2011-11-19T07:40:08-07:00
Hi all. New to this forum but glad to be here. Anyway, onto my problem.
I am using Visual Basic in VS2010 and am having issues getting COM+ to work. I have the following code which doesn;t appear to be working. The conversion never happens. If I copy the string generated and place it in a command window then it works fine. Anyway, the code...
This would generate a commandString as follows (as an example)...
... but nothing happens from within the program. I have used regserv32 to register the dll, have referenced it in my solution and have included the import but no matter what I do, it doesn't appear to be working. I have noticed that after referencing the DLL it creates a copy in my release folder and calls it "Interop.ImageMagickObject.dll" and it's only 6KB in size. Excuse my ignorance if that's a red herring but I've not done any imports using 3rd party DLL before!
Any help greatly appreciated!
I am using Visual Basic in VS2010 and am having issues getting COM+ to work. I have the following code which doesn;t appear to be working. The conversion never happens. If I copy the string generated and place it in a command window then it works fine. Anyway, the code...
Code: Select all
Private Sub polymorphImage(ByRef imagePath As String, ByRef pictureBox As PictureBox, ByRef refPoints As Point())
Dim tempImage As ImageMagickObject.MagickImage = New ImageMagickObject.MagickImage()
Dim newFile As String = My.Computer.FileSystem.GetFileInfo(imagePath).DirectoryName + "\mbcg_preview.png"
Dim imageWidth As Integer = 0
Dim imageHeight As Integer = 0
For Each pointCheck In refPoints
If (pointCheck.X > imageWidth) Then
imageWidth = pointCheck.X
End If
If (pointCheck.Y > imageHeight) Then
imageHeight = pointCheck.Y
End If
Next
Dim commandString As String = Chr(34)
commandString += imagePath
commandString += Chr(34) + " "
commandString += "-virtual-pixel transparent -resize "
commandString += imageWidth.ToString + "x" + imageHeight.ToString + " " 'Resize
commandString += "-distort perspective "
commandString += Chr(34)
commandString += "0,0 " 'SUL
commandString += refPoints(topLeft).X.ToString + "," + refPoints(topLeft).Y.ToString + " " 'DUL
commandString += "0," + imageWidth.ToString + " " 'SLL
commandString += refPoints(bottomLeft).X.ToString + "," + refPoints(bottomLeft).Y.ToString + " " 'DLL
commandString += imageWidth.ToString + ",0 " 'SUR
commandString += refPoints(topRight).X.ToString + "," + refPoints(topRight).Y.ToString + " " 'DUR
commandString += imageWidth.ToString + "," + imageHeight.ToString + " " 'SLR
commandString += refPoints(bottomRight).X.ToString + "," + refPoints(bottomRight).Y.ToString 'DLR
commandString += Chr(34) + " "
commandString += Chr(34)
commandString += newFile
commandString += Chr(34)
executeCommand.Text = commandString
MessageBox.Show(tempImage.Convert(commandString))
Dim newImage As Image = Image.FromFile(newFile)
pictureBox.BackgroundImage = newImage
pictureBox.Invalidate()
End Sub
Code: Select all
"\\Aitsl-nas\iso 1\After Life (2009)\folder.jpg" -virtual-pixel transparent -resize 343x410 -distort perspective "0,0 0,0 0,343 0,410 343,0 343,0 343,410 343,410" "\\Aitsl-nas\iso 1\After Life (2009)\mbcg_preview.png"
Any help greatly appreciated!