Best way to use external dll in wxWidgets application

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
AKG
Earned a small fee
Earned a small fee
Posts: 14
Joined: Wed Aug 17, 2016 2:49 pm

Best way to use external dll in wxWidgets application

Post by AKG »

http://www.oxetta.com/report/doc/start.html has code to explain how to integrate their dll files (library) - (AT THE BOTTOM OF THE PAGE AFTER ALL THE SCREEN DUMPS OF THEIR PROGRAM ) i cant post the code sample because it is in an image, but its not a lot of code to read from the link above.

My question is just what is the best way to do this in a wxWidgets application. Its a dll file, that uses a xml file to print ...

This is all MFC C++ so what is the best way to integrate this in to an wxWidgets application ???

For starters, I can just find the exWIdgets way to load the dll and use it ....

But for other platforms i need to find out what print functionality there is in wxWidgets to prosess this xml file, and do the job of this dll.

In other words where in the wxWidgets should I start reading to find the functioality for this ???
Last edited by AKG on Sat Aug 20, 2016 12:35 pm, edited 1 time in total.
User avatar
doublemax
Moderator
Moderator
Posts: 19158
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Best way to use external dll in wxWidgets application

Post by doublemax »

A wxWidgets application under Windows is still a "normal" Windows application. From what i see that should work as it is.
Use the source, Luke!
AKG
Earned a small fee
Earned a small fee
Posts: 14
Joined: Wed Aug 17, 2016 2:49 pm

Re: Best way to use external dll in wxWidgets application

Post by AKG »

Sorry, i dont explain very well ...

I added more to my first message, to clarity - i cant use the dll on other platforms
User avatar
doublemax
Moderator
Moderator
Posts: 19158
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Best way to use external dll in wxWidgets application

Post by doublemax »

wxWidgets has wxDynamicLibrary for loading DLLs, but you really don't need it. The code on that page should work 1:1 as it is.

But if you need the functionality also under other platforms and want to emulate the behavior of the DLL, then you don't need the DLL anyway, do you?

But IMHO that all sounds unnecessarily complicated. I don't know how complex the reports are you have in mind, but i'm pretty sure a HTML based solution like i suggested in the other thread would be much easier. Actually i think you could already be done by now ;)
Use the source, Luke!
AKG
Earned a small fee
Earned a small fee
Posts: 14
Joined: Wed Aug 17, 2016 2:49 pm

Re: Best way to use external dll in wxWidgets application

Post by AKG »

The dll is printing files like this. You can see it has a database connection, and the sections of the file has info on where to place things, and there are several querys for the seperate sections etc.

I can use the dll to do this under windows, but what if I am doing this on other platforms, i have to write functions to replace this dll file.
What parts of wxWIdgets do i start looking at to do this type of stuff ??

The sample file:
=============================================================
<?xml version="1.0" encoding="UTF-16"?>
<report version="1" width="21000" height="29700" title="" database-type="0" portrait="1" database-connect-string="database.sqlite">

<element name="Report Header" type="2">
<header></header>
<footer></footer>
<height>1001</height>
<database-query></database-query>
<parent-data-source></parent-data-source>
<print-on-first-page>-842150451</print-on-first-page>
<element name="Text 1" type="9">
<color>0</color>
<left>332</left>
<top>233</top>
<right>20522</right>
<bottom>902</bottom>
<text>Employee List</text>
<horz_alignment>0</horz_alignment>
<vert_alignment>0</vert_alignment>
<word_wrap>1</word_wrap>
<font name="Times New Roman" size="12" charset="204" bold="1" italic="0" underline="0" strikeout="0"/>
</element>
</element>

<element name="Group Header" type="1">
<header></header>
<footer></footer>
<height>1536</height>
<database-query>SELECT id AS department_id, name FROM departments</database-query>
<parent-data-source></parent-data-source>
<print-on-first-page>-842150451</print-on-first-page>
<element name="Shape 1" type="10">
<color>0</color>
<left>332</left>
<top>862</top>
<right>16685</right>
<bottom>1536</bottom>
<bk_color>16777215</bk_color>
<line_style>1</line_style>
<line_width>1</line_width>
<shape_type>1</shape_type>
</element>
<element name="Shape 2" type="10">
<color>0</color>
<left>16600</left>
<top>862</top>
<right>20656</right>
<bottom>1536</bottom>
<bk_color>16777215</bk_color>
<line_style>1</line_style>
<line_width>1</line_width>
<shape_type>1</shape_type>
</element>
<element name="Text 2" type="9">
<color>0</color>
<left>664</left>
<top>996</top>
<right>16117</right>
<bottom>1469</bottom>
<text>Employee Name</text>
<horz_alignment>0</horz_alignment>
<vert_alignment>0</vert_alignment>
<word_wrap>1</word_wrap>
<font name="Times New Roman" size="10" charset="204" bold="1" italic="0" underline="0" strikeout="0"/>
</element>
<element name="Text 3" type="9">
<color>0</color>
<left>16757</left>
<top>968</top>
<right>20306</right>
<bottom>1502</bottom>
<text>Salary</text>
<horz_alignment>0</horz_alignment>
<vert_alignment>0</vert_alignment>
<word_wrap>1</word_wrap>
<font name="Times New Roman" size="10" charset="204" bold="1" italic="0" underline="0" strikeout="0"/>
</element>
<element name="DB Text 4" type="11">
<color>0</color>
<left>332</left>
<top>99</top>
<right>20456</right>
<bottom>737</bottom>
<text>name</text>
<horz_alignment>0</horz_alignment>
<vert_alignment>0</vert_alignment>
<word_wrap>1</word_wrap>
<font name="Times New Roman" size="12" charset="204" bold="1" italic="0" underline="0" strikeout="0"/>
<format></format>
<data-source>Group Header</data-source>
</element>
</element>

<element name="Report Contents" type="1">
<header>Group Header</header>
<footer></footer>
<height>831</height>
<database-query>SELECT first_name || ' ' || last_name AS name, salary FROM employee WHERE department_id=:department_id</database-query>
<parent-data-source>Group Header</parent-data-source>
<print-on-first-page>-842150451</print-on-first-page>
<element name="Shape 3" type="10">
<color>0</color>
<left>332</left>
<top>0</top>
<right>16652</right>
<bottom>831</bottom>
<bk_color>16777215</bk_color>
<line_style>1</line_style>
<line_width>1</line_width>
<shape_type>1</shape_type>
</element>
<element name="Shape 4" type="10">
<color>0</color>
<left>16600</left>
<top>0</top>
<right>20623</right>
<bottom>831</bottom>
<bk_color>16777215</bk_color>
<line_style>1</line_style>
<line_width>1</line_width>
<shape_type>1</shape_type>
</element>
<element name="DB Text 2" type="11">
<color>0</color>
<left>499</left>
<top>167</top>
<right>16317</right>
<bottom>701</bottom>
<text>name</text>
<horz_alignment>0</horz_alignment>
<vert_alignment>0</vert_alignment>
<word_wrap>1</word_wrap>
<font name="Times New Roman" size="10" charset="1" bold="0" italic="0" underline="0" strikeout="0"/>
<format></format>
<data-source>Report Contents</data-source>
</element>
<element name="DB Text 3" type="11">
<color>0</color>
<left>16727</left>
<top>132</top>
<right>20244</right>
<bottom>701</bottom>
<text>salary</text>
<horz_alignment>1</horz_alignment>
<vert_alignment>0</vert_alignment>
<word_wrap>1</word_wrap>
<font name="Times New Roman" size="10" charset="1" bold="0" italic="0" underline="0" strikeout="0"/>
<format>%.2f</format>
<data-source>Report Contents</data-source>
</element>
</element>

<element name="Page Footer" type="5">
<header></header>
<footer></footer>
<height>938</height>
<database-query></database-query>
<parent-data-source></parent-data-source>
<print-on-first-page>-842150451</print-on-first-page>
<element name="Page Number" type="9">
<color>0</color>
<left>16600</left>
<top>99</top>
<right>20535</right>
<bottom>768</bottom>
<text>Page:</text>
<horz_alignment>1</horz_alignment>
<vert_alignment>0</vert_alignment>
<word_wrap>1</word_wrap>
<font name="Times New Roman" size="10" charset="1" bold="0" italic="0" underline="0" strikeout="0"/>
</element>
</element>

</report>
User avatar
doublemax
Moderator
Moderator
Posts: 19158
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Best way to use external dll in wxWidgets application

Post by doublemax »

You can use wxXmlDocument to parse the file but interpreting the data and creating a visual layout from it would be your task.
Use the source, Luke!
AKG
Earned a small fee
Earned a small fee
Posts: 14
Joined: Wed Aug 17, 2016 2:49 pm

Re: Best way to use external dll in wxWidgets application

Post by AKG »

ok -
so I have wxSQLite to handle database issues, it takes care of the data types from TEXT to what ever datatype and INT or REAL to what ever datatype, and I have wxXmlDocument to read the xml file the designer creates: so i can find the queries and database connections and the sections of the page and what to put on it.

The next is to put this together and print it, so do I make a html file out of it ? Is that what you mean ? Or do I make a pdf, or do I make images and use some image library to print pages.... or what is the next thing to do in wxWidgets to print this stuff ??
User avatar
doublemax
Moderator
Moderator
Posts: 19158
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Best way to use external dll in wxWidgets application

Post by doublemax »

The next is to put this together and print it, so do I make a html file out of it ? Is that what you mean ?
Yes. That's what i would do. You don't have to create a physical file, you can just dynamically create a wxString that contains the page data and set it with wxWebView::SetPage().
Use the source, Luke!
Post Reply