Set Date and Time to Operacional System
Moderator: Rathinagiri
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: Set Date and Time to Operacional System
Thanks a lot Pablo
Saludos
--
Esgici
Saludos
--
Esgici
Viva INTERNATIONAL HMG
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Re: Set Date and Time to Operacional System
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:
Errors at compiling is:
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
I will appreciate your help if somebody already made it works.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'
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Set Date and Time to Operacional System
Hi,
Can you please tell me the exact location of these c source code?
Can you please tell me the exact location of these c source code?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Set Date and Time to Operacional System
Hi Rathinagiri, thank you for your interest. I give my way, but it is not a canonic solution.
Look what I done:
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.
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
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.
Last edited by Pablo César on Fri Jan 20, 2012 11:11 am, edited 1 time in total.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Set Date and Time to Operacional System
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.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Set Date and Time to Operacional System
Implementations have been made in version 3.3:
See screenshots from MyAlert():
- Font of the StatusBar was changed to Courier New, because it is a monospace one and easy for lengh measurement (in testing).
- Implemented _CenterWindow function () and also used C_Center () instead of Form.Center [/ b] or Center window [/ b]
- Was implemented MyALERT function () replacing WAlert (), adding a RichEditBox to display better (with vertical scroll bars when necessary) messages. Was made available three colors and an option to screen position by row, in order to show in better way a complete screen.
- Were inserted more functions such as text alignment like as justified() to fix texts centered and justified in MyALERT()
See screenshots from MyAlert():
Last edited by Pablo César on Fri Jan 20, 2012 6:51 pm, edited 1 time in total.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: Set Date and Time to Operacional System
Hola Pablo
Saludos
--
Esgici
Thanks a lotPablo César wrote:Implementations have been made in version 3.3:
Saludos
--
Esgici
Viva INTERNATIONAL HMG
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Set Date and Time to Operacional System
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.
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.
Last edited by Pablo César on Sat Jan 21, 2012 4:41 am, edited 1 time in total.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Set Date and Time to Operacional System
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.
Last edited by Pablo César on Tue Jan 24, 2012 3:57 pm, edited 1 time in total.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Set Date and Time to Operacional System
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.
Note: Was corrected a bug when Windows was not ISVISTAORLATER. Please download RAR file again.
- Attachments
-
- DataHora.rar
- Version 3.6
- (1.02 MiB) Downloaded 639 times
Last edited by Pablo César on Tue Jan 24, 2012 10:15 pm, edited 3 times in total.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein