FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour WinUser() or another way to get Windows User
Posts: 389
Joined: Mon Oct 13, 2008 11:26 AM
WinUser() or another way to get Windows User
Posted: Fri Jan 23, 2015 04:49 PM
I try to use the WinUser() but I get : Error: Unresolved external '_HB_FUN_WINUSER' referenced from OBJ\MAIN.OBJ

http://wiki.fivetechsoft.com/doku.php?i ... on_winuser

If I include the SOURCE\WINAPI\MSGBOX.C I get:


C:\Compiladores\FWH(10.6)\source\winapi\msgbox.c:
Warning W8065 C:\Compiladores\FWH(10.6)\source\winapi\msgbox.c 30: Call to function 'hb_parc' with no prototype in function _MsgBox
Warning W8069 C:\Compiladores\FWH(10.6)\source\winapi\msgbox.c 30: Nonportable pointer conversion in function _MsgBox
Warning W8065 C:\Compiladores\FWH(10.6)\source\winapi\msgbox.c 32: Call to function 'hb_param' with no prototype in function _MsgBox
Error E2342 C:\Compiladores\FWH(10.6)\source\winapi\msgbox.c 32: Type mismatch in parameter 'pVal' (wanted 'void *', got 'int') in function _MsgBox
Warning W8065 C:\Compiladores\FWH(10.6)\source\winapi\msgbox.c 35: Call to function 'hb_parc' with no prototype in function _MsgBox
Error E2342 C:\Compiladores\FWH(10.6)\source\winapi\msgbox.c 35: Type mismatch in parameter 'lpText' (wanted 'const signed char *', got 'int') in function _MsgBox
Warning W8065 C:\Compiladores\FWH(10.6)\source\winapi\msgbox.c 42: Call to function 'hb_param' with no prototype in function MESSAGEBOX
Error E2342 C:\Compiladores\FWH(10.6)\source\winapi\msgbox.c 42: Type mismatch in parameter 'pVal' (wanted 'void *', got 'int') in function MESSAGEBOX
Warning W8065 C:\Compiladores\FWH(10.6)\source\winapi\msgbox.c 43: Call to function 'hb_parnl' with no prototype in function MESSAGEBOX
Error E2342 C:\Compiladores\FWH(10.6)\source\winapi\msgbox.c 43: Type mismatch in parameter 'lpText' (wanted 'const signed char *', got 'int') in function MESSAGEBOX
Warning W8065 C:\Compiladores\FWH(10.6)\source\winapi\msgbox.c 80: Call to function 'hb_parni' with no prototype in function MSGYESNO
Warning W8065 C:\Compiladores\FWH(10.6)\source\winapi\msgbox.c 90: Call to function 'hb_parni' with no prototype in function MSGNOYES
Warning W8065 C:\Compiladores\FWH(10.6)\source\winapi\msgbox.c 104: Call to function 'hb_parni' with no prototype in function MSGRETRYCANCEL
Warning W8065 C:\Compiladores\FWH(10.6)\source\winapi\msgbox.c 112: Call to function 'hb_parc' with no prototype in function MSGABOUT
Warning W8069 C:\Compiladores\FWH(10.6)\source\winapi\msgbox.c 112: Nonportable pointer conversion in function MSGABOUT
Warning W8065 C:\Compiladores\FWH(10.6)\source\winapi\msgbox.c 115: Call to function 'hb_param' with no prototype in function MSGABOUT
Warning W8065 C:\Compiladores\FWH(10.6)\source\winapi\msgbox.c 117: Call to function 'hb_param' with no prototype in function MSGABOUT
Error E2342 C:\Compiladores\FWH(10.6)\source\winapi\msgbox.c 117: Type mismatch in parameter 'pVal' (wanted 'void *', got 'int') in function MSGABOUT
Warning W8065 C:\Compiladores\FWH(10.6)\source\winapi\msgbox.c 118: Call to function 'hb_parc' with no prototype in function MSGABOUT
Warning W8069 C:\Compiladores\FWH(10.6)\source\winapi\msgbox.c 118: Nonportable pointer conversion in function MSGABOUT
Warning W8065 C:\Compiladores\FWH(10.6)\source\winapi\msgbox.c 130: Call to function 'hb_parc' with no prototype in function SHELLABOUT
Error E2342 C:\Compiladores\FWH(10.6)\source\winapi\msgbox.c 130: Type mismatch in parameter 'szApp' (wanted 'const signed char *', got 'int') in function SHELLABOUT
Error E2021 C:\Compiladores\FWH(10.6)\source\winapi\msgbox.c 138: Array must have at least one element in function WINUSER
Warning W8065 C:\Compiladores\FWH(10.6)\source\winapi\msgbox.c 142: Call to function 'hb_retc' with no prototype in function WINUSER
Email: SamirSSabreu@gmail.com
xHarbour 1.2.3 + Fwhh 20.2
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: WinUser() or another way to get Windows User
Posted: Fri Jan 23, 2015 05:56 PM

Look WNetGetUser()

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 195
Joined: Sun Jul 22, 2012 07:01 PM
Re: WinUser() or another way to get Windows User
Posted: Fri Jan 23, 2015 08:07 PM

This may provide what you are looking for:

In xharbour you can use the netname() function. It takes one logical argument, which defaults to .t. and returns the user name. If set to false it returns the name of the device.

In harbour the function hb_UserName() will return the user and netname() with no arguments will return the name of the device.

Robb

Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: WinUser() or another way to get Windows User
Posted: Fri Jan 23, 2015 10:52 PM
Code (fw): Select all Collapse
?GetEnv("USERNAME")


salu2
carlos vargas
Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 389
Joined: Mon Oct 13, 2008 11:26 AM
Re: WinUser() or another way to get Windows User
Posted: Mon Jan 26, 2015 12:14 PM

Thanks!
I'll try all the options

I'm using NetName(.T.) but don't work as I want.

Email: SamirSSabreu@gmail.com
xHarbour 1.2.3 + Fwhh 20.2

Continue the discussion