Page 2 of 4
Re: Set Date and Time to Operacional System
Posted: Mon Jan 16, 2012 9:31 pm
by esgici
Thanks a lot Pablo
Saludos
--
Esgici
Re: Set Date and Time to Operacional System
Posted: Tue Jan 17, 2012 5:47 pm
by Pablo César
I am looking a example of GETTEXTSIZE which I believe is already in Harbour. This function is used to get len of string in pixels. These are C function for it, but it´s with stil some errors:
Code: Select all
#pragma BEGINDUMP
#include <hbapi.h>
#include <hbapiitm.h>
#include <windows.h>
HB_FUNC( GETTEXTEXTENTPOINT32 ) //hdc,cText
{
HDC hdc = (HDC) hb_parnl(1);
char * pstr = hb_parcx(2);
SIZE sz ;
if ( GetTextExtentPoint32( hdc, pstr, strlen(pstr), &sz ) )
{
PHB_ITEM * aSize ;
hb_arrayNew(&aSize,2);
hb_itemPutNI( hb_arrayGetItemPtr( &aSize, 1 ), sz.cx );
hb_itemPutNI( hb_arrayGetItemPtr( &aSize, 2 ), sz.cy );
hb_itemReturnForward( &aSize );
hb_arrayRelease( &aSize );
}
}
HB_FUNC( GETTEXTSIZE )
{
char * pstr = hb_parc(2);
SIZE sz;
PHB_ITEM aMetr = _itemArrayNew( 2 );
PHB_ITEM temp;
GetTextExtentPoint32( (HDC) HB_PARHANDLE(1), pstr, strlen( pstr ),
&sz );
temp = hb_itemPutNL( NULL, sz.cx );
hb_itemArrayPut( aMetr, 1, temp );
hb_itemRelease( temp );
temp = hb_itemPutNL( NULL, sz.cy );
hb_itemArrayPut( aMetr, 2, temp );
hb_itemRelease( temp );
hb_itemReturn( aMetr );
hb_itemRelease( aMetr );
}
#pragma ENDDUMP
Errors at compiling is:
undefined reference to `_itemArrayNew'
.hbmk/win/mingw/main.o:main.c:(.text+0x34): undefined reference to `HB_PARHANDLE'
.hbmk/win/mingw/main.o:main.c:(.text+0x1db): undefined reference to `hb_arrayRelease'
I will appreciate your help if somebody already made it works.
Re: Set Date and Time to Operacional System
Posted: Tue Jan 17, 2012 6:05 pm
by Rathinagiri
Hi,
Can you please tell me the exact location of these c source code?
Set Date and Time to Operacional System
Posted: Wed Jan 18, 2012 1:28 am
by Pablo César
Hi Rathinagiri, thank you for your interest. I give my way, but it is not a canonic solution.
Look what I done:
Code: Select all
Static Function WidthString(cString)
Local i, nTam := 0.0
For i=1 to Len(cString)
cChar := Sub str(cString,i,1)
Do Case
Case cChar $ "ifjl,t.;:"+Chr(126)+Chr(125)+Chr(91)+Chr(93)+"-+*()"+Chr(34)+"'!íIÍ\|/"
nTam := nTam + 2.5
Case cChar $ "qweryuopasdghkçzxcvbnmáéóúàâêôãõ<>_=?"
nTam := nTam + 5.0
Case cChar $ "#$%"+Chr(38)
nTam := nTam + 6.0
Case cChar $ "QERTYUOPASDFGHJKLÇZXCVBNMÁÉÓÚÀÂÊÔÃÕ"
nTam := nTam + 8.0
Case cChar $ "W"
nTam := nTam + 10.0
Case cChar $ Chr(64)
nTam := nTam + 11.0
Otherwise
nTam := nTam + 9.0
Endcase
Next
Return nTam
But This function was made based Arial font size 9.
The source of my searching is:
http://www.rhinocerus.net/forum/lang-xh ... int32.html
Also this function is in C:\MiniGUI\Harbour\lib\hbwin.lib, C:\hmg.3.0.40\HARBOUR\lib\win\mingw\libhbwin.a and C:\hmg.3.0.40\HARBOUR\CHANGELOG
And I attaching a new version: 3.1
Note: Server with difficulties to accept "sub str" (not separated, because server claims with error). So please note in the line cChar := Sub_str(cString,i,1), in the words sub and str it is sentences together not separated.
Set Date and Time to Operacional System
Posted: Fri Jan 20, 2012 10:42 am
by Pablo César
Implementations that have been made in Version 3.2:
- By language files for easy definition in other languages
- StatusBar resizable, for lack of space in the window sometimes prevents the display completely. Then the user clicks on top and increases and decreases for view.
- Compatibility with previous versions of Windows to Windows XP (Win98)
- Trying to run a second time, the utility checks and resets the focus of the program was running. Not to use the SET WARNING OFF MULTIPLE
- A function that measures the string in pixels to use their best display in the StatusBar
- The ContextMenu is more beautiful because it uses features 3 styles
- Provide a screen "About Me" or "Leia-me" in Portuguese that shows the tools used for development on the version and author. This screen has timed out, ie, the window closes automatically after 20 seconds
- Was inserted WAlert function () which replaces MsgYesNo () because the buttons are not in the selected language. I think this is a bug of this tool not only as the great majority, since it should not take the OS.
Set Date and Time to Operacional System
Posted: Fri Jan 20, 2012 11:18 am
by Pablo César
Re: Set Date and Time to Operacional System
Posted: Fri Jan 20, 2012 12:15 pm
by esgici
Hola Pablo
Pablo César wrote:Implementations have been made in version 3.3:
Thanks a lot
Saludos
--
Esgici
Set Date and Time to Operacional System
Posted: Fri Jan 20, 2012 6:51 pm
by Pablo César
In version 3.4 has been done:
Windows 7 and I believe also in Vista and later, for security reasons does not allows to change the date and time if UAC (User Account Control) is enabled. Then I remembered my Win_util available also here and added an option to call the operating system clock. Intercepted the message "A required privilege is not held by the client." and calls the Windows clock in the case. Also fix a bug on the mouse click on Internet Explorer window to capture the screen of the page and get the official date and time.
Set Date and Time to Operacional System
Posted: Sat Jan 21, 2012 4:41 am
by Pablo César
In version 3.5 the following bugs were fixed:
- Function are accepting even date/time are inconsistent.
- Error handling of output in file for network stations.
- Check the version of IExplorer, since the routine is only valid with version 6.00 or later.
- Added the path where the application is located, specially when Windows is startuping and also for images files and mem file which is recording last setup. It was then used GetStartUpFolder().
- It was replaced Justify function by CharSpread() and CharRepl() functions, which are very much simple and efficient.
- There are new items added in languages files.
Set Date and Time to Operacional System
Posted: Tue Jan 24, 2012 3:57 pm
by Pablo César
In version 3.6 was implemented to enable a Hyperlink to read a file .Doc that as according was it been selected language will be in Portuguese or in English. It is an instruction for the application to run as administrator and be able to change date/time by the properties of the executable in Windows 7.
Note: Was corrected a bug when Windows was not ISVISTAORLATER. Please download RAR file again.