topic stringlengths 1 63 | text stringlengths 1 577k ⌀ |
|---|---|
Convert a print to Rtf or doc | Otto, you did not get the point. |
Convert a print to Rtf or doc | Enrico, Please describe again exactly what you want to do. I'm sure it can be solved.
Best regards,
Otto |
Convert a print to Rtf or doc | Hi to all
I have a print
PRINT oPrn NAME "My Print" PREVIEW
PAGE
WHILE !EOF()
some instruction like
Prn:Say( nRow, nCol , bla bla )
ENDPAGE
PAGE
ENDDO
ENDPAGE
ENDPRINT
I need some hints about the possibility to save the print into rtf for or doc You know for instance when you have a report in Access you see preview you can export in RTF. Simple but functional. Many thanks to all! |
Convert a print to Rtf or doc | richedit ?? no sirve?
Regards, saludos. |
Convert a print to Rtf or doc | [quote:39ou99yy]I need some hints about the possibility to save the print into rtf for or doc[/quote:39ou99yy]
You can save to MSWord doc.
In the preview click "W" button or Click SaveAs and then choose "Doc format". You will see the document in MSWord,
Then you many save as docx,doc or rtf from the Word application.
If you want to save as docx without seeing PREVIEW
[code=fw:39ou99yy]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">PRINT</span> oPrn <span style="color: #000000;">[</span>PREVIEW<span style="color: #000000;">]</span> FILE <span style="color: #ff0000;">"name.docx"</span></div>[/code:39ou99yy] |
Convert a print to Rtf or doc | Doing so, you get a Word document with images. Marco needs a Word document with text that can be selected. |
Convert a print to Rtf or doc | EMG,
that's right I need an editable document, Thank you to have specified the question.
Thinking that the program creates an Rtf in a easy way maybe it's simple also for us (for you <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: --> ) |
Convert a print to Rtf or doc | Hello Marco,
This is how we do it:
<!-- l --><a class="postlink-local" href="https://forums.fivetechsupport.com/viewtopic.php?f=3&t=13495&p=69231&hilit=word+zip&sid=62c130be6eb450bc2a0aad7749c99f80#p69231">viewtopic.php?f=3&t=13495&p=69231&hilit=word+zip&sid=62c130be6eb450bc2a0aad7749c99f80#p69231</a><!-- l -->
A DOCX file is essentially a ZIP file, and inside it, there's an XML file which is, in practice, a pure text file.
Best regards,
Otto
*************
But if you need a modern reporting tool, then you should use HTML. Everything else currently has no future. |
Convert a print to Rtf or doc | Otto,
what can I do with the xml inside the word file?
In Access (microsoft) when yo have a preview of a report you can export as rtf
it's very very beautiful |
Convert a print to Rtf or doc | Ok. You have a normal FWH print preview. You can save the preview to Word but the result is not editable (it is a series of images). How to get an editable Word result instead? |
Convert a print to Rtf or doc | [quote="Otto":1zz2bgam]Enrico,
But I can only recommend switching to HTML right away.[/quote:1zz2bgam]
Man beweist nie, dass man Unrecht hat, man wird um ein Word docgebeten und man möchte HTML kürzen. Es ist, als würde man einen Tesla kaufen und ihnen eine Kutsche liefern <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> |
Convert a print to Rtf or doc | Silvio,
I've posted the solution for WORD, and I've also allowed myself to represent my stance on Reports.
And it's the other way around. TESLA is HTML.
With kind regards,
Otto |
Convert a print to Rtf or doc | Otto,
do you think that when Microsoft Access allows you to create a report it actually creates a word (RTF) in parallel or
when you have the preview and click on export RTF it does something different maybe simpler?
good lunch to all |
Convert a print to Rtf or doc | Marco, What kind of reports are these? Don't you have a sample report?
If you need a WORD document, you have to create the document.xml.
Look at the logic in xbrowse, see how the XCEL export is done there. You have to do something similar with WORD.
Best regards,
Otto |
Convert a print to Rtf or doc | <!-- m --><a class="postlink" href="http://www.marcoboschi.it/public/sample.jpg">http://www.marcoboschi.it/public/sample.jpg</a><!-- m --> |
Convert a print to Rtf or doc | Converte It on HTML is Easy, i made something of several with php and html with css |
Convert a print to Rtf or doc | Hello Marco,
I've looked at the source code for editing document.xml in Word again.
It's complicated and has no future.
I'll post a small test program for HTML report later.
HTML is so easy to configure and it works everywhere.
Best regards,
Otto
[img:235e4l3d]https://mybergland.com/fwforum/worddocxclip3.jpg[/img:235e4l3d] |
Convert a print to Rtf or doc | Hello Marco,
This is a test for HTML report.
If you also make mod harbour programs later, you can adopt the reports 1:1.
You'll see that the report is saved as index.html in the program directory. You can then open this report with Word and save it as a docx file.
I hope you like it.
Please take your time for testing. I've experimented so much with reports, but HTML is the best.
Should you have further questions or specific requirements, especially regarding code customization, feel free to reach out to me again.
Best regards,
Otto
Download: <!-- m --><a class="postlink" href="https://mybergland.com/fwforum/marcob.zip">https://mybergland.com/fwforum/marcob.zip</a><!-- m -->
sourcecode and exe
***
[quote:3a0sudbm]
Guide to Using the FiveWin-Based Program
1. Program Start and GUI Initialization
When the program starts, the main function Main is called.
In this function, various GUI elements such as a dialog window (oDlg), a browser object (oBrw), and buttons are created.
The size and properties of these elements are set up to form a user interface for displaying and editing data.
2. Data Preparation
An array aData is defined and filled with preliminary data to be displayed in the GUI. This data might include company names, addresses, invoice numbers, and similar information.
3. Displaying Data in the Browser Object
The browser object oBrw is used to display the data from aData in a tabular view.
Users can see and edit this data in the GUI.
4. Generating a Report
By pressing a button in the dialog, the Report function is invoked.
This function reads HTML templates and constructs a structured report that includes images, product descriptions, quantities, and prices.
5. Printing the Report
The PrintHtml function allows for printing the generated report.
This function utilizes an ActiveX object to handle the printing process.
6. Auxiliary and Control Functions
The function check4prn is used to determine which columns should be printed in the report.
The procedures PrgInit and PrgExit initialize and clean up system settings at the start and end of the program.
Important Notes
Data Customization: The data provided in the aData array should be adjusted according to actual requirements.
HTML Templates: External HTML templates are used for the report. These should be present and correctly formatted.
Printing Functionality: The printing functionality depends on the correct configuration and installation of the ActiveX object.[/quote:3a0sudbm]
[img:3a0sudbm]https://mybergland.com/fwforum/neutriathlonclip1.jpg[/img:3a0sudbm]
[img:3a0sudbm]https://mybergland.com/fwforum/neutriathlonclip2.jpg[/img:3a0sudbm]
[img:3a0sudbm]https://mybergland.com/fwforum/neutriathlonclip4.jpg[/img:3a0sudbm]
[img:3a0sudbm]https://mybergland.com/fwforum/neutriathlonclip5.jpg[/img:3a0sudbm]
[img:3a0sudbm]https://mybergland.com/fwforum/neutriathlonclip6.jpg[/img:3a0sudbm] |
Convert a print to Rtf or doc | Marco needs to export from a normal FWH print preview (TPrinter). HTML could be interesting, but maybe not for his current project. |
Convert a print to Rtf or doc | Same way as we can generate editable pdf documents using TPrinter():lUseHaruPDF, we wanted to provide generation of editable Word Docx also. But the work is incomplete. We will soon provide this feature.
Till then one can consider using TWord class that is available free to generate word document. |
Convert a print to Rtf or doc | Dear Mr.Rao,
May I ask: Is there something wrong with HTML as a reporting language since everyone is against it?
The young developers do it. Most of them are web developers, why should they bother with another option.
Why should they, when they already have the preview - web browser - ready, take on additional work?
I don't see a future for separate systems.
What I see is that it's high time for us to move towards the web. Only a few desktop versions are being updated anymore.
Most customers then switch to web applications.
I think we should collaborate on HTML reports and support each other. It's also ideal for learning HTML and getting a feel for the web.
I have young people in my company, and I want us to be well-positioned for the future.
Best regards,
Otto |
Convert a print to Rtf or doc | [quote:2t00spvr]May I ask: Is there something wrong with HTML as a reporting language since everyone is against it?[/quote:2t00spvr]
Nothing wrong at all.
But for this, the programmers need to learn HTML and even master web programming.
You have already mastered this subject and it is very easy for you.
In fact, you have made your own syntax and a very powerful library of your own and I admire you for that.
You have been pushing this idea and this will take sometime to catch up with other programmers.
Once the programmers reach this stage, they don't any more need FWH.
Once we use php we do not need Harbour either.
A programmer who starts now to learn html, needs a very long time to produce html code and also requires a large html code with same functionality as a one line program in FWH
[code=fw:2t00spvr]<div class="fw" id="{CB}" style="font-family: monospace;">XBROWSER <span style="color: #ff0000;">"CUSTOMER.DBF"</span> FASTEDIT</div>[/code:2t00spvr]
with vertical and horizontal scrolling and facility to edit values inside the cell, validate and immediately save to dbf,recordset or whatever.
So they choose what helps them to develop the application faster.
In fact I have been thinking of personally approaching you to help me with a html module with the same functionality like this.
Next:
In this particular post, our friends wants to generate a word document.
You can help us on that requirement.
I saw your advice in the thread. But that works for template reports. We need to generate word doc for free form reporting.
I will be personally interested in your suggestions. |
Convert a print to Rtf or doc | [quote="Otto":381tra1u]May I ask: Is there something wrong with HTML as a reporting language since everyone is against it?[/quote:381tra1u]
Who is against it? I am not, for sure. But you can't answer to any question with "use HTML", sorry. |
Convert a print to Rtf or doc | Hello Enrico,
We should not become a retirement home.
If it has worked for most of us until now, then that must have been it. We need to focus on future topics.
We have only limited resources. And if we can't attract young people to our project here, then it's over.
It would really be a pity.
We have all the prerequisites. Only the stubbornness of the 'Best Agers' is in our way.
I currently feel the mood in the forum is like this:
(Look also at the eyes of the two young people)
[img:2knr21zj]https://mybergland.com/fwforum/bestagers.png[/img:2knr21zj]
I so wish - and Christmas is near,
that the mood will be like this again:
We should become the boys we used to be.
[img:2knr21zj]https://mybergland.com/fwforum/youngones.png[/img:2knr21zj]
But that's just my personal perception. Maybe I am the problem?
Have a nice weekend and
Best regards,
Otto |
Convert a print to Rtf or doc | [quote:25vmwh23]May I ask: Is there something wrong with HTML as a reporting language since everyone is against it?[/quote:25vmwh23]
It's not about being against HTML
it is the incessant fact of imposing a language like "Mod_Harbour"
Continued imposition by Mr Otto as the official ambassador of "Mod_harbour",
It's as if now one has to stop programming in Fwh and start studying the "Mod_harbour" which is absolutely not the same as fwh.
In fwh there are many things that don't work or work incorrectly, first let's improve the fwh and then we can think about the web.
and from what I can continuously read in the various forums this is not only my thought but the thought of the majority of fwh users who when they have to make a program for a management for a client encounter countless problems for classes that do not work or work badly and they are forced to do their own work to adapt them to their needs
I often see problems with Web-type management programs, I work at school and in my secretariat almost everything is now on the web and it's wrong because the day the servers don't work or the internet doesn't work everything stops and the same thing happens in commercial e-services: it is true that mod_jarbour works locally as Mr. Otto has always told me, but the management software is often located in CLOUD-type servers and are unreachable if there is a problem on the network.
In the initial proposals there was talk of a language identical to the fwh and the possibility of bringing it "portability" to the web but in reality this was not the case, a completely different language, starting with the non-compatible archives.
I have regularly used Html, javascript, Php for many years (for e-commerce management and study management, without the aid of mod_harbour or other languages which Mr Otto boasts of knowing and of which he is a repeated ambassador.
[b:25vmwh23]even viewing this image [/b:25vmwh23]
[img:25vmwh23]https://mybergland.com/fwforum/neutriathlonclip5.jpg[/img:25vmwh23]
[b:25vmwh23]is a clear sign that you are constantly taking the piss out of me[/b:25vmwh23]
[b:25vmwh23]because if he had a bit of love he wouldn't make a list with reference to umbrellas since there is no sea in Sillian unless Mr. Otto created it tonight[/b:25vmwh23]
it is a clear sign of allusion to my person
and I'm deeply fed up with this |
Convert a print to Rtf or doc | I don't want to cause controversy but as is always done in this forum... we start from a topic for example "..how do I save a print preview in Word docx..." and then there are people who don't want to impose everything 'other such as the html language for example
[b:1juwohs9]Please let's get back to the Title of this topic[/b:1juwohs9] |
Convert a print to Rtf or doc | Let me say it again: With the free developer resources we have here and the priorities - for example, variable column height in xBrowse - it's not possible. |
Convert a print to Rtf or doc | I remember a long time ago there was someone who had created a class or a function to convert printouts to RTF or Doc, I should have those functions in my hard disks but I would have to search for days, I know the guy was German or Austrian but many years have passed |
Convert a print to Rtf or doc | I did some tests with WEBVIEW.
I create the report - the buttonbar is inside the preview - theses are html buttons!
reading the preview
[b:w7nxg2ri]let printContents = document.getElementById('tischplanPreview').innerHTML;[/b:w7nxg2ri]
SendToFWH()
[code=fw:w7nxg2ri]<div class="fw" id="{CB}" style="font-family: monospace;"><br />document.getElementById<span style="color: #000000;">(</span><span style="color: #ff0000;">'edit-btn'</span><span style="color: #000000;">)</span>.addEventListener<span style="color: #000000;">(</span><span style="color: #ff0000;">'click'</span>, editbtn<span style="color: #000000;">)</span>;<br /> <span style="color: #00C800;">function</span> editbtn<span style="color: #000000;">(</span>evt<span style="color: #000000;">)</span> <span style="color: #000000;">{</span><br /> let printContents = document.getElementById<span style="color: #000000;">(</span><span style="color: #ff0000;">'tischplanPreview'</span><span style="color: #000000;">)</span>.innerHTML;<br /> const <span style="color: #00C800;">data</span> = <span style="color: #000000;">{</span><br /> <span style="color: #0000ff;">text</span>: <span style="color: #000000;">printContents</span>,<br /> btn: <span style="color: #ff0000;">''</span><br /> <span style="color: #000000;">}</span>;<br /> <span style="color: #0000ff;">var</span> someData = <span style="color: #000000;">{</span> <span style="color: #ff0000;">'param1'</span>: <span style="color: #00C800;">data</span> <span style="color: #000000;">}</span>;<br /> <span style="color: #0000ff;">var</span> s = SendToFWH<span style="color: #000000;">(</span> evt.target.<span style="color: #0000ff;">id</span>, evt.type, someData <span style="color: #000000;">)</span><br /> .then<span style="color: #000000;">(</span>s => <span style="color: #000000;">{</span><br /> alert<span style="color: #000000;">(</span>s.result<span style="color: #000000;">)</span>;<br /> <span style="color: #000000;">}</span><span style="color: #000000;">)</span><br /> <span style="color: #000000;">}</span><br /> </div>[/code:w7nxg2ri]
[img:w7nxg2ri]https://mybergland.com/fwforum/webviewhtmlprint.gif[/img:w7nxg2ri] |
Convert a word file to pure txt | Hi,
How can convert a word file to txt so i can do searches via memoread().
Thank you! |
Convert a word file to pure txt | Programmatically Open the word file, then use the Save As method and then choose Plain Text. Now you read this text file via Memoread and do whatever you want.
Another way is to read the entire text contents of a word document to a memory variable and then use it as per your requirement
[code=fw:2x8nkwn5]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #B900B9;">// Read the text contents into the TextContents variable</span><br />cTextContents = oWordDoc:<span style="color: #000000;">Content</span>:<span style="color: #0000ff;">Text</span></div>[/code:2x8nkwn5] |
Convert and print chinese idioms | Hello
I have to print Chinese idioms via socket with ESC / POS , as examples
[code=fw:1dntjstl]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"hbsocket.ch"</span><br /><span style="color: #00D7D7;">#define</span> ADDRESS <span style="color: #ff0000;">"192.168.0.139"</span><br /><span style="color: #00D7D7;">#define</span> PORT <span style="color: #000000;">9100</span><br /><span style="color: #00D7D7;">#define</span> EOT <span style="color: #000000;">(</span> Chr<span style="color: #000000;">(</span> <span style="color: #000000;">4</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> hSocket ,c1 := <span style="color: #ff0000;">''</span><br /> <br /> FW_SetUnicode<span style="color: #000000;">(</span> .T. <span style="color: #000000;">)</span><br /> c1 := <span style="color: #ff0000;">'"???"'</span><br /> <br /> <span style="color: #00C800;">if</span> empty<span style="color: #000000;">(</span> hSocket := hb_socketOpen<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> ? <span style="color: #ff0000;">"socket create error "</span> + hb_ntos<span style="color: #000000;">(</span> hb_socketGetError<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">if</span> !hb_socketConnect<span style="color: #000000;">(</span> hSocket, <span style="color: #000000;">{</span> HB_SOCKET_AF_INET, hb_socketResolveAddr<span style="color: #000000;">(</span> ADDRESS <span style="color: #000000;">)</span>, PORT <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> ? <span style="color: #ff0000;">"socket connect error "</span> + hb_ntos<span style="color: #000000;">(</span> hb_socketGetError<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /> <br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span>c1<span style="color: #000000;">)</span><br /><br /> hb_socketSend<span style="color: #000000;">(</span> hSocket,c1 + chr<span style="color: #000000;">(</span><span style="color: #000000;">10</span><span style="color: #000000;">)</span>+chr<span style="color: #000000;">(</span><span style="color: #000000;">13</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span> <br /> <br /> hb_socketShutdown<span style="color: #000000;">(</span> hSocket <span style="color: #000000;">)</span><br /> hb_socketClose<span style="color: #000000;">(</span> hSocket <span style="color: #000000;">)</span><br /> <br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span></div>[/code:1dntjstl]
the message on the screen is correct ,but the printed result is wrong (other idioms ) <!-- s:( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":(" title="Sad" /><!-- s:( --> .
I compared with sockserv.prg (from fwh \ samples folder)
the transmission and reception of the program in FW and a program that correctly prints and analyzes the strings character by character with asc ()
this is the result :
Correct
---------------
214
208
185
250
176
230
With FW error
--------------------
228
184
173
229
155
189
231
137
136
I think you have to use a conversion program. Can someone help me ?
Maurizio |
Convert and print chinese idioms | Dear Maurizio,
I have asked Mr. Rao to review your code as he is our expert in unicode
Lets wait for his comments
many thanks |
Convert and print chinese idioms | FWH supports the most popular UTF8 encoding of Unicode and also uses UTF16BE encoding for communication with Windows OS.
This is a Chinese word with 3 characters is represented by 9 bytes, 228,184,173,229,155,189,231,137,136 when encoded in UTF8 and 6 bytes in UTF16BE, 45,78,253,86,72,114
Unicode UTF8 encoding is not directly accepted by your hardware.
I could not figure out what encoding of Unicode produces the byte stream you found to be working.
Even long before Unicode (1987), East Asian languages like Chinese, Korean, Japanese had their own encoding systems which are still being used in those countries. Examples "Big 5" for Traditional Chinese, "GB2312" for Simplified Chinese, etc.
Without knowing more about the equipment, its manual and api documentation, it is difficult to know what encoding it accepts.
In any case, I like to test UTF8 encoding once again with prefix of BOM (byte order mark). I am not sure it works, but nothing wrong in trying once.
Try to send this byte stream:
[code=fw:2iohp0e8]<div class="fw" id="{CB}" style="font-family: monospace;"><br />Chr<span style="color: #000000;">(</span> <span style="color: #000000;">239</span> <span style="color: #000000;">)</span>+Chr<span style="color: #000000;">(</span> <span style="color: #000000;">187</span><span style="color: #000000;">)</span>+Chr<span style="color: #000000;">(</span> <span style="color: #000000;">191</span> <span style="color: #000000;">)</span>+Chr<span style="color: #000000;">(</span> <span style="color: #000000;">228</span> <span style="color: #000000;">)</span>+Chr<span style="color: #000000;">(</span> <span style="color: #000000;">184</span> <span style="color: #000000;">)</span>+Chr<span style="color: #000000;">(</span> <span style="color: #000000;">173</span> <span style="color: #000000;">)</span>+Chr<span style="color: #000000;">(</span> <span style="color: #000000;">229</span> <span style="color: #000000;">)</span>+Chr<span style="color: #000000;">(</span> <span style="color: #000000;">155</span> <span style="color: #000000;">)</span>+Chr<span style="color: #000000;">(</span> <span style="color: #000000;">189</span> <span style="color: #000000;">)</span>+Chr<span style="color: #000000;">(</span> <span style="color: #000000;">231</span> <span style="color: #000000;">)</span>+Chr<span style="color: #000000;">(</span> <span style="color: #000000;">137</span> <span style="color: #000000;">)</span>+Chr<span style="color: #000000;">(</span> <span style="color: #000000;">136</span> <span style="color: #000000;">)</span>+Chr<span style="color: #000000;">(</span> <span style="color: #000000;">0</span> <span style="color: #000000;">)</span>+Chr<span style="color: #000000;">(</span> <span style="color: #000000;">13</span> <span style="color: #000000;">)</span>+Chr<span style="color: #000000;">(</span> <span style="color: #000000;">10</span> <span style="color: #000000;">)</span><br /> </div>[/code:2iohp0e8] |
Convert and print chinese idioms | Thanks RAO
unfortunately your string doesn't work <!-- s:( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":(" title="Sad" /><!-- s:( -->
Summary :
c1 := '???'
cA := Chr( 239 )+Chr( 187)+Chr( 191 )+Chr( 228 )+Chr( 184 )+Chr( 173 )+Chr( 229 )+Chr( 155 )+Chr( 189 )+Chr( 231 )+Chr( 137 )+Chr( 136 )+Chr( 0 )+Chr( 13 )+Chr( 10 )
cB := Chr( 214 )+Chr( 208)+Chr( 185 )+Chr( 250 )+Chr( 176 )+Chr( 230 )
c1 and cA does not works
cB works
the problem is how transform '???' in Chr( 214 )+Chr( 208)+Chr( 185 )+Chr( 250 )+Chr( 176 )+Chr( 230 )
Regads MAurizio |
Convert code to FWH | Happy Friday Everyone,
Could someone help me convert this code to FWH? I would happy to pay you for your time.
Thank you!
#define AddrPort 0x2e
#define DataPort 0x2f
#define SIO_UnLock_Value 0x87
#define SIO_Lock_Value 0xaa
#define SIO_LDN_GPIO 0x07
#define GPIO_Port 0xF1
// Enter_Config
WriteByte (AddrPort , SIO_UnLock_Value);
WriteByte (AddrPort , SIO_UnLock_Value);
WriteByte (AddrPort , 0x07);
WriteByte (DataPort , SIO_LDN_GPIO);
//Set OUT1~OUT8Value
WriteByte( AddrPort , GPIO_Port);
WriteByte (DataPort , 0x00); //set OUT1~OUT8 value, OUT1=Bit0, OUT2=Bit1
// Read In1~In8 value
WriteByte( AddrPort, 0xED);
Data=ReadByte DataPort ); //Read In1~In8 value
// close config mode
WriteByte( AddrPort , SIO_Lock_Value); |
Convert code to FWH | Dear Darrell,
What C compiler are you using ?
Are you using 32 or 64 bits ? |
Convert code to FWH | Hi Antonio,
Borland |
Convert code to FWH | 32 bits ? |
Convert code to FWH | Hi Antonio,
Yes |
Convert code to FWH | Dear Darrell,
Please download this zip file:
[url:2mzdc32c]https://github.com/starofrainnight/winio/releases/download/3.0/WinIo.zip[/url:2mzdc32c]
And try this initial version:
[code=fw:2mzdc32c]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"dll.ch"</span><br /><br /><span style="color: #00D7D7;">#define</span> AddrPort 0x2e<br /><span style="color: #00D7D7;">#define</span> DataPort 0x2f<br /><span style="color: #00D7D7;">#define</span> SIO_UnLock_Value 0x87<br /><span style="color: #00D7D7;">#define</span> SIO_Lock_Value 0xaa<br /><span style="color: #00D7D7;">#define</span> SIO_LDN_GPIO 0x07<br /><span style="color: #00D7D7;">#define</span> GPIO_Port 0xF1<br /><br /><span style="color: #00C800;">static</span> hDll<br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> <span style="color: #00C800;">Data</span><br /><br /> hDLL = LoadLibrary<span style="color: #000000;">(</span> <span style="color: #ff0000;">"winio.dll"</span> <span style="color: #000000;">)</span><br /><br /> InitializeWinIO<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #B900B9;">// Enter_Config</span><br /> WriteByte <span style="color: #000000;">(</span>AddrPort , SIO_UnLock_Value<span style="color: #000000;">)</span><br /> WriteByte <span style="color: #000000;">(</span>AddrPort , SIO_UnLock_Value<span style="color: #000000;">)</span><br /><br /> WriteByte <span style="color: #000000;">(</span>AddrPort , 0x07<span style="color: #000000;">)</span><br /> WriteByte <span style="color: #000000;">(</span>DataPort , SIO_LDN_GPIO<span style="color: #000000;">)</span><br /><br /> <span style="color: #B900B9;">//Set OUT1~OUT8Value</span><br /> WriteByte<span style="color: #000000;">(</span> AddrPort , GPIO_Port<span style="color: #000000;">)</span><br /> WriteByte <span style="color: #000000;">(</span>DataPort , 0x00<span style="color: #000000;">)</span> <span style="color: #B900B9;">//set OUT1~OUT8 value, OUT1=Bit0, OUT2=Bit1</span><br /><br /> <span style="color: #B900B9;">// Read In1~In8 value</span><br /> WriteByte<span style="color: #000000;">(</span> AddrPort, 0xED<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Data</span>=ReadByte<span style="color: #000000;">(</span> DataPort <span style="color: #000000;">)</span> <span style="color: #B900B9;">//Read In1~In8 value</span><br /><br /> <span style="color: #B900B9;">// close config mode</span><br /> WriteByte<span style="color: #000000;">(</span> AddrPort , SIO_Lock_Value<span style="color: #000000;">)</span><br /><br /> ShutDownWinIo<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> FreeLibrary<span style="color: #000000;">(</span> hDLL <span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"ok"</span> <span style="color: #000000;">)</span> <br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br />DLL <span style="color: #00C800;">FUNCTION</span> InitializeWinIO<span style="color: #000000;">(</span><span style="color: #000000;">)</span> AS BOOL <span style="color: #0000ff;">FROM</span> <span style="color: #ff0000;">"InitializeWinIo"</span> LIB hDLL<br />DLL <span style="color: #00C800;">FUNCTION</span> WriteByte<span style="color: #000000;">(</span> nPort AS _INT, nValue AS _INT <span style="color: #000000;">)</span> AS BOOL <span style="color: #0000ff;">FROM</span> <span style="color: #ff0000;">"SetPortVal"</span> LIB hDLL <br />DLL <span style="color: #00C800;">FUNCTION</span> ReadByte<span style="color: #000000;">(</span> nPort AS _INT <span style="color: #000000;">)</span> AS _INT <span style="color: #0000ff;">FROM</span> <span style="color: #ff0000;">"GetPortVal"</span> LIB hDLL<br />DLL <span style="color: #00C800;">FUNCTION</span> ShutdownWinIo<span style="color: #000000;">(</span><span style="color: #000000;">)</span> AS VOID <span style="color: #0000ff;">FROM</span> <span style="color: #ff0000;">"ShutdownWinIo"</span> LIB hDLL</div>[/code:2mzdc32c] |
Convert code to FWH | This should be the right code:
winio32.dll and winio32.sys should be where your EXE is placed.
ports.prg
[code=fw:hgtu4cwr]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"dll.ch"</span><br /><br /><span style="color: #00D7D7;">#define</span> AddrPort 0x2e<br /><span style="color: #00D7D7;">#define</span> DataPort 0x2f<br /><span style="color: #00D7D7;">#define</span> SIO_UnLock_Value 0x87<br /><span style="color: #00D7D7;">#define</span> SIO_Lock_Value 0xaa<br /><span style="color: #00D7D7;">#define</span> SIO_LDN_GPIO 0x07<br /><span style="color: #00D7D7;">#define</span> GPIO_Port 0xF1<br /><br /><span style="color: #00C800;">static</span> hDll<br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> <span style="color: #00C800;">Data</span><br /><br /> hDLL = LoadLibrary<span style="color: #000000;">(</span> <span style="color: #ff0000;">"winio32.dll"</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> hDLL <span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> InstallWinIoDriver<span style="color: #000000;">(</span> <span style="color: #ff0000;">"WinIo32.sys"</span>, .T. <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> InitializeWinIO<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #B900B9;">// Enter_Config</span><br /> WriteByte <span style="color: #000000;">(</span>AddrPort , SIO_UnLock_Value<span style="color: #000000;">)</span><br /> WriteByte <span style="color: #000000;">(</span>AddrPort , SIO_UnLock_Value<span style="color: #000000;">)</span><br /><br /> WriteByte <span style="color: #000000;">(</span>AddrPort , 0x07<span style="color: #000000;">)</span><br /> WriteByte <span style="color: #000000;">(</span>DataPort , SIO_LDN_GPIO<span style="color: #000000;">)</span><br /><br /> <span style="color: #B900B9;">//Set OUT1~OUT8Value</span><br /> WriteByte<span style="color: #000000;">(</span> AddrPort , GPIO_Port<span style="color: #000000;">)</span><br /> WriteByte <span style="color: #000000;">(</span>DataPort , 0x00<span style="color: #000000;">)</span> <span style="color: #B900B9;">//set OUT1~OUT8 value, OUT1=Bit0, OUT2=Bit1</span><br /><br /> <span style="color: #B900B9;">// Read In1~In8 value</span><br /> WriteByte<span style="color: #000000;">(</span> AddrPort, 0xED<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Data</span>=ReadByte<span style="color: #000000;">(</span> DataPort <span style="color: #000000;">)</span> <span style="color: #B900B9;">//Read In1~In8 value</span><br /><br /> <span style="color: #B900B9;">// close config mode</span><br /> WriteByte<span style="color: #000000;">(</span> AddrPort , SIO_Lock_Value<span style="color: #000000;">)</span><br /><br /> ShutDownWinIo<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> FreeLibrary<span style="color: #000000;">(</span> hDLL <span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"ok"</span> <span style="color: #000000;">)</span> <br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br />DLL <span style="color: #00C800;">FUNCTION</span> InstallWinIoDriver<span style="color: #000000;">(</span> cPath AS LPSTR, lIsDemandLoaded AS BOOL <span style="color: #000000;">)</span> AS BOOL <span style="color: #0000ff;">FROM</span> <span style="color: #ff0000;">"InitializeWinIo"</span> LIB hDLL<br />DLL <span style="color: #00C800;">FUNCTION</span> InitializeWinIO<span style="color: #000000;">(</span><span style="color: #000000;">)</span> AS BOOL <span style="color: #0000ff;">FROM</span> <span style="color: #ff0000;">"InitializeWinIo"</span> LIB hDLL<br />DLL <span style="color: #00C800;">FUNCTION</span> WriteByte<span style="color: #000000;">(</span> nPort AS _INT, nValue AS _INT <span style="color: #000000;">)</span> AS BOOL <span style="color: #0000ff;">FROM</span> <span style="color: #ff0000;">"SetPortVal"</span> LIB hDLL <br />DLL <span style="color: #00C800;">FUNCTION</span> ReadByte<span style="color: #000000;">(</span> nPort AS _INT <span style="color: #000000;">)</span> AS _INT <span style="color: #0000ff;">FROM</span> <span style="color: #ff0000;">"GetPortVal"</span> LIB hDLL<br />DLL <span style="color: #00C800;">FUNCTION</span> ShutdownWinIo<span style="color: #000000;">(</span><span style="color: #000000;">)</span> AS VOID <span style="color: #0000ff;">FROM</span> <span style="color: #ff0000;">"ShutdownWinIo"</span> LIB hDLL</div>[/code:hgtu4cwr] |
Convert code to FWH | Please replace this line:
InitializeWinIO()
with:
MsgInfo( InitializeWinIO() )
to check if the DLL properly initializes |
Convert code to FWH | After running it please check if there is a hb_out.log file |
Convert code to FWH | There is something else to implement, doing it... |
Convert code to FWH | [url:1tf9q0hg]https://github.com/starofrainnight/winio[/url:1tf9q0hg]
These are the right files to use:
[url:1tf9q0hg]https://github.com/starofrainnight/winio/releases/download/3.0/WinIo.zip[/url:1tf9q0hg] |
Convert code to FWH | A brief explanation:
A Windows app can't directly manage the ports for security reasons, it must use a driver.
WinIO32.sys is the driver and WinIO32.DLL is the DLL to manage such driver
This WinIO was developed by <!-- m --><a class="postlink" href="http://www.sysinternals.com">http://www.sysinternals.com</a><!-- m --> but lately was bought by Microsoft and they dropped it.
Thats why this free github repo has implemented it: [url:1n0ul8y8]https://github.com/starofrainnight/winio[/url:1n0ul8y8] |
Convert code to FWH | Hello Antonio,
Thank you so much! Initially we are looking to read certain values to determine status of a device, simply 0 or 1 (on or off).
Thank you again! |
Convert code to FWH | hi,
i like to know what Hardware do you use with this CODE <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: --> |
Convert code to FWH | Hi Jimmy,
Nuvoton NCT6106D. We are looking to get status from specific pin, either on (1) or off (0). |
Convert code to FWH | hi,
[quote="cdmmaui":1ei9ixo3]Nuvoton NCT6106D.[/quote:1ei9ixo3]
interesting, thx |
Convert date string based on regional setting | A function will received a date in string format.
The string will be the date represented in a format that follows short date format in windows regional settting.
Has someone already written a function to convert such a date string into [x]Harbour's date?
TIA |
Convert date string based on regional setting | Never mind. [url=http://forums.fivetechsupport.com/viewtopic.php?f=3&t=25710:33px8sdq]Jeff's post[/url:33px8sdq] had helped |
Convert dbf to Xsd | Good morning
Is there a class that allows to convert data to xsd format ?
If anyone has a sample to share,
Thank you
Richard |
Convert dbf to Xsd | can you post a sample of this file type please |
Convert dbf to Xsd | An XSD file doesn't contain data but rather the format of the data. You could possibly create an XSD file from the structure of a DBF if that is what you are looking for.
The data would be in an XML file and the data format in an XSD file.
For more info see:
[url:1bltvk43]http://www.w3schools.com/schema/schema_example.asp[/url:1bltvk43]
I have never worked with XSD files, so I can't offer any practical experiences.
Regards,
James |
Convert dbf to Xsd | James
I did not mean data (my mistake) but structure, i wondered if there was a utility.
It is ok i generated the xsd file , it was urgent for me.
The xml file was adapted accordingly.
Regards
Richard |
Convert dbf to Xsd | <!-- m --><a class="postlink" href="http://www.superdownloads.com.br/download/53/dbf-to-xml-converter/">http://www.superdownloads.com.br/downlo ... converter/</a><!-- m --> |
Convert dbf to Xsd | Richard,
Hi. I think it wouldn't be too complicated to create any xsd from a dbf structure using TXmlDocument() class. It will allow you to create just about any indented style tagged document. Take a look at TXmldocument() and TxmlNode() classes from the xharbour documentation. On one of the samples, they show how to export a .dbf structure to xml -and I don't think it would take much of a stretch to write xsd compatible document instead.
Reinaldo. |
Convert doc or xls file to PDF in batch mode | Thanks,
I 'll try it . |
Convert doc or xls file to PDF in batch mode | I want to convert xls or doc files to pdf with command line .(winexec convert.exe test.doc test.pdf)
I do not nead any dialog box asking to confirm the destination file .
Any idea .
Thanks |
Convert doc or xls file to PDF in batch mode | Hello Jack,
have a look at this link :
<!-- m --><a class="postlink" href="http://www.pdfpdf.com/batch.html">http://www.pdfpdf.com/batch.html</a><!-- m -->
A free converter for Word to Pdf ( with Batch-use )
<!-- m --><a class="postlink" href="http://www.softpedia.com/get/Office-tools/PDF/Free-Quick-Word-to-Pdf-Converter.shtml">http://www.softpedia.com/get/Office-too ... rter.shtml</a><!-- m -->
Regards
Uwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: --> |
Convert file to UTF16 | Thanks for your reply
hb_translate( cText, cPageOrigin, "UTF16LE" )
cPageOrigin - this is the source file encoding ? |
Convert file to UTF16 | [url:1eqt6gih]http://forums.fivetechsupport.com/viewtopic.php?f=3&t=36402[/url:1eqt6gih] |
Convert file to UTF16 | There is a file in ANSI. I need to convert it to UTF16. How can I do this ? |
Convert file to UTF16 | cPageOrigin is the coding of the source file. I use "cp850" |
Convert from Delphi code to xHarbour+FWH? | Dear All,
I have a job to make a KeyCard interface program with my application. The KeyCard provider give me a sample to write the card in Delphi 6. Then I have to convert Delphi6 to xHarbour+FWH. The sample is in below.
Could anyone give me a guide to convert it.
Thank you in advance for any help and idea.
[code=fw:2zd5o69f]<div class="fw" id="{CB}" style="font-family: monospace;">unit Unit1;<br /><br /><span style="color: #00C800;">interface</span><br /><br />uses<br /> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br /> <span style="color: #0000ff;">Dialogs</span>, StdCtrls, ExtCtrls, OleServer, HOTELREADERLib_TLB, ComCtrls;<br /><br />type<br /> TForm1 = <span style="color: #00C800;">class</span><span style="color: #000000;">(</span>TForm<span style="color: #000000;">)</span><br /> Card1: <span style="color: #000000;">TCard</span>;<br /> Panel1: <span style="color: #000000;">TPanel</span>;<br /> GetNewAuth: <span style="color: #000000;">TButton</span>;<br /> CheckLink: <span style="color: #000000;">TButton</span>;<br /> IssueCard: <span style="color: #000000;">TButton</span>;<br /> ReadCard: <span style="color: #000000;">TButton</span>;<br /> CardAuthCode: <span style="color: #000000;">TButton</span>;<br /> CancelCard: <span style="color: #000000;">TButton</span>;<br /> DownData: <span style="color: #000000;">TButton</span>;<br /> Button10: <span style="color: #000000;">TButton</span>;<br /> sd: <span style="color: #000000;">TPanel</span>;<br /> LabeledEdit2: <span style="color: #000000;">TLabeledEdit</span>;<br /> Panel3: <span style="color: #000000;">TPanel</span>;<br /> LabMsg: <span style="color: #000000;">TLabel</span>;<br /> Combo_CardType: <span style="color: #000000;">TComboBox</span>;<br /> Label1: <span style="color: #000000;">TLabel</span>;<br /> Combo_LockType: <span style="color: #000000;">TComboBox</span>;<br /> LockType: <span style="color: #000000;">TLabel</span>;<br /> Combo_Bld: <span style="color: #000000;">TComboBox</span>;<br /> Combo_Floor: <span style="color: #000000;">TComboBox</span>;<br /> Combo_Room: <span style="color: #000000;">TComboBox</span>;<br /> Combo_Clean: <span style="color: #000000;">TComboBox</span>;<br /> Combo_SubRoom: <span style="color: #000000;">TComboBox</span>;<br /> Label2: <span style="color: #000000;">TLabel</span>;<br /> Label3: <span style="color: #000000;">TLabel</span>;<br /> Label4: <span style="color: #000000;">TLabel</span>;<br /> Label5: <span style="color: #000000;">TLabel</span>;<br /> Label6: <span style="color: #000000;">TLabel</span>;<br /> Label7: <span style="color: #000000;">TLabel</span>;<br /> Label8: <span style="color: #000000;">TLabel</span>;<br /> Label9: <span style="color: #000000;">TLabel</span>;<br /> Ed_BgDt: <span style="color: #000000;">TEdit</span>;<br /> Ed_CardKey: <span style="color: #000000;">TEdit</span>;<br /> Ed_EdDt: <span style="color: #000000;">TEdit</span>;<br /> Memo1: <span style="color: #000000;">TMemo</span>;<br /> Label10: <span style="color: #000000;">TLabel</span>;<br /> ProgressBar1: <span style="color: #000000;">TProgressBar</span>;<br /> procedure FormCreate<span style="color: #000000;">(</span>Sender: <span style="color: #000000;">TObject</span><span style="color: #000000;">)</span>;<br /> procedure GetNewAuthClick<span style="color: #000000;">(</span>Sender: <span style="color: #000000;">TObject</span><span style="color: #000000;">)</span>;<br /> procedure CheckLinkClick<span style="color: #000000;">(</span>Sender: <span style="color: #000000;">TObject</span><span style="color: #000000;">)</span>;<br /> procedure Button10Click<span style="color: #000000;">(</span>Sender: <span style="color: #000000;">TObject</span><span style="color: #000000;">)</span>;<br /> procedure FormDestroy<span style="color: #000000;">(</span>Sender: <span style="color: #000000;">TObject</span><span style="color: #000000;">)</span>;<br /> procedure FormClose<span style="color: #000000;">(</span>Sender: <span style="color: #000000;">TObject</span>; <span style="color: #0000ff;">var</span> <span style="color: #0000ff;">Action</span>: <span style="color: #000000;">TCloseAction</span><span style="color: #000000;">)</span>;<br /> procedure CardAuthCodeClick<span style="color: #000000;">(</span>Sender: <span style="color: #000000;">TObject</span><span style="color: #000000;">)</span>;<br /> procedure IssueCardClick<span style="color: #000000;">(</span>Sender: <span style="color: #000000;">TObject</span><span style="color: #000000;">)</span>;<br /> procedure CancelCardClick<span style="color: #000000;">(</span>Sender: <span style="color: #000000;">TObject</span><span style="color: #000000;">)</span>;<br /> procedure ReadCardClick<span style="color: #000000;">(</span>Sender: <span style="color: #000000;">TObject</span><span style="color: #000000;">)</span>;<br /> procedure DownDataClick<span style="color: #000000;">(</span>Sender: <span style="color: #000000;">TObject</span><span style="color: #000000;">)</span>;<br /> procedure Memo1DblClick<span style="color: #000000;">(</span>Sender: <span style="color: #000000;">TObject</span><span style="color: #000000;">)</span>;<br /> procedure Memo1Click<span style="color: #000000;">(</span>Sender: <span style="color: #000000;">TObject</span><span style="color: #000000;">)</span>;<br /> <span style="color: #00C800;">private</span><br /> x : <span style="color: #000000;">TCard</span>;<br /> p_AuthCode: <span style="color: #000000;">string</span>;<br /> <span style="color: #00C800;">public</span><br /> <span style="color: #000000;">{</span> <span style="color: #00C800;">Public</span> declarations <span style="color: #000000;">}</span><br /> end;<br /><br /><span style="color: #0000ff;">var</span><br /> Form1: <span style="color: #000000;">TForm1</span>;<br /><br />implementation<br /><br /><span style="color: #000000;">{</span>$R *.dfm<span style="color: #000000;">}</span><br /><br /><span style="color: #000000;">{</span><br /> AuthCard <span style="color: #000000;">1</span> Authorization Card<br /> ClockCard <span style="color: #000000;">2</span> Clock <span style="color: #0000ff;">Setting</span> Card<br /> DataCard <span style="color: #000000;">3</span> Reserved <span style="color: #00C800;">for</span> Palmsize <span style="color: #00C800;">Data</span> Collector<br /> SetCard <span style="color: #000000;">4</span> Programming Card<br /> DisableCard <span style="color: #000000;">5</span> Disable Card<br /> CheckoutCard <span style="color: #000000;">6</span> Check Out Card<br /> EmergencyCard <span style="color: #000000;">7</span> Emergency Card<br /> ControlCard <span style="color: #000000;">8</span> Control Card<br /> BuildingCard <span style="color: #000000;">9</span> Building Card<br /> FloorCard <span style="color: #000000;">10</span> Floor Card<br /> GuestCard <span style="color: #000000;">11</span> Room Card<br /> CleaningCard <span style="color: #000000;">12</span> Area Card<br /> MaintainCard <span style="color: #000000;">13</span> Maintenance Card<br /> MeetingCard <span style="color: #000000;">14</span> Office Card<br /> MechanicalKey <span style="color: #000000;">15</span> Mechanical Key<br /><span style="color: #000000;">}</span><br /><br />procedure TForm1.FormDestroy<span style="color: #000000;">(</span>Sender: <span style="color: #000000;">TObject</span><span style="color: #000000;">)</span>;<br />begin<br /> Form1 := <span style="color: #00C800;">nil</span>;<br />end;<br /><br />procedure TForm1.FormClose<span style="color: #000000;">(</span>Sender: <span style="color: #000000;">TObject</span>; <span style="color: #0000ff;">var</span> <span style="color: #0000ff;">Action</span>: <span style="color: #000000;">TCloseAction</span><span style="color: #000000;">)</span>;<br />begin<br /> <span style="color: #0000ff;">Action</span> :=caFree;<br />end;<br /><br />procedure TForm1.Button10Click<span style="color: #000000;">(</span>Sender: <span style="color: #000000;">TObject</span><span style="color: #000000;">)</span>;<br />begin<br /> Close;<br />end;<br /><br />procedure TForm1.FormCreate<span style="color: #000000;">(</span>Sender: <span style="color: #000000;">TObject</span><span style="color: #000000;">)</span>;<br />begin<br /> x := TCard.Create<span style="color: #000000;">(</span><span style="color: #00C800;">Self</span><span style="color: #000000;">)</span>;<br /> x.LockType := <span style="color: #000000;">3</span>;<br /> x.LockSubType := <span style="color: #000000;">1</span>;<br /> x.ToCollector := <span style="color: #00C800;">False</span>;<br />end;<br /><br />procedure TForm1.GetNewAuthClick<span style="color: #000000;">(</span>Sender: <span style="color: #000000;">TObject</span><span style="color: #000000;">)</span>;<br />begin<br /><span style="color: #B900B9;">// x.LockType := StrToInt(Copy(Combo_LockType.Text,1,1));</span><br /> LabeledEdit2.<span style="color: #0000ff;">Text</span> := x.NewAuthorizationCode;<br /> <span style="color: #B900B9;">// x.AuthorizationCode := '82E9126726210EB4'; // LabeledEdit2.Text;</span><br />end;<br /><br />procedure TForm1.CheckLinkClick<span style="color: #000000;">(</span>Sender: <span style="color: #000000;">TObject</span><span style="color: #000000;">)</span>;<br />begin<br /> LabMsg.Caption := <span style="color: #ff0000;">''</span>; <br /> <span style="color: #00C800;">if</span> x.LinkOk then<br /> LabMsg.Caption := <span style="color: #ff0000;">'Check Link is : OK'</span><br /> <span style="color: #00C800;">else</span> LabMsg.Caption := <span style="color: #ff0000;">'Check Link is : Failed'</span>;<br />end;<br /><br />procedure TForm1.CardAuthCodeClick<span style="color: #000000;">(</span>Sender: <span style="color: #000000;">TObject</span><span style="color: #000000;">)</span>;<br />begin<br /> p_AuthCode := x.CardAuthCode;<br /> LabMsg.Caption := <span style="color: #ff0000;">'Current AuthCode is : '</span> + p_AuthCode;<br /> GetNewAuth.Enabled := <span style="color: #00C800;">True</span>;<br /> CheckLink.Enabled := <span style="color: #00C800;">True</span>;<br /> IssueCard.Enabled := <span style="color: #00C800;">True</span>;<br /> ReadCard.Enabled := <span style="color: #00C800;">True</span>;<br /> CancelCard.Enabled := <span style="color: #00C800;">True</span>;<br /> DownData.Enabled := <span style="color: #00C800;">True</span>;<br />end;<br /><br />procedure TForm1.IssueCardClick<span style="color: #000000;">(</span>Sender: <span style="color: #000000;">TObject</span><span style="color: #000000;">)</span>;<br />begin<br /> LabMsg.Caption := <span style="color: #ff0000;">''</span>;<br /> x.AuthorizationCode := p_AuthCode;<br /><br /> x.CardType := StrToInt<span style="color: #000000;">(</span>Copy<span style="color: #000000;">(</span>Combo_CardType.<span style="color: #0000ff;">Text</span>,<span style="color: #000000;">1</span>,<span style="color: #000000;">2</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span>;<br /> x.building := StrToInt<span style="color: #000000;">(</span>Copy<span style="color: #000000;">(</span>Combo_Bld.<span style="color: #0000ff;">Text</span>,<span style="color: #000000;">1</span>,<span style="color: #000000;">2</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span>;<br /> x.Floor := StrToInt<span style="color: #000000;">(</span>Copy<span style="color: #000000;">(</span>Combo_Floor.<span style="color: #0000ff;">Text</span>,<span style="color: #000000;">1</span>,<span style="color: #000000;">2</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span>;<br /> x.Room := StrToInt<span style="color: #000000;">(</span>Copy<span style="color: #000000;">(</span>Combo_Room.<span style="color: #0000ff;">Text</span>,<span style="color: #000000;">1</span>,<span style="color: #000000;">2</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span>;<br /> x.cleaning := StrToInt<span style="color: #000000;">(</span>Copy<span style="color: #000000;">(</span>Combo_Clean.<span style="color: #0000ff;">Text</span>,<span style="color: #000000;">1</span>,<span style="color: #000000;">2</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span>;<br /> x.SubRoom := StrToInt<span style="color: #000000;">(</span>Copy<span style="color: #000000;">(</span>Combo_SubRoom.<span style="color: #0000ff;">Text</span>,<span style="color: #000000;">1</span>,<span style="color: #000000;">2</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span>;<br /><br /> x.CardKey := StrToDateTime<span style="color: #000000;">(</span>Ed_CardKey.<span style="color: #0000ff;">Text</span><span style="color: #000000;">)</span>;<br /><br /> x.startDate := StrToDateTime<span style="color: #000000;">(</span>Ed_BgDt.<span style="color: #0000ff;">Text</span><span style="color: #000000;">)</span>;<br /> x.expireDate := StrToDateTime<span style="color: #000000;">(</span>Ed_EdDt.<span style="color: #0000ff;">Text</span><span style="color: #000000;">)</span>;<br /> <span style="color: #00C800;">try</span><br /> x.IssueCard;<br /> showmessage<span style="color: #000000;">(</span><span style="color: #ff0000;">'OK'</span><span style="color: #000000;">)</span>;<br /> except<br /> showmessage<span style="color: #000000;">(</span><span style="color: #ff0000;">'Error'</span><span style="color: #000000;">)</span>;<br /> end;<br />end;<br /><br />procedure TForm1.CancelCardClick<span style="color: #000000;">(</span>Sender: <span style="color: #000000;">TObject</span><span style="color: #000000;">)</span>;<br />begin<br /> x.AuthorizationCode := p_AuthCode;<br /> x.CancelCard;<br /> LabMsg.Caption := <span style="color: #ff0000;">''</span>;<br />end;<br /><br />procedure TForm1.ReadCardClick<span style="color: #000000;">(</span>Sender: <span style="color: #000000;">TObject</span><span style="color: #000000;">)</span>;<br /><span style="color: #0000ff;">var</span><br /> cardType,cardSnr,cardKey,startDate,expireDate,<br /> building,floor,room,cleaning,SubRoom : <span style="color: #000000;">string</span>;<br />begin<br /> LabMsg.Caption := <span style="color: #ff0000;">''</span>;<br /> x.AuthorizationCode := p_AuthCode;<br /><br /> x.startDate := Now;<br /> x.expireDate := Now;<br /> <span style="color: #00C800;">try</span><br /> x.ReadCard;<br /> except<br /> <span style="color: #0000ff;">on</span> Exception <span style="color: #00C800;">do</span><br /> Exit;<br /> end;<br /><br /> cardType := IntToStr<span style="color: #000000;">(</span>x.CardType<span style="color: #000000;">)</span>;<br /> cardSnr := IntToStr<span style="color: #000000;">(</span>x.CardSnr<span style="color: #000000;">)</span>;<br /> cardKey := FormatDateTime<span style="color: #000000;">(</span><span style="color: #ff0000;">'yyyy-MM-dd hh:mm:ss'</span>,x.cardKey<span style="color: #000000;">)</span>;<br /> startDate := FormatDateTime<span style="color: #000000;">(</span><span style="color: #ff0000;">'yyyy-MM-dd hh:mm'</span>,x.StartDate<span style="color: #000000;">)</span>;<br /> expireDate := FormatDateTime<span style="color: #000000;">(</span><span style="color: #ff0000;">'yyyy-MM-dd hh:mm'</span>,x.ExpireDate<span style="color: #000000;">)</span>;<br /> building := IntToStr<span style="color: #000000;">(</span>x.Building<span style="color: #000000;">)</span>;<br /> floor := IntToStr<span style="color: #000000;">(</span>x.Floor<span style="color: #000000;">)</span>;<br /> room := IntToStr<span style="color: #000000;">(</span>x.Room<span style="color: #000000;">)</span>;<br /> cleaning := IntToStr<span style="color: #000000;">(</span>x.cleaning<span style="color: #000000;">)</span>;<br /> SubRoom := IntToStr<span style="color: #000000;">(</span>x.SubRoom<span style="color: #000000;">)</span>;<br /><br /> LabMsg.Caption := <span style="color: #ff0000;">'cardType: '</span> + cardType +<span style="color: #ff0000;">' ; '</span> +<br /> <span style="color: #ff0000;">'cardSnr: '</span> + cardSnr+<span style="color: #ff0000;">' ; '</span>+<br /><br /> <span style="color: #ff0000;">'cardKey: '</span> + cardKey+<span style="color: #ff0000;">' ; '</span>+ #<span style="color: #000000;">13</span> +<br /> <span style="color: #ff0000;">'startDate: '</span> + startDate+<span style="color: #ff0000;">' ; '</span>+<br /> <span style="color: #ff0000;">'expireDate: '</span> + expireDate+<span style="color: #ff0000;">' ; '</span>+ #<span style="color: #000000;">13</span> +<br /><br /> <span style="color: #ff0000;">'building: '</span> + building+<span style="color: #ff0000;">' ; '</span>+<br /> <span style="color: #ff0000;">'floor: '</span> + floor+<span style="color: #ff0000;">' ; '</span>+<br /> <span style="color: #ff0000;">'room: '</span> + room+<span style="color: #ff0000;">' ; '</span>+<br /> <span style="color: #ff0000;">'cleaning: '</span> + cleaning+<span style="color: #ff0000;">' ; '</span>+<br /> <span style="color: #ff0000;">'SubRoom: '</span> + SubRoom;<br /><br /> Combo_Bld.<span style="color: #0000ff;">Text</span> := building;<br /> Combo_Floor.<span style="color: #0000ff;">Text</span> := floor;<br /> Combo_Room.<span style="color: #0000ff;">Text</span> := room;<br /> Combo_Clean.<span style="color: #0000ff;">Text</span> := cleaning;<br /> Combo_SubRoom.<span style="color: #0000ff;">Text</span> := SubRoom;<br /> Ed_CardKey.<span style="color: #0000ff;">Text</span> := cardKey;<br /> Ed_BgDt.<span style="color: #0000ff;">Text</span> := startDate;<br /> Ed_EdDt.<span style="color: #0000ff;">Text</span> := expireDate;<br />end;<br /><br />procedure TForm1.DownDataClick<span style="color: #000000;">(</span>Sender: <span style="color: #000000;">TObject</span><span style="color: #000000;">)</span>;<br /><span style="color: #0000ff;">var</span><br /> s : <span style="color: #000000;">string</span>;<br /> i,j : <span style="color: #000000;">integer</span>;<br />begin<br /> s := <span style="color: #ff0000;">''</span>;<br /><br /> ProgressBar1.Visible := <span style="color: #00C800;">True</span>;<br /> ProgressBar1.Position := <span style="color: #000000;">65</span>;<br /><br /> x.ReadEvent;<br /> j := x.LockEvent.<span style="color: #0000ff;">Count</span>;<br /><br /> Memo1.Clear;<br /> ProgressBar1.<span style="color: #0000ff;">Max</span> := j;<br /> <span style="color: #00C800;">for</span> i := <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> j <span style="color: #00C800;">do</span><br /> begin<br /> s := <span style="color: #ff0000;">''</span>;<br /> ProgressBar1.Position := i;<br /> s := IntToStr<span style="color: #000000;">(</span>x.LockEvent.Item<span style="color: #000000;">[</span>i<span style="color: #000000;">]</span>.cardType<span style="color: #000000;">)</span>;<br /> <span style="color: #00C800;">if</span> Length<span style="color: #000000;">(</span>s<span style="color: #000000;">)</span> < <span style="color: #000000;">2</span> then<br /> s := <span style="color: #ff0000;">'0'</span> + s;<br /> s := s + <span style="color: #ff0000;">' '</span> + IntToStr<span style="color: #000000;">(</span>x.LockEvent.Item<span style="color: #000000;">[</span>i<span style="color: #000000;">]</span>.cardSnr<span style="color: #000000;">)</span>;<br /> s := s + <span style="color: #ff0000;">' '</span> + FormatDateTime<span style="color: #000000;">(</span><span style="color: #ff0000;">'yyyy-MM-dd HH:mm:ss'</span>,x.LockEvent.Item<span style="color: #000000;">[</span>i<span style="color: #000000;">]</span>.UnlockTime<span style="color: #000000;">)</span>;<br /> Memo1.Lines.Add<span style="color: #000000;">(</span>s<span style="color: #000000;">)</span>;<br /> Application.ProcessMessages;<br /> end;<br /> <br /> ProgressBar1.Visible := <span style="color: #00C800;">False</span>;<br />end;<br /><br />procedure TForm1.Memo1DblClick<span style="color: #000000;">(</span>Sender: <span style="color: #000000;">TObject</span><span style="color: #000000;">)</span>;<br />begin<br /> Memo1.Clear;<br />end;<br /><br />procedure TForm1.Memo1Click<span style="color: #000000;">(</span>Sender: <span style="color: #000000;">TObject</span><span style="color: #000000;">)</span>;<br />begin<br /> LabMsg.Caption := <span style="color: #ff0000;">'Download Locking Records: '</span> + IntToStr<span style="color: #000000;">(</span>Memo1.Lines.<span style="color: #0000ff;">Count</span><span style="color: #000000;">)</span>;<br />end;<br /><br />end.</div>[/code:2zd5o69f] |
Convert from Excel 2007 to dbase (DBF) | Hallo, I have a file excel (from excel 2007) and I want to conver to .DBF !
By Excel 2003 there is the option "Save in Dbase", but in Excel 2007 there is'nt that options!
Can anyone help me please? |
Convert from Excel 2007 to dbase (DBF) | I don't have Excel 2007 to test but it can probably convert to a format that xBase can convert from such as comma delimited or sdf. (Check the APPEND FROM command)
xProgrammer |
Convert from Excel 2007 to dbase (DBF) | Here is a code snipit I use.. I do not know if it will work on XLSx
Rick Lipkin
SC Dept of Health, USA
//------------------------------
cPATH := "C:\TEMP\MYFILE.XLS"
DO WHILE .T.
SITEDBF := "TEMP"+(SUBSTR(TIME(),7,2)+SUBSTR(TIME(),4,2))+".DBF"
IF .not. FILE( xVOL+"\DBTMP\"+SITEDBF )
EXIT
ENDIF
ENDDO
DBF_STRU := { }
AADD( DBF_STRU, { "SSN", "C", 11, 0 } )
AADD( DBF_STRU, { "NAME", "C", 30, 0 } )
AADD( DBF_STRU, { "ACT_TYPE", "C", 1, 0 } )
AADD( DBF_STRU, { "EMP_STAT", "C", 1, 0 } )
AADD( DBF_STRU, { "TOFROM", "C", 4, 0 } )
AADD( DBF_STRU, { "COSTCTR", "C", 6, 0 } )
AADD( DBF_STRU, { "FUND", "C", 6, 0 } )
AADD( DBF_STRU, { "RATE", "N", 10, 2 } )
AADD( DBF_STRU, { "SEMI", "N", 10, 2 } )
AADD( DBF_STRU, { "FY", "C", 4, 2 } )
AADD( DBF_STRU, { "COMMENTS", "C", 50, 0 } )
AADD( DBF_STRU, { "APPROVAL", "C", 1, 0 } )
AADD( DBF_STRU, { "SALARY", "N", 7, 0 } )
AADD( DBF_STRU, { "P0701", "C", 1, 0 } )
AADD( DBF_STRU, { "P0716", "C", 1, 0 } )
AADD( DBF_STRU, { "P0801", "C", 1, 0 } )
AADD( DBF_STRU, { "P0816", "C", 1, 0 } )
AADD( DBF_STRU, { "P0901", "C", 1, 0 } )
AADD( DBF_STRU, { "P0916", "C", 1, 0 } )
AADD( DBF_STRU, { "P1001", "C", 1, 0 } )
AADD( DBF_STRU, { "P1016", "C", 1, 0 } )
AADD( DBF_STRU, { "P1101", "C", 1, 0 } )
AADD( DBF_STRU, { "P1116", "C", 1, 0 } )
AADD( DBF_STRU, { "P1201", "C", 1, 0 } )
AADD( DBF_STRU, { "P1216", "C", 1, 0 } )
AADD( DBF_STRU, { "P0101", "C", 1, 0 } )
AADD( DBF_STRU, { "P0116", "C", 1, 0 } )
AADD( DBF_STRU, { "P0201", "C", 1, 0 } )
AADD( DBF_STRU, { "P0216", "C", 1, 0 } )
AADD( DBF_STRU, { "P0301", "C", 1, 0 } )
AADD( DBF_STRU, { "P0316", "C", 1, 0 } )
AADD( DBF_STRU, { "P0401", "C", 1, 0 } )
AADD( DBF_STRU, { "P0416", "C", 1, 0 } )
AADD( DBF_STRU, { "P0501", "C", 1, 0 } )
AADD( DBF_STRU, { "P0516", "C", 1, 0 } )
AADD( DBF_STRU, { "P0601", "C", 1, 0 } )
AADD( DBF_STRU, { "P0616", "C", 1, 0 } )
DBCREATE( xVOL+"\DBTMP\"+SITEDBF, DBF_STRU )
SELECT 9
IF NETUSE( xVOL+"\DBTMP\"+SITEDBF, .T.,5)
ELSE
SELECT( GOBACK )
_Cleanup()
RETURN(.F.)
ENDIF
nREC := 0
cSAY := "Opening Excel File "+STR(nREC)
oSAY:ReFresh()
SysReFresh()
oEXCEL := TOleAuto():New( "Excel.Application" )
oExcel:Workbooks:Open( cPATH )
oBook := oExcel:Get( "ActiveSheet" )
nROWS := oBook:UsedRange:Rows:Count()
nCOLS := oBook:UsedRange:Columns:Count()
SELECT 9
FOR nROW := 3 to nROWS
APPEND BLANK
FOR nCOL := 1 to nCOLS
xVALUE := oBook:Cells( nROW, nCOL):Value
FieldPut( nCol,xValue )
nREC++
cSAY := "Opening Excel File "+STR(nREC)
oSAY:ReFresh()
SysReFresh()
NEXT
NEXT
SELECT 9
dbCommit() |
Convert from Excel 2007 to dbase (DBF) | The problem might be a Microsoft Security Update. We use a number of formats in Excel and all at once people could not open or save in .dbf, .xml and others. There are registry settings that can be added to allow more file extensions.
I have a .reg file for 2003 but you might be able to use it as an example. |
Convert from Excel 2007 to dbase (DBF) | In the online help of Office 2007 dBase is not mentioned anymore.
Maybe it is not supported.
Regards,
Otto |
Convert from Excel 2007 to dbase (DBF) | Hi all
> Maybe it is not supported.
In which case the question becomes what external formats does it support, and which of them is easiest to transform into xBase, sdf and comma delimited being the first two you would look for. xml format would be OK but would require programming.
The alternative is Rick's approach and access the data directly from Excel.
All this presupposes that Excel 2007 can't save in Excel 2003 format and then use Excel 2003 to do the conversion. Has anyone looked into that?
Regards
xProgrammer |
Convert from Excel 2007 to dbase (DBF) | That’s the way I do it. But you need both versions of Office and it is time consuming.
I have to go to another PC.
In the doc’s - help file -I read that if you don’t find your file format you should consulate 3rd party companies. <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: -->
Regards,
Otto |
Convert from Excel 2007 to dbase (DBF) | Check out this link
[url:eur7xtn0]http://office.microsoft.com/en-us/excel/HP100141031033.aspx#DatabaseFormats[/url:eur7xtn0]
****** Other formats you can open but not save *******
Format Extension Description
DBF 3, DBF 4 .dbf dBase III and IV. You can open these files formats in Excel, but you cannot save an Excel file to dBase format.
Quattro Pro 5.0 (Win) .wb1 Quattro Pro version 5.0 for Windows. You can open Quattro Pro files in Excel by using a converter. You cannot save an Excel file to Quattro Pro format.
Quattro Pro 7.0 (Win) .wb3 Quattro Pro version 7.0 for Windows. You can open Quattro Pro files in Excel by using a converter. You cannot save an Excel file to Quattro Pro format.
*** File formats that are not supported in Excel
The following file formats are no longer supported in Office Excel 2007. You cannot open or save files in these file formats.
Format Extension Clipboard type identifiers
Excel Chart .xlc Excel 2.0, 3.0, and 2.x file formats
WK1, FMT, WK2, WK3, FM3, WK4 .wk1, .wk2, .wk3, .wk4, .wks Lotus 1-2-3 file formats (all versions)
Microsoft Works .wks Microsoft Works file format (all versions)
WQ1 .wq1 Quatro Pro for MS-DOS file format
DBF 2 .dbf DBASE II file format
Tips for file formats that are not supported by Excel
If a file format that you want to use is not supported in Excel, you can try the following:
Search the World Wide Web (WWW) for a company that makes file format converters for file formats that are not supported in Excel.
Save to a file format that another program supports. For example, you may want to import your spreadsheet into another program that does not support the Excel file format. But the other program may be able to import another supported file format, such as an XML spreadsheet or a text file format. In this case, you can save your workbook to the XML spreadsheet format, and then from the other program, import the XML file. |
Convert from Excel 2007 to dbase (DBF) | Hi all
> *** File formats that are not supported in Excel
They don't even support their own old file formats!!! (And people keep on buying software from these sharks! Why?)
There's a lesson there, I believe, but people seem reluctant to learn from it. Storing data in proprietary binary formats is not good practice.
I just looked at OpenOffice (free, runs on Windows and a real OS - Linux) and it will save in dBase (xBase) format. And it will open Excel spreadsheets. There's a ready made solution.
Regards
xProgrammer |
Convert from Excel 2007 to dbase (DBF) | Another thought about OpenOffice.org...
* It is a freely distributable open-source alternative to MS Office that is fully compatible with Office files.
* We can distribute it gratis to all of our customers. We are even allowed to charge for providing our own support/addons.
Take a look at: http:\\www.openoffice.org
So if you want to make your own Declaration of Independence, here is your chance. |
Convert hb_parc() in LPTSTR | Hello ,I have to pass a string (Ex: "Hello Word") to a C function .This is the C function HB_FUNC( PRINTLINE )} LPTSTR lpStr; lpStr=_T("Hello World");}Is it possible convert hb_parc(1) in the variable lpStr ? Thank Maurizio |
Convert hb_parc() in LPTSTR | Maurizio,If it is a string to be used from the Pocket PC, keep in mind that the Pocket PC uses unicode, so you you have to convert it from "ansi" to "wide":[code:jltuppgo]
LPWSTR AnsiToWide( LPSTR );
HB_FUNC( PRINTLINE )
{
LPWSTR pW = AnsiToWide( hb_parc( 1 ) );
... use pW ...
hb_xfree( pW ); // free the allocated memory
}
[/code:jltuppgo] |
Convert hb_parc() in LPTSTR | Antonio , Yes I use for FWPPC This is a sample , PRINT_1 works PRINT_2 no Regards Maurizio [code:20u8bbss]#include "FWCE.ch"
function Main()
Print_1()
Print_2("Test")
return nil
#pragma BEGINDUMP
#include <hbapi.h>
#include <windows.h>
#include <commdlg.h>
#include "PrintDC.h"
HB_FUNC( PRINT_1 )
{
HDC hPrDC2;
hPrDC2=PDC_GetPrinterDC() ;
LPTSTR pW ;
pW =_T("Hello World");
PDC_ExtTextOut(hPrDC2,100,100, 0, NULL, pW, _tcslen(pW), NULL);
}
LPWSTR AnsiToWide( LPSTR );
HB_FUNC( PRINT_2 )
{
HDC hPrDC2;
hPrDC2=PDC_GetPrinterDC() ;
LPWSTR pW = AnsiToWide( hb_parc( 1 ) );
PDC_ExtTextOut(hPrDC2,100,100, 0, NULL, pW, _tcslen(pW), NULL);
hb_xfree( pW ); // free the allocated memory
}
[/code:20u8bbss] |
Convert hb_parc() in LPTSTR | Maurizio,You are not releasing the printer DC. If you test it this way, probably PRINT_1 will not work:[code:3nqyljyf]
#include "FWCE.ch"
function Main()
Print_2("Test")
Print_1()
return nil
[/code:3nqyljyf]Look for a PDC_ReleasePrinterDC( hPrDC2 ) or similar.Everytime a DC is created, then it has to be released, when you are finished with it. |
Convert hb_parc() in LPTSTR | Antonio ,The problem was in the conversion in TCAHR now I found the solution : LPSTR pW ; pW = hb_parc( 1 ) ; int lenwName ; lenwName = sizeof(pW) ; TCHAR wName[sizeof(pW)]; MultiByteToWideChar( CP_ACP, 0 ,pW , -1 , wName, sizeof( wName ) / sizeof( wName[ 0 ] ) ); PDC_ExtTextOut(hPrDC,200,200, 0, NULL, wName, _tcslen(wName) , NULL); Antonio, it is correct ? About the DC : There are not a function to release the DC but a function that close the process at the end . So , It is better declare hPrDC static at the start or call every line ( every function) hPrDC=PDC_GetPrinterDC() what do you think . |
Convert hb_parc() in LPTSTR | Maurizio,I would do it this way:[code:dn1ctaa8]
LPSTR pW = hb_parc( 1 ) ;
int len = hb_parclen( 1 );
TCHAR wName[ len ];
MultiByteToWideChar( CP_ACP, 0 ,pW , -1 , wName, len * 2 );
PDC_ExtTextOut(hPrDC,200,200, 0, NULL, wName, _tcslen(wName) , NULL);
[/code:dn1ctaa8]is it working your way ?Regarding the hDC, yes better reuse the first that you create. Use a static variable. |
Convert hb_parc() in LPTSTR | Antonio ,Yes my way works . If I try your way I have this error : stampa.prg(148) : error C2057: expected constant expressionstampa.prg(148) : error C2466: cannot allocate an array of constant size 0stampa.prg(148) : error C2133: 'wName' : unknown sizeWhere :147 - LPSTR pW = hb_parc( 1 ) ; 148 - int len = hb_parclen( 1 ); 149 - TCHAR wName[ len ]; 150 - MultiByteToWideChar( CP_ACP, 0 ,pW , -1 , wName, len * 2 ); Regards MAurizio |
Convert hb_parc() in LPTSTR | Antonio , I have still problem with LPSTR pW = hb_parc( 1 ) ; int len = hb_parclen( 1 ); TCHAR wName[ len ]; I have the error C2057 because [ ] requires a constant expressionDo you know is there another solution to fix the len of TCHAR wName[ len ]Thank MAurizio |
Convert hb_parc() in LPTSTR | Maurizio,You can dynamically allocate it:[code:wgtnxjpa]
LPSTR pW = hb_parc( 1 ) ;
int len = hb_parclen( 1 );
TCHAR * wName = ( TCHAR * ) hb_xgrab( len * sizeof( TCHAR ) );
...
hb_xfree( wName );
[/code:wgtnxjpa] |
Convert hb_parc() in LPTSTR | Antonio <!-- s:( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":(" title="Sad" /><!-- s:( --> ,with your solution the len of wname is always 3 characters . Maurizio |
Convert hb_parc() in LPTSTR | Maurizio,Are you using hb_retclen() to return the string from C ?Keep in mind that the string may have embedded zeroes, so if you use hb_retc() then those zeroes will trim the real string length, thats why you can get 3 bytes only. |
Convert hb_parc() in LPTSTR | Antonio ,sorry but I dont understand . I use this your sample , and hb_parc(1) = "Print Test"I use wName in the C function .Regards Maurizio |
Convert hb_parc() in LPTSTR | Maurizio,Please show me your final C source code for your function, thanks |
Convert hb_parc() in LPTSTR | Antonio The function is PRINTLINE .The printer print only 2 characters . Thank Maurizio [code:mh3753r8]// FiveWin for Pocket PC - Testing comboboxes
#include "FWCE.ch"
#define PD_SELECTPORTRAIT 0x00040000
#define PD_SELECTLANDSCAPE 0x00080000
//----------------------------------------------------------------------------//
function Main()
local oWnd, cValue := "One"
Local oFont
Local cTitle := "Stampa"
DEFINE WINDOW oWnd TITLE cTitle
DEFINE FONT oFont NAME "Tahoma" SIZE 80, 80
@ 1, 2 BUTTON "Test" SIZE 80, 30 ACTION PrintCE()
ACTIVATE WINDOW oWnd
return nil
//----------------------------------------------------------------------------//
function PrintCE()
OPEN_CE()
PrintLine("Print this line")
CLOSE_CE()
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
#pragma BEGINDUMP
#include <hbapi.h>
#include <windows.h>
#include <aygshell.h>
#include <commdlg.h>
#include "PrintDC.h"
static far HDC hPrDC;
//==============================================================================================
HB_FUNC( PRINTLINE )
{
LPSTR pW = hb_parc( 1 ) ;
int len = hb_parclen( 1 );
TCHAR * wName = ( TCHAR * ) hb_xgrab( len * sizeof( TCHAR ) );
MultiByteToWideChar( CP_ACP, 0 ,pW , -1 , wName, sizeof( wName ) / sizeof( wName[ 0 ] ) );
PDC_ExtTextOut(hPrDC,100,100, 0, NULL, wName, _tcslen(wName) , NULL);
hb_xfree( wName );
}
//==============================================================================================
HB_FUNC( OPEN_CE )
{
//Initialize PrintDC
HWND hWnd;
hWnd = FindWindow (NULL,L"Stampa");
// MessageBox( 0, wName, L"TRUE", 0 );
PDC_Init(_T("Key")); //
PRINTDLG pdlg;
memset(&pdlg, 0, sizeof(PRINTDLG));
pdlg.cbStruct = sizeof(PRINTDLG);
pdlg.hwndOwner= hWnd;
pdlg.dwFlags = PD_SELECTPORTRAIT | PD_INTHOUSANDTHSOFINCHES;
if (!PDC_PrintDlg(&pdlg)) { //Show "Select Printer" dialog
PDC_KillDoc(NULL); //user may have pressed cancel - free PrintDC resources and clear error condition
return;
}
//Get the printer DC
hPrDC=pdlg.hdc; //Can also use PDC_GetPrinterDC()
if (hPrDC==NULL) return;
//Get printer resolution
int DPI;
DPI=PDC_GetDeviceCaps(hPrDC,LOGPIXELSX);
//Get our margins - stored as thousandths of an inch.since used PD_INTHOUSANDTHSOFINCHES
// Convert margins to printer units (DPI) and subract physical offsets
int leftmargin,topmargin;
leftmargin=(pdlg.rcMargin.left*DPI)/1000 - PDC_GetDeviceCaps(hPrDC,PHYSICALOFFSETX);
topmargin=(pdlg.rcMargin.top*DPI)/1000 - PDC_GetDeviceCaps(hPrDC,PHYSICALOFFSETY);
//Lets get started printing
DOCINFO di;
PDC_StartDoc(hPrDC,&di);
PDC_StartPage(hPrDC);
//Print our text using default font
}
//==============================================================================================
HB_FUNC( CLOSE_CE )
{
PDC_EndPage(hPrDC);
PDC_EndDoc(hPrDC);
if (hPrDC) PDC_DeleteDC((HDC) hPrDC);
PDC_UnInit();
}
#pragma ENDDUMP
[/code:mh3753r8] |
Convert hb_parc() in LPTSTR | Maurizio,Please try this: TCHAR * wName = ( TCHAR * ) hb_xgrab( len * sizeof( TCHAR ) ); MultiByteToWideChar( CP_ACP, 0 ,pW , -1 , wName, sizeof( wName ) / sizeof( wName[ 0 ] ) ); PDC_ExtTextOut(hPrDC,100,100, 0, NULL, wName, [b:28zfrtk6]len * sizeof( TCHAR ) [/b:28zfrtk6], NULL); |
Convert hb_parc() in LPTSTR | Antonio , doesn't works <!-- s:( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":(" title="Sad" /><!-- s:( --> ,I try also :PDC_ExtTextOut(hPrDC,100,100, 0, NULL, wName, [b:84v6wj36]15,[/b:84v6wj36] NULL);I think that the problem is TCHAR * wName = ( TCHAR * ) hb_xgrab( len * sizeof( TCHAR ) ); Thank Maurizio |
Convert hb_parc() in LPTSTR | Maurizio,Try this:PDC_ExtTextOut(hPrDC,100,100, 0, NULL, wName, [b:2wa5txib]31[/b:2wa5txib], NULL); I think that the problem is TCHAR * wName = ( TCHAR * ) hb_xgrab( [b:2wa5txib]31[/b:2wa5txib] ); |
Convert hb_parc() in LPTSTR | Maurizio,A wide string uses to be the double length of the original string, as each char requires two bytes |
Convert hb_parc() in LPTSTR | Antonio ,same effect <!-- s:( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":(" title="Sad" /><!-- s:( --> , you cann see the variable wname MessageBox( 0, wName, L"TRUE", 0 );Maurizio [/u] |
Convert hb_parc() in LPTSTR | Maurizio,Please try this:MessageBox( 0, AnsiToWide( "Hello World" ), L"TRUE", 0 ); |
Convert hb_parc() in LPTSTR | Antonio ,I have thi serror error C2664: 'AnsiToWide' : cannot convert parameter 1 from 'char [12]' to 'char'This conversion requires a reinterpret_cast, a C-style cast or function-style castRegards MAurizio |
Convert hb_parc() in LPTSTR | Maurizio,You need to include this prototype:TCHAR * AnsiToWide( char * );HB_FUNC( ... ){...} |
Convert hb_parc() in LPTSTR | Antonio ,Now the error is error LNK2019: unresolved external symbol "unsigned short * __cdecl AnsiToWide(char *)" (?AnsiToWide@@YAPAGPAD@Z) referenced in function HB_FUN_PRINTLINEMaurizio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.