milosev.com
  • Home
    • List all categories
    • Sitemap
  • Downloads
    • WebSphere
    • Hitachi902
    • Hospital
    • Kryptonite
    • OCR
    • APK
  • About me
    • Gallery
      • Italy2022
      • Côte d'Azur 2024
    • Curriculum vitae
      • Resume
      • Lebenslauf
    • Social networks
      • Facebook
      • Twitter
      • LinkedIn
      • Xing
      • GitHub
      • Google Maps
      • Sports tracker
    • Adventures planning
  1. You are here:  
  2. Home

Log in

Details
Written by: Stanko Milosev
Category: Delphi
Published: 12 June 2009
Last Updated: 16 July 2009
Hits: 5688

You need to access computer which is not in a domain?

No problem Cool

Here is the code:

var token: Cardinal;
dwResult: DWORD;
nr: TNETRESOURCE;
sl: TStringList;
begin
nr.dwType := RESOURCETYPE_DISK;
nr.lpProvider := nil;
nr.lpLocalName := nil;
nr.lpRemoteName := '\\computername\sharedfolder';
//\\computername\sharedfolder\ will not work - just with ExcludeTrailingPathDelimiter
\\also will not work \\computername\d$\folder\ - we need just \\computername\d$
dwResult := WNetAddConnection2(nr, 'password', 'user', 0); //watchout username and pass are on strange positions, at least for me
if (dwResult = NO_ERROR) or (dwResult = ERROR_ALREADY_ASSIGNED) or (dwResult = ERROR_SESSION_CREDENTIAL_CONFLICT) then
begin
sl := TStringList.Create;
sl.LoadFromFile('\\computername\sharedfolder\file.txt');
ShowMessage(sl.Strings[1]);
FreeAndNil(sl);
end;
end;

Taken from here.

Reintroduce

Details
Written by: Stanko Milosev
Category: Delphi
Published: 08 May 2009
Last Updated: 18 July 2011
Hits: 5434

I you receive compiler warning like:

[DCC Warning] uGC88.pas(24): W1010 Method 'Txt2Db' hides virtual method of base type 'TGC88'

Then just use reintroduce keyword.

Like:

TGC88 = class
procedure Txt2Db;virtual;abstract;
end;

type
TGC88Pdf = class(TGC88)
procedure Txt2Db;reintroduce;
end;

Build events

Details
Written by: Stanko Milosev
Category: Delphi
Published: 08 May 2009
Last Updated: 30 November -0001
Hits: 5226

If you need something to do before build or after build in Project->Options go on Build events.

In my case I needed to compile resource file to add one exeso for sure is always there (mostly because of CVS and other developers).

Syntax is something like this:

call "res\pdftotext.bat"
if %errorlevel% neq 0 exit %errorlevel%

GetLastError

Details
Written by: Stanko Milosev
Category: Delphi
Published: 30 April 2009
Last Updated: 30 November -0001
Hits: 5543
Correct usage of GetLastError and FormatMessage in Delphi.
ShowMessage(SysErrorMessage(GetLastError))) 
Taken from here.
  1. Pdf
  2. Parsing
  3. Components
  4. MAPI

Subcategories

C#

Azure

ASP.NET

JavaScript

Software Development Philosophy

MS SQL

IBM WebSphere MQ

MySQL

Joomla

Delphi

PHP

Windows

Life

Lazarus

Downloads

Android

CSS

Chrome

HTML

Linux

Eclipse

Page 96 of 168

  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100