Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GdPicture .Net Display Problem
#1
GdPicture .Net has a COM interface. You could download it here:
https://www.gdpicture.com/download/gdpicturedotnet.zip

I could make a GUI to incorporate its "GdViewer" display.
But I don't know how to show the image on the display.

After running it and select an image file and click OK button
nothing showing up in the display.

Could anybody find out why?


Function Dialog10
Code:
Copy      Help
\Dialog_Editor

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 704 596 "Dialog"
;3 ActiveX 0x54030000 0x0 0 0 706 578 "GdPicture_NET_14.GdViewer {DDF6E929-D524-4DD0-99B9-3F9BD2107FB8}"
;1 Button 0x54030001 0x4 652 580 48 14 "OK"
;2 Button 0x54030000 0x4 592 580 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040202 "*" "" "" ""

str controls = "3"
str ax3GdP
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

typelib GdPicture_NET_14 {B5893B58-701E-4110-9871-1DA14CF9C1DC} 14.1
GdPictureImaging Gdp._create()
GdViewer GdViewer1._create()

sel message
,case WM_INITDIALOG
,,//Loading the image from a file.
,,int imageID = Gdp.CreateGdPictureImageFromFile("")
,,
,,//Checking if the image has been loaded correctly.
,,if (Gdp.GetStat() == GdPicture_NET_14.GdPictureStatus_OK)
,,,
,,,;Displaying the image and checking the status.
,,,if (GdViewer1.DisplayFromGdPictureImage(imageID) != GdPicture_NET_14.GdPictureStatus_OK)
,,,,out "Error occurred when displaying the image."

,,,;Releasing the image resource.
,,,;Gdp.ReleaseGdPictureImage(imageID)
,,else
,,,;Displaying the error message.
,,,out "The file can't be loaded."
,,
,,Gdp.Dispose()

,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
#2
Your code creates new objects on every message received by the dialog procedure. Probably should be

GdPictureImaging- Gdp
GdViewer- GdViewer1
...
case WM_INITDIALOG
Gdp._create()
GdViewer1._create()
#3
I did like you said but it still did not show up the picture.

Function Dialog10
Code:
Copy      Help
\Dialog_Editor

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 704 596 "Dialog"
;3 ActiveX 0x54030000 0x0 0 0 706 578 "GdPicture_NET_14.GdViewer {DDF6E929-D524-4DD0-99B9-3F9BD2107FB8}"
;1 Button 0x54030001 0x4 652 580 48 14 "OK"
;2 Button 0x54030000 0x4 592 580 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040202 "*" "" "" ""

str controls = "3"
str ax3GdP

typelib GdPicture_NET_14 {B5893B58-701E-4110-9871-1DA14CF9C1DC} 14.1
GdPictureImaging- Gdp
GdViewer- GdViewer1

if(!ShowDialog(dd &sub.DlgProc &controls)) ret

#sub DlgProc v
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,,Gdp._create()
,,GdViewer1._create()

,,//Loading the image from a file.
,,int imageID = Gdp.CreateGdPictureImageFromFile("")
,,
,,//Checking if the image has been loaded correctly.
,,if (Gdp.GetStat() == GdPicture_NET_14.GdPictureStatus_OK)
,,,
,,,;Displaying the image and checking the status.
,,,if (GdViewer1.DisplayFromGdPictureImage(imageID) != GdPicture_NET_14.GdPictureStatus_OK)
,,,,out "Error occurred when displaying the image."

,,,;Releasing the image resource.
,,,;Gdp.ReleaseGdPictureImage(imageID)
,,else
,,,;Displaying the error message.
,,,out "The file can't be loaded."
,,
,,Gdp.Dispose()

,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
#4
The variable is not attached to the control. Instead of GdViewer1._create use GdViewer1._getcontrol(id(3 hDlg))
#5
I did make the change as you've suggested but again the image is not displayed yet.

Function Dialog10
Code:
Copy      Help
\Dialog_Editor

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 704 596 "Dialog"
;3 ActiveX 0x54030000 0x0 0 0 706 578 "Gdpture_NET_14.GdViewer {DDF6E929-D524-4DD0-99B9-3F9BD2107FB8}"
;1 Button 0x54030001 0x4 652 580 48 14 "OK"
;2 Button 0x54030000 0x4 592 580 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040202 "*" "" "" ""

str Controls = "3"
str ax3GdP

typelib GdPicture_NET_14 {B5893B58-701E-4110-9871-1DA14CF9C1DC} 14.1
GdPictureImaging- Gdp._create()
GdViewer- GdViewer1

if(!ShowDialog(dd &sub.DlgProc &Controls)) ret

#sub DlgProc v
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG

,,//Loading the image from a file.
,,int imageID = Gdp.CreateGdPictureImageFromFile("")

,,//Checking if the image has been loaded correctly.
,,if (Gdp.GetStat() = GdPicture_NET_14.GdPictureStatus_OK)

,,,// Attach GdViewer1 to the control display GdViewer
,,,GdViewer1._getcontrol(id(3 hDlg))

,,,;Displaying the image and checking the status.
,,,if (GdViewer1.DisplayFromGdPictureImage(imageID) != GdPicture_NET_14.GdPictureStatus_OK)
,,,,out "Error occurred when displaying the image."
,,,else
,,,,out "Picture loads just fine!"
,,,,
,,,;Releasing the image resource.
,,,;Gdp.ReleaseGdPictureImage(imageID)
,,else
,,,;Displaying the error message.
,,,out "The file can't be loaded."
,,
,,;Gdp.Dispose()

,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
#6
Now the code is correct. Should work, unless file path in CreateGdPictureImageFromFile line is incorrect.
Maybe the component it is not free, and must be registered somehow.
#7
I encountered the same issue. I used the registration serial number, but the image still doesn't display

Macro Gdp
Code:
Copy      Help
typelib GdPicture_NET_14 {B5893B58-701E-4110-9871-1DA14CF9C1DC} 14.2

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog" "4"
;3 ActiveX 0x54030000 0x0 0 0 216 110 "GdPicture_NET_14.GdViewer {0CC0D923-B9ED-310C-B453-D1A59F25712C}"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040C02 "*" "" "" ""

GdPictureImaging Gdp._create
GdViewer- GdViewer1

;https://www.gdpicture.com/guides/gdpicture/How%20to%20unlock%20GdPicture.NET.html
LicenseManager oLicenseManager._create 
oLicenseManager.RegisterKEY("xxxxxx")

if(!ShowDialog(dd &sub.DlgProc 0)) ret


#sub DlgProc v
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG

,,//Loading the image from open dialog
,,int imageID = Gdp.CreateGdPictureImageFromFile("")
,,
,,GdViewer1._getcontrol(id(3 hDlg))
,,GdViewer1.DisplayFromGdPictureImage(imageID)

,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1


Forum Jump:


Users browsing this thread: 1 Guest(s)