Novo

Forum kao aplikacija na telefonu

Dodajte forum na početni ekran i koristite ga kao aplikaciju, sa menijem na dnu ekrana.

  • 10 odgovora
  • 4.265 pregleda

Najnovija ↓

Re: Program za rad isporuke i kartovanja u posti 12.12.2011. u 12:19 · pre 181 mesec #3
Na prv pogled
1. Zasto vo eden DataModule ne gi smestis site TTable i DataSource (mislam deka ke ti bide polesno)
2. Zasto vo formata DOSTAVAUNOS na ComboBox1Change moras da ispituvas sto e vrednost na comboto pa da go prenesuvas kako parametar
mozes PISMADOSTAVA.Query1.Params[0].ASSTRING := ComboBox1.text;

Kazi ja prikaznata za delovite sto ne uspevas da se snajdes (kolku mozam ke ti dadam sugestii i ke ti pomognam),
Se nadevam deka me razbiras zasto pisuvam na makedonski
Re: Program za rad isporuke i kartovanja u posti 12.12.2011. u 16:21 · pre 181 mesec #4
treba mi mala pomoc oko ovog programa,kako da mi sifra kojom se prijavljujem na kompu,tj na windows,da mi ta sifra izlazi na glavnoj formi(navigatoru),negtde dole pored vremena,ili na panelu....kako to...
Re: Program za rad isporuke i kartovanja u posti 12.12.2011. u 17:17 · pre 181 mesec
izmenjeno 1 put, poslednji put rambo 12.12.2011. u 19:52
  1. rambo12.12.2011. u 19:52zapis iz teksta poruke
#5
Verovatno misliš na Username a ne na šifru, jer se šifra nikada i nigde ne treba prikazivati. Jedan od načina da dobiješ ime trenutno prijavljenog Windows korisnika je pomoću funkcije GetUserName:

Code (delphi):
function GetLocalUserName: string;
var
  Count: DWORD;
begin
  Count := 256 + 1; // UNLEN + 1
  // set buffer size to 256 + 2 characters
  SetLength(Result, Count);
  if GetUserName(PChar(Result), Count) then
    SetLength(Result, Count)
  else
    Result := '';
end;

Ovu funkciju jednostavno koristiš ovako:
Code (delphi):
Label1.Caption := GetLocalUserName

Drugi jednostavniji način je da uzmeš JVCL i upotrebiš komponentu TJvComputerInfoEx. Dobićeš veliki broj informacija, a ono što tebe zanima je property Identification.LocalUserName. Da bi na primer popunio labelu svojim korisničkim imenom, napiši:
Code (delphi):
Label1.Caption := JvComputerInfoEx1.Identification.LocalUserName;
Potpis
"There is a theory which states that if ever anybody discovers exactly what the
Universe is for and why it is here, it will instantly disappear and be replaced by
something even more bizarre and inexplicable. There is another theory which states
that this has already happened."
-- Douglas Adams
Re: Program za rad isporuke i kartovanja u posti 12.12.2011. u 18:11 · pre 181 mesec
izmenjeno 1 put, poslednji put savkic 12.12.2011. u 18:55
  1. savkic12.12.2011. u 18:55zapis iz teksta poruke
#6
meni treba ovako nesto,ali negde gresim...ne treba mi ime kompjutera,nego username pod kojim sam prijavljen

Code:

FUNCTION:     GetCurrentUserAndDomain - This function looks up
//                the user name and domain name for the user account
//                associated with the calling thread.
//
//  PARAMETERS:   szUser - a buffer that receives the user name
//                pcchUser - the size, in characters, of szUser
//                szDomain - a buffer that receives the domain name
//                pcchDomain - the size, in characters, of szDomain
// 
//  RETURN VALUE: TRUE if the function succeeds. Otherwise, FALSE and
//                GetLastError() will return the failure reason.
// 
//                If either of the supplied buffers are too small, 
//                GetLastError() will return ERROR_INSUFFICIENT_BUFFER
//                and pcchUser and pcchDomain will be adjusted to
//                reflect the required buffer sizes.
//
//**********************************************************************

function GetCurrentUserAndDomain(szUser : PChar;   pcchUser : DWORD;
       szDomain : PChar;  pcchDomain: DWORD) : boolean;

var
   fSuccess : boolean;
   hToken   : THandle;
   ptiUser  : PSIDAndAttributes;
   cbti     : DWORD;
   snu      : SID_NAME_USE;

begin
   ptiUser := nil;
   Result := false;

   try
      // Get the calling thread's access token.
      if (not OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, TRUE,
            hToken)) then

       begin
         if (GetLastError() <> ERROR_NO_TOKEN) then
            exit;

         // Retry against process token if no thread token exists.
         if (not OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY,
               hToken)) then
            exit;
       end;

      // Obtain the size of the user information in the token.
      if (GetTokenInformation(hToken, TokenUser, nil, 0, cbti)) then

         // Call should have failed due to zero-length buffer.
         Exit

       else

         // Call should have failed due to zero-length buffer.
         if (GetLastError() <> ERROR_INSUFFICIENT_BUFFER) then
            Exit;


      // Allocate buffer for user information in the token.
      ptiUser :=  HeapAlloc(GetProcessHeap(), 0, cbti);
      if (ptiUser= nil) then
         Exit;

      // Retrieve the user information from the token.
      if ( not GetTokenInformation(hToken, TokenUser, ptiUser, cbti, cbti)) then
         Exit;

      // Retrieve user name and domain name based on user's SID.
      if ( not LookupAccountSid(nil, ptiUser.Sid, szUser, pcchUser,
            szDomain, pcchDomain, snu)) then
         Exit;

      fSuccess := TRUE;

   finally

      // Free resources.
      if (hToken > 0) then
         CloseHandle(hToken);

      if (ptiUser <> nil) then
         HeapFree(GetProcessHeap(), 0, ptiUser);
   end;

   Result :=  fSuccess;
end;

Re: Program za rad isporuke i kartovanja u posti 12.12.2011. u 19:49 · pre 181 mesec #7
Da li si uopšte probao ono što sam ja napisao? Funkcija GetUserName upravo vraća ime trenutno ulogovanog korisnika, a postoji i GetUserNameEx kojoj možeš da zadaš format u kome želiš da ti vrati informacije. Međutim, to i mnogo više već radi TJvComputerInfoEx komponenta. Ako nisi probao, prvo proveri šta dobijaš onime što sam ti incijalno dao.
Potpis
"There is a theory which states that if ever anybody discovers exactly what the
Universe is for and why it is here, it will instantly disappear and be replaced by
something even more bizarre and inexplicable. There is another theory which states
that this has already happened."
-- Douglas Adams
Re: Program za rad isporuke i kartovanja u posti 12.12.2011. u 20:40 · pre 181 mesec #9
Oduvek mi je bilo fascinantno sto ljudi koriste ultra stare alate za razvoj ? Delphi 4 je star, pa sigurno, 15+ godina.. Predji na Delphi 7 barem, ako neces na XE.
Re: Program za rad isporuke i kartovanja u posti 12.12.2011. u 21:29 · pre 181 mesec #10
TJvComputerInfoEx je komponenta u okviru JVCL paketa. JVCL možeš skinuti odavde.

I da, svakako pređi bar na Delphi 7.

I još nešto. Batali Paradox. Pređi bar na Firebird RDBMS.
Potpis
"There is a theory which states that if ever anybody discovers exactly what the
Universe is for and why it is here, it will instantly disappear and be replaced by
something even more bizarre and inexplicable. There is another theory which states
that this has already happened."
-- Douglas Adams
Prijavite se da biste odgovorili u ovoj temi.PrijavaRegistracija

Premeštanje teme