mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
Issue #1616; Fix broken updater code and binaries, by fixing wrong parameter definition of WindowProc and wrong type cast in a SendMessage() call
This commit is contained in:
18
packages/Delphi11.1/heidisql.groupproj
vendored
18
packages/Delphi11.1/heidisql.groupproj
vendored
@@ -18,6 +18,9 @@
|
||||
<Projects Include="heidisql.dproj">
|
||||
<Dependencies/>
|
||||
</Projects>
|
||||
<Projects Include="..\..\res\updater\updater.dproj">
|
||||
<Dependencies/>
|
||||
</Projects>
|
||||
</ItemGroup>
|
||||
<ProjectExtensions>
|
||||
<Borland.Personality>Default.Personality.12</Borland.Personality>
|
||||
@@ -71,14 +74,23 @@
|
||||
<Target Name="heidisql:Make">
|
||||
<MSBuild Projects="heidisql.dproj" Targets="Make"/>
|
||||
</Target>
|
||||
<Target Name="updater">
|
||||
<MSBuild Projects="..\..\res\updater\updater.dproj"/>
|
||||
</Target>
|
||||
<Target Name="updater:Clean">
|
||||
<MSBuild Projects="..\..\res\updater\updater.dproj" Targets="Clean"/>
|
||||
</Target>
|
||||
<Target Name="updater:Make">
|
||||
<MSBuild Projects="..\..\res\updater\updater.dproj" Targets="Make"/>
|
||||
</Target>
|
||||
<Target Name="Build">
|
||||
<CallTarget Targets="VirtualTreesR;VirtualTreesD;SynEdit_R;SynEdit_D;heidisql"/>
|
||||
<CallTarget Targets="VirtualTreesR;VirtualTreesD;SynEdit_R;SynEdit_D;heidisql;updater"/>
|
||||
</Target>
|
||||
<Target Name="Clean">
|
||||
<CallTarget Targets="VirtualTreesR:Clean;VirtualTreesD:Clean;SynEdit_R:Clean;SynEdit_D:Clean;heidisql:Clean"/>
|
||||
<CallTarget Targets="VirtualTreesR:Clean;VirtualTreesD:Clean;SynEdit_R:Clean;SynEdit_D:Clean;heidisql:Clean;updater:Clean"/>
|
||||
</Target>
|
||||
<Target Name="Make">
|
||||
<CallTarget Targets="VirtualTreesR:Make;VirtualTreesD:Make;SynEdit_R:Make;SynEdit_D:Make;heidisql:Make"/>
|
||||
<CallTarget Targets="VirtualTreesR:Make;VirtualTreesD:Make;SynEdit_R:Make;SynEdit_D:Make;heidisql:Make;updater:Make"/>
|
||||
</Target>
|
||||
<Import Project="$(BDS)\Bin\CodeGear.Group.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Group.Targets')"/>
|
||||
</Project>
|
||||
|
||||
@@ -11,8 +11,9 @@ uses
|
||||
var
|
||||
WClass: TWndClass;
|
||||
BackupPath, AppPath, DownloadPath: String;
|
||||
hAppHandle, HLabel: HWND;
|
||||
MainWin, HLabel: HWND;
|
||||
AppMsg: TMsg;
|
||||
FormShowing: Boolean = False;
|
||||
|
||||
const
|
||||
AppName = 'HeidiSQL';
|
||||
@@ -145,7 +146,7 @@ end;
|
||||
procedure Status(Text: String; IsError: Boolean=False);
|
||||
begin
|
||||
// Display status message on label
|
||||
SendMessage(HLabel, WM_SETTEXT, 1, Integer(PChar(Text)) );
|
||||
SendMessage(HLabel, WM_SETTEXT, 0, LPARAM(PChar(Text)) );
|
||||
UpdateWindow(hLabel);
|
||||
if IsError then begin
|
||||
Sleep(4000);
|
||||
@@ -197,7 +198,8 @@ var
|
||||
SUInfo: TStartupInfo;
|
||||
ProcInfo: TProcessInformation;
|
||||
begin
|
||||
KillTimer(hAppHandle, 0);
|
||||
FormShowing := True;
|
||||
KillTimer(MainWin, 0);
|
||||
AppPath := Paramstr(1);
|
||||
DownloadPath := ParamStr(2);
|
||||
|
||||
@@ -254,14 +256,14 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
function WindowProc(hWnd, msg, wpr, lpr: Longint): Longint; stdcall;
|
||||
function WindowProc(hWnd: HWND; msg: UINT; wpr: WPARAM; lpr: LPARAM): LRESULT; stdcall;
|
||||
var
|
||||
x, y: integer;
|
||||
Font: HFont;
|
||||
begin
|
||||
// Custom window procedure
|
||||
case msg of
|
||||
|
||||
// WM_NCCREATE: Non-client part of the window is being created
|
||||
WM_CREATE: begin
|
||||
// Center window
|
||||
x := GetSystemMetrics(SM_CXSCREEN);
|
||||
@@ -283,7 +285,7 @@ begin
|
||||
WindowHeight - 2*WindowPadding, // Height
|
||||
hWnd, // Parent hwnd
|
||||
0, // ID
|
||||
hAppHandle, // HInstance of program
|
||||
MainWin, // HInstance of program
|
||||
nil // Params for main window
|
||||
);
|
||||
// Cosmetics
|
||||
@@ -292,9 +294,14 @@ begin
|
||||
SetBkColor(hwnd, COLOR_BTNFACE+1);
|
||||
end;
|
||||
|
||||
WM_SHOWWINDOW: SetTimer(hAppHandle, 0, 200, @FormShow);
|
||||
WM_SHOWWINDOW: begin
|
||||
if not FormShowing then
|
||||
SetTimer(MainWin, 0, 200, @FormShow);
|
||||
end;
|
||||
|
||||
WM_DESTROY: PostQuitMessage(0);
|
||||
WM_DESTROY: begin
|
||||
PostQuitMessage(0);
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
@@ -307,11 +314,11 @@ end;
|
||||
begin
|
||||
// Define window class
|
||||
WClass.hInstance := hInstance;
|
||||
WClass.lpszClassName := 'WndClass';
|
||||
WClass.style := CS_HREDRAW or CS_VREDRAW;
|
||||
WClass.hIcon := LoadIcon(hInstance, IDI_WINLOGO);
|
||||
WClass.lpfnWndProc := @WindowProc;
|
||||
WClass.hbrBackground := COLOR_BTNFACE+1;
|
||||
WClass.lpszClassName := 'WndClass';
|
||||
WClass.hCursor := LoadCursor(0, IDC_ARROW);
|
||||
WClass.cbClsExtra := 0;
|
||||
WClass.cbWndExtra := 0;
|
||||
@@ -319,18 +326,18 @@ begin
|
||||
RegisterClass(WClass);
|
||||
|
||||
// Create form
|
||||
hAppHandle := CreateWindow(
|
||||
MainWin := CreateWindow(
|
||||
WClass.lpszClassName,
|
||||
AppName+' Updater',
|
||||
WS_POPUPWINDOW or WS_CAPTION or WS_VISIBLE,
|
||||
100, // Default x + y coordinates, will be centered in WM_CREATE
|
||||
100, // Default x + y coordinates, will be centered in WM_CREATE
|
||||
100,
|
||||
WindowWidth,
|
||||
WindowHeight,
|
||||
0,
|
||||
0,
|
||||
hInstance,
|
||||
nil
|
||||
WindowWidth, // nWidth
|
||||
WindowHeight, // nHeight
|
||||
0, // hWndParent
|
||||
0, // hMenu
|
||||
hInstance, // hInstance
|
||||
nil // lpParam
|
||||
);
|
||||
|
||||
// Message loop
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user