Solved

Trying to rebuild old Delphi into new app

Posted on 2010-09-14
22
718 Views
Last Modified: 2013-11-23
I have been trying to rebuild an old app that was written in Delphi because the controll locks up in win7. Anyway when I try to recompile I get a ton of errors. The first of which is [DCC Error] KkIni.pas(311): E2010 Incompatible types: 'AnsiChar' and 'Char'

OemToCharBuffW(PAnsiChar(BR), PAnsiChar(BR), Length(BR));

Open in new window

0
Comment
Question by:141ANG
  • 10
  • 8
  • 2
  • +1
22 Comments
 
LVL 16

Expert Comment

by:CodedK
Comment Utility
Hi.
First try OemToCharBuffA.

If you use Delphi 2009 then replace PChar with PAnsIChar.
PChar is a PWideChar and Char is a WideChar in Delphi 2009.
You cannot assign an AnsiChar / PAnsiChar to a WideChar / PWideChar,
and vice versa, without extra coding.


function OemToCharBuffA(lpszSrc: PAnsiChar; lpszDst: PAnsiChar; cchDstLength: DWORD): BOOL; stdcall;

function OemToCharBuffW(lpszSrc: PWideChar; lpszDst: PWideChar; cchDstLength: DWORD): BOOL; stdcall;

Hope this helps.
0
 
LVL 6

Expert Comment

by:wimmeyvaert
Comment Utility
0
 
LVL 1

Author Comment

by:141ANG
Comment Utility
replacing the first one worked, but not on the second line, I tried looking through the other link but it doesn't make a huge amount of sense to me, totaly a newb.

OemToCharBuffA(PWideChar(Result), PWideChar(Result), Length(AOem));

Open in new window

0
 
LVL 16

Expert Comment

by:CodedK
Comment Utility
Try this :

function StringToWideString(const s: RawByteString): WideString;
var
    l: integer;
    cp: Word;
begin
    if s = '' then
        Result := ''
    else
    begin
        cp := StringCodePage(s);
        l := MultiByteToWideChar(cp, MB_PRECOMPOSED, PAnsiChar(s), Length(s), nil, 0);
        SetLength(Result, l-1);
        if l > 1 then
            MultiByteToWideChar(cp, MB_PRECOMPOSED, PAnsiChar(s), Length(s), PWideChar(Result), l);
    end;
end;


Which can be simplified to this:

function StringToWideString(const s: RawByteString): WideString;
begin
Result := s;
end;
0
 
LVL 5

Expert Comment

by:briangochnauer
Comment Utility
Hi 141ANG,
  So you did find a compiler...

You can safely comment that line out since Delphi string is UnicodeString (Widestring)

function KkUnicodeToOem(const AUnicode: WideString): String;
  var
    BR: WideString;
begin
  BR := AUnicode;
//  OemToCharBuffW(PWideChar(BR), PWideChar(BR), Length(BR));
  Result := BR;
end;

function KkOemToUnicode(const AOem: String): WideString;
begin
  Result := AOem;
//  OemToCharBuffW(PWideChar(Result), PWideChar(Result), Length(AOem));
end;
0
 
LVL 1

Author Comment

by:141ANG
Comment Utility
That worked but now the next section is throwing an error, Undeclared identifier: 'ToString'

function TKkWideStringList.ToString(
  const ADelimiter: WideString): WideString;
  var
    BI: Integer;
begin
  Result := '';
  for BI := 0 to Count-1 do begin
    if BI > 0 then Result := Result + ADelimiter;
    Result := Result + Strings[BI];
  end;
end;

Open in new window

0
 
LVL 5

Expert Comment

by:briangochnauer
Comment Utility
The question was answered from several valid perspectives, even though the question was vague.
0
 
LVL 1

Author Comment

by:141ANG
Comment Utility
Brian, I don't think I ever posted the link to the original source code, if you have time to take a look here it is. http://rocketdock.com/addon/docklets/1004
0
 
LVL 5

Expert Comment

by:briangochnauer
Comment Utility
I did download the code on another question you posted.
I've been coverting thousands of lines of code to Delphi XE in the last couple months;
But the real problem I have is that I don't know what the plug-in is *supposed* to do; or even how to successfully install a plug-in inside rocketdock
I did install rocketdoc after our last question/answer exchange.
0
 
LVL 1

Author Comment

by:141ANG
Comment Utility
If I walked you through that process would it help?
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 5

Expert Comment

by:briangochnauer
Comment Utility
If you want to.
0
 
LVL 5

Expert Comment

by:briangochnauer
Comment Utility
I downloaded the installer (instead of the source) and installed it.
That made it easier... :))
Can you reproduce the problems?
 
0
 
LVL 1

Author Comment

by:141ANG
Comment Utility
So, I have gotten reports from other folks, and have experience myself that it lags quite a bit on 7, I have also noticed that the task tray function doesn't work at all.
0
 
LVL 5

Expert Comment

by:briangochnauer
Comment Utility
Yes I can confirm the issue with no tray support on Win7;
I have not seen the 'lag' on Win7.
btw, the files he released as 'source code' is NOT the source to the last release that was made.  
It took about 20 hrs of work to get the kkmenu.dll to compile and run properly.
No sure it's any better or worse than the original.
I got the task tray function to work on XP; but I must be missing the point of why showing some of the system try icons on KKMenu is useful.
KKMenu server will not run because it can not register it's window class; but the class style is zero so it has no class; and no comments in the source code either;
When you installed KKMenu on Win7 did you install with "No Tray Support" option?
 
0
 
LVL 1

Author Comment

by:141ANG
Comment Utility
I see what you are saying. I think that the point of the tray icon support was so that you could completely get rid of the windows bar all together.However; if it is as massive an undertaking as you are saying I will go ahead and make the suggestion to folks wanting to get rid of their windows bar to install lightstep or some other alternative shell, lol. I am sorry this ended up being so difficult. If you want to keep trying let me know. Otherwise I will assign you the points and call it good. P.S. do you have a copy of that recompiled code somewhere?
0
 
LVL 5

Accepted Solution

by:
briangochnauer earned 500 total points
Comment Utility
>>do you have a copy of that recompiled code somewhere?
I guess you mean the DLL; I attached it.
It may or may not work better since he never released the latest source code.

KkMenu.dll
0
 
LVL 1

Author Comment

by:141ANG
Comment Utility
Thanks man, do you want to keep dorking with the SYS tray thing, or call it?
0
 
LVL 1

Author Comment

by:141ANG
Comment Utility
Also, could you possibly zip the source code so I can look through it and see what you did?
0
 
LVL 5

Assisted Solution

by:briangochnauer
briangochnauer earned 500 total points
Comment Utility
There is much 'test' commenting of the code; but as is; it compiles under Delphi XE (should compile fine under Delphi version >= 2009
I enjoyed the challenge, but I have to get back to fixing some of the stuff they pay me to do. :)  it's sad that there is such few comments in the code;
The KIni.pas file should be depreciated; it only exists because it was originally written in Delphi 5 or earlier.

KKMENU-BG.exe
0
 
LVL 1

Assisted Solution

by:141ANG
141ANG earned 0 total points
Comment Utility
Thank you for all of the help. Maybe I can find someone in the RocketDock community that is up for the challenge.
0
 
LVL 1

Author Closing Comment

by:141ANG
Comment Utility
Great job, put way more time into this than I ever expected.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
mergeTwo  challenge 13 71
word0 challenge 3 56
What is Python programming? 3 62
advertisement module in core php 4 79
This is an explanation of a simple data model to help parse a JSON feed
A short article about problems I had with the new location API and permissions in Marshmallow
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now