This commit is contained in:
jrandom
2005-09-16 04:34:59 +00:00
committed by zzz
parent d89f589f2b
commit 6ca3f01038
102 changed files with 9297 additions and 0 deletions

View File

@ -0,0 +1,33 @@
# Project: guihead
# Makefile created by Dev-C++ 4.9.9.2
CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
RES =
OBJ = guihead.o ../head.o $(RES)
LINKOBJ = guihead.o ../head.o $(RES)
LIBS = -L"lib" -mwindows
INCS = -I"include"
CXXINCS = -I"lib/gcc/mingw32/3.4.2/include" -I"include/c++/3.4.2/backward" -I"include/c++/3.4.2/mingw32" -I"include/c++/3.4.2" -I"include"
BIN = guihead.exe
CXXFLAGS = $(CXXINCS) -fexpensive-optimizations -O3
CFLAGS = $(INCS) -fexpensive-optimizations -O3
RM = rm -f
.PHONY: all all-before all-after clean clean-custom
all: all-before guihead.exe all-after
clean: clean-custom
${RM} $(OBJ) $(BIN)
$(BIN): $(OBJ)
$(CC) $(LINKOBJ) -o "guihead.exe" $(LIBS)
guihead.o: guihead.c
$(CC) -c guihead.c -o guihead.o $(CFLAGS)
../head.o: ../head.c
$(CC) -c ../head.c -o ../head.o $(CFLAGS)

View File

@ -0,0 +1,155 @@
/*
launch4j :: Cross-platform Java application wrapper for creating Windows native executables
Copyright (C) 2004-2005 Grzegorz Kowal
Compiled with Mingw port of GCC, Bloodshed Dev-C++ IDE (http://www.bloodshed.net/devcpp.html)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../resource.h"
#include "../head.h"
#include "guihead.h"
extern PROCESS_INFORMATION pi;
HWND hWnd;
DWORD dwExitCode = 0;
BOOL stayAlive = FALSE;
BOOL splash = FALSE;
BOOL splashTimeoutErr;
BOOL waitForWindow;
int splashTimeout; // tick count (s)
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow) {
HMODULE hLibrary = NULL;
if (!prepare(hLibrary, lpCmdLine)) {
if (hLibrary != NULL) {
FreeLibrary(hLibrary);
}
return 1;
}
splash = loadBoolString(hLibrary, SHOW_SPLASH);
stayAlive = loadBoolString(hLibrary, GUI_HEADER_STAYS_ALIVE);
if (splash || stayAlive) {
hWnd = CreateWindowEx(WS_EX_TOOLWINDOW, "STATIC", "",
WS_POPUP | SS_BITMAP,
0, 0, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
if (splash) {
char timeout[10] = "";
if (!loadString(hLibrary, SPLASH_TIMEOUT, timeout)) {
msgBox("Cannot load splash timeout property.");
return 1;
}
splashTimeout = atoi(timeout);
if (splashTimeout <= 0 || splashTimeout > 60 * 15 /* 15 minutes */) {
msgBox("Invalid splash timeout property.");
return 1;
}
splashTimeoutErr = loadBoolString(hLibrary, SPLASH_TIMEOUT_ERR);
waitForWindow = loadBoolString(hLibrary, SPLASH_WAITS_FOR_WINDOW);
HANDLE hImage = LoadImage(hInstance, // handle of the instance containing the image
MAKEINTRESOURCE(SPLASH_BITMAP), // name or identifier of image
IMAGE_BITMAP, // type of image
0, // desired width
0, // desired height
LR_DEFAULTSIZE);
if (hImage == NULL) {
msgBox("Cannot load splash screen.");
return 1;
}
SendMessage(hWnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM) hImage);
RECT rect;
GetWindowRect(hWnd, &rect);
int x = (GetSystemMetrics(SM_CXSCREEN) - (rect.right - rect.left)) / 2;
int y = (GetSystemMetrics(SM_CYSCREEN) - (rect.bottom - rect.top)) / 2;
SetWindowPos(hWnd, HWND_TOP, x, y, 0, 0, SWP_NOSIZE);
ShowWindow(hWnd, nCmdShow);
UpdateWindow (hWnd);
}
if (!SetTimer (hWnd, ID_TIMER, 1000 /* 1s */, TimerProc)) {
return 1;
}
}
FreeLibrary(hLibrary);
if (execute(FALSE) == -1) {
char errMsg[BIG_STR] = "Error occured while starting the application...\n";
strcat(errMsg, strerror(errno));
msgBox(errMsg);
return 1;
}
if (!(splash || stayAlive)) {
closeHandles();
return 0;
}
MSG msg;
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
closeHandles();
return dwExitCode;
}
BOOL CALLBACK enumwndfn(HWND hwnd, LPARAM lParam) {
DWORD processId;
GetWindowThreadProcessId(hwnd, &processId);
if (pi.dwProcessId == processId) {
LONG styles = GetWindowLong(hwnd, GWL_STYLE);
if ((styles & WS_VISIBLE) != 0) {
splash = FALSE;
ShowWindow(hWnd, SW_HIDE);
return FALSE;
}
}
return TRUE;
}
VOID CALLBACK TimerProc(
HWND hwnd, // handle of window for timer messages
UINT uMsg, // WM_TIMER message
UINT idEvent, // timer identifier
DWORD dwTime) { // current system time
if (splash) {
if (splashTimeout == 0) {
splash = FALSE;
ShowWindow(hWnd, SW_HIDE);
if (waitForWindow && splashTimeoutErr) {
KillTimer(hwnd, ID_TIMER);
msgBox("Could not start the application, operation timed out.");
PostQuitMessage(0);
}
} else {
splashTimeout--;
if (waitForWindow) {
EnumWindows(enumwndfn, 0);
}
}
}
GetExitCodeProcess(pi.hProcess, &dwExitCode);
if (dwExitCode != STILL_ACTIVE
|| !(splash || stayAlive)) {
KillTimer(hWnd, ID_TIMER);
PostQuitMessage(0);
return;
}
}

View File

@ -0,0 +1,119 @@
[Project]
FileName=guihead.dev
Name=guihead
UnitCount=5
Type=0
Ver=1
ObjFiles=
Includes=
Libs=
PrivateResource=
ResourceIncludes=
MakeIncludes=
Compiler=
CppCompiler=
Linker=_@@_
IsCpp=0
Icon=
ExeOutput=
ObjectOutput=
OverrideOutput=0
OverrideOutputName=guihead.exe
HostApplication=
Folders=
CommandLine=
UseCustomMakefile=0
CustomMakefile=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
CompilerSettings=0000000001001000000000
[Unit1]
FileName=guihead.c
CompileCpp=0
Folder=guihead
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit2]
FileName=guihead.h
CompileCpp=0
Folder=guihead
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[VersionInfo]
Major=0
Minor=1
Release=1
Build=1
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=
FileDescription=Developed using the Dev-C++ IDE
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
AutoIncBuildNr=0
[Unit4]
FileName=..\head.h
CompileCpp=0
Folder=guihead
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit6]
FileName=..\resource.h
Folder=guihead
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
CompileCpp=0
[Unit7]
FileName=..\resid.h
CompileCpp=0
Folder=guihead
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit3]
FileName=..\head.c
CompileCpp=0
Folder=guihead
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit5]
FileName=..\resource.h
CompileCpp=0
Folder=guihead
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=

View File

@ -0,0 +1,31 @@
/*
launch4j :: Cross-platform Java application wrapper for creating Windows native executables
Copyright (C) 2004-2005 Grzegorz Kowal
Compiled with Mingw port of GCC, Bloodshed Dev-C++ IDE (http://www.bloodshed.net/devcpp.html)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define ID_TIMER 1
VOID CALLBACK TimerProc(
HWND hwnd, // handle of window for timer messages
UINT uMsg, // WM_TIMER message
UINT idEvent, // timer identifier
DWORD dwTime // current system time
);