Salut a tous,
Une question qu'on a certainement deja du poser, mais je ne retrouve plus
la reponse:
Sous windows:
J'ai un .bat qui contient une ligne de commande du genre
java -jar monJar.jar
Lorsque je double click sur mon batch, celui-ci m'ouvre une console dos.
Or, je ne veut pas que la console apparaisse...
Comment je fais?
(J'ai essaye javaw a la place de java sous XP, mais sans succes).
Par avance merci a tous.
A+
Salut a tous,
Une question qu'on a certainement deja du poser, mais je ne retrouve plus
la reponse:
Sous windows:
J'ai un .bat qui contient une ligne de commande du genre
java -jar monJar.jar
Lorsque je double click sur mon batch, celui-ci m'ouvre une console dos.
Or, je ne veut pas que la console apparaisse...
Comment je fais?
(J'ai essaye javaw a la place de java sous XP, mais sans succes).
Par avance merci a tous.
A+
Salut a tous,
Une question qu'on a certainement deja du poser, mais je ne retrouve plus
la reponse:
Sous windows:
J'ai un .bat qui contient une ligne de commande du genre
java -jar monJar.jar
Lorsque je double click sur mon batch, celui-ci m'ouvre une console dos.
Or, je ne veut pas que la console apparaisse...
Comment je fais?
(J'ai essaye javaw a la place de java sous XP, mais sans succes).
Par avance merci a tous.
A+
Salut a tous,
Une question qu'on a certainement deja du poser, mais je ne retrouve plus
la reponse:
Sous windows:
J'ai un .bat qui contient une ligne de commande du genre
java -jar monJar.jar
Lorsque je double click sur mon batch, celui-ci m'ouvre une console dos.
Or, je ne veut pas que la console apparaisse...
Comment je fais?
(J'ai essaye javaw a la place de java sous XP, mais sans succes).
Par avance merci a tous.
A+
Salut a tous,
Une question qu'on a certainement deja du poser, mais je ne retrouve plus
la reponse:
Sous windows:
J'ai un .bat qui contient une ligne de commande du genre
java -jar monJar.jar
Lorsque je double click sur mon batch, celui-ci m'ouvre une console dos.
Or, je ne veut pas que la console apparaisse...
Comment je fais?
(J'ai essaye javaw a la place de java sous XP, mais sans succes).
Par avance merci a tous.
A+
Salut a tous,
Une question qu'on a certainement deja du poser, mais je ne retrouve plus
la reponse:
Sous windows:
J'ai un .bat qui contient une ligne de commande du genre
java -jar monJar.jar
Lorsque je double click sur mon batch, celui-ci m'ouvre une console dos.
Or, je ne veut pas que la console apparaisse...
Comment je fais?
(J'ai essaye javaw a la place de java sous XP, mais sans succes).
Par avance merci a tous.
A+
Pourquoi créer un .bat?
Alors qu'un simple fichier Jar avec un META-INF/MANIFEST.INF résout le
problème
"ab" a écrit dans le message de news:
bme9rk$mka$Salut a tous,
Une question qu'on a certainement deja du poser, mais je ne retrouve plus
la reponse:
Sous windows:
J'ai un .bat qui contient une ligne de commande du genre
java -jar monJar.jar
Lorsque je double click sur mon batch, celui-ci m'ouvre une console dos.
Or, je ne veut pas que la console apparaisse...
Comment je fais?
(J'ai essaye javaw a la place de java sous XP, mais sans succes).
Par avance merci a tous.
A+
Pourquoi créer un .bat?
Alors qu'un simple fichier Jar avec un META-INF/MANIFEST.INF résout le
problème
"ab" <jean_bambois@yahoo.fr> a écrit dans le message de news:
bme9rk$mka$1@s1.read.news.oleane.net...
Salut a tous,
Une question qu'on a certainement deja du poser, mais je ne retrouve plus
la reponse:
Sous windows:
J'ai un .bat qui contient une ligne de commande du genre
java -jar monJar.jar
Lorsque je double click sur mon batch, celui-ci m'ouvre une console dos.
Or, je ne veut pas que la console apparaisse...
Comment je fais?
(J'ai essaye javaw a la place de java sous XP, mais sans succes).
Par avance merci a tous.
A+
Pourquoi créer un .bat?
Alors qu'un simple fichier Jar avec un META-INF/MANIFEST.INF résout le
problème
"ab" a écrit dans le message de news:
bme9rk$mka$Salut a tous,
Une question qu'on a certainement deja du poser, mais je ne retrouve plus
la reponse:
Sous windows:
J'ai un .bat qui contient une ligne de commande du genre
java -jar monJar.jar
Lorsque je double click sur mon batch, celui-ci m'ouvre une console dos.
Or, je ne veut pas que la console apparaisse...
Comment je fais?
(J'ai essaye javaw a la place de java sous XP, mais sans succes).
Par avance merci a tous.
A+
Je viens de compiler sans probleme. Par contre, comment l'utilises tu?
A+
-------------------------
Le source en question:
#include <windows.h>
/* Declare Windows procedure */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
/* Make the class name into a global variable */
char szClassName[ ] = "WindowsApp";
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
HWND hwnd; /* This is the handle for our window */
MSG messages; /* Here messages to the application are
saved */
WNDCLASSEX wincl; /* Data structure for the windowclass */
/* The Window structure */
wincl.hInstance = hThisInstance;
wincl.lpszClassName = szClassName;
wincl.lpfnWndProc = WindowProcedure; /* This function is called
by windows */
wincl.style = CS_DBLCLKS; /* Catch double-clicks */
wincl.cbSize = sizeof (WNDCLASSEX);
/* Use default icon and mouse-pointer */
wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
wincl.lpszMenuName = NULL; /* No menu */
wincl.cbClsExtra = 0; /* No extra bytes after
the window class */
wincl.cbWndExtra = 0; /* structure or the window
instance */
/* Use Windows's default color as the background of the window */
wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
/* Register the window class, and if it fails quit the program */
if (!RegisterClassEx (&wincl))
return 0;
/* The class is registered, let's create the program*/
hwnd = CreateWindowEx (
0, /* Extended possibilites for variation */
szClassName, /* Classname */
"Windows App", /* Title Text */
WS_OVERLAPPEDWINDOW, /* default window */
CW_USEDEFAULT, /* Windows decides the position */
CW_USEDEFAULT, /* where the window ends up on the screen
*/
544, /* The programs width */
375, /* and height in pixels */
HWND_DESKTOP, /* The window is a child-window to
desktop */
NULL, /* No menu */
hThisInstance, /* Program Instance handler */
NULL /* No Window Creation data */
);
/* Make the window visible on the screen */
//ShowWindow (hwnd, nFunsterStil);
STARTUPINFO si ;
PROCESS_INFORMATION pi ;
ZeroMemory(&si, sizeof(si)) ;
si.cb = sizeof(si) ;
ZeroMemory(&pi, sizeof(pi)) ;
bool b = CreateProcessA(NULL, "javaw.exe TA_MAIN_CLASS", NULL, NULL,
false, CREATE_NO_WINDOW, NULL, NULL, &si, &pi) ;
CloseHandle(pi.hThread) ;
CloseHandle(pi.hProcess) ;
/* Run the message loop. It will run until GetMessage() returns 0 */
//while (GetMessage (&messages, NULL, 0, 0)) {
/* Translate virtual-key messages into character messages */
//TranslateMessage(&messages);
/* Send message to WindowProcedure */
//DispatchMessage(&messages);
//}
/* The program return-value is 0 - The value that PostQuitMessage()
gave */
return messages.wParam;
}
/* This function is called by the Windows function DispatchMessage() */
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam,
LPARAM lParam) {
switch (message) /* handle the messages */
{
case WM_DESTROY:
PostQuitMessage (0); /* send a WM_QUIT to the message
queue */
break;
default: /* for messages that we don't deal
with */
return DefWindowProc (hwnd, message, wParam, lParam);
}
return 0;
}
Je viens de compiler sans probleme. Par contre, comment l'utilises tu?
A+
-------------------------
Le source en question:
#include <windows.h>
/* Declare Windows procedure */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
/* Make the class name into a global variable */
char szClassName[ ] = "WindowsApp";
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
HWND hwnd; /* This is the handle for our window */
MSG messages; /* Here messages to the application are
saved */
WNDCLASSEX wincl; /* Data structure for the windowclass */
/* The Window structure */
wincl.hInstance = hThisInstance;
wincl.lpszClassName = szClassName;
wincl.lpfnWndProc = WindowProcedure; /* This function is called
by windows */
wincl.style = CS_DBLCLKS; /* Catch double-clicks */
wincl.cbSize = sizeof (WNDCLASSEX);
/* Use default icon and mouse-pointer */
wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
wincl.lpszMenuName = NULL; /* No menu */
wincl.cbClsExtra = 0; /* No extra bytes after
the window class */
wincl.cbWndExtra = 0; /* structure or the window
instance */
/* Use Windows's default color as the background of the window */
wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
/* Register the window class, and if it fails quit the program */
if (!RegisterClassEx (&wincl))
return 0;
/* The class is registered, let's create the program*/
hwnd = CreateWindowEx (
0, /* Extended possibilites for variation */
szClassName, /* Classname */
"Windows App", /* Title Text */
WS_OVERLAPPEDWINDOW, /* default window */
CW_USEDEFAULT, /* Windows decides the position */
CW_USEDEFAULT, /* where the window ends up on the screen
*/
544, /* The programs width */
375, /* and height in pixels */
HWND_DESKTOP, /* The window is a child-window to
desktop */
NULL, /* No menu */
hThisInstance, /* Program Instance handler */
NULL /* No Window Creation data */
);
/* Make the window visible on the screen */
//ShowWindow (hwnd, nFunsterStil);
STARTUPINFO si ;
PROCESS_INFORMATION pi ;
ZeroMemory(&si, sizeof(si)) ;
si.cb = sizeof(si) ;
ZeroMemory(&pi, sizeof(pi)) ;
bool b = CreateProcessA(NULL, "javaw.exe TA_MAIN_CLASS", NULL, NULL,
false, CREATE_NO_WINDOW, NULL, NULL, &si, &pi) ;
CloseHandle(pi.hThread) ;
CloseHandle(pi.hProcess) ;
/* Run the message loop. It will run until GetMessage() returns 0 */
//while (GetMessage (&messages, NULL, 0, 0)) {
/* Translate virtual-key messages into character messages */
//TranslateMessage(&messages);
/* Send message to WindowProcedure */
//DispatchMessage(&messages);
//}
/* The program return-value is 0 - The value that PostQuitMessage()
gave */
return messages.wParam;
}
/* This function is called by the Windows function DispatchMessage() */
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam,
LPARAM lParam) {
switch (message) /* handle the messages */
{
case WM_DESTROY:
PostQuitMessage (0); /* send a WM_QUIT to the message
queue */
break;
default: /* for messages that we don't deal
with */
return DefWindowProc (hwnd, message, wParam, lParam);
}
return 0;
}
Je viens de compiler sans probleme. Par contre, comment l'utilises tu?
A+
-------------------------
Le source en question:
#include <windows.h>
/* Declare Windows procedure */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
/* Make the class name into a global variable */
char szClassName[ ] = "WindowsApp";
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
HWND hwnd; /* This is the handle for our window */
MSG messages; /* Here messages to the application are
saved */
WNDCLASSEX wincl; /* Data structure for the windowclass */
/* The Window structure */
wincl.hInstance = hThisInstance;
wincl.lpszClassName = szClassName;
wincl.lpfnWndProc = WindowProcedure; /* This function is called
by windows */
wincl.style = CS_DBLCLKS; /* Catch double-clicks */
wincl.cbSize = sizeof (WNDCLASSEX);
/* Use default icon and mouse-pointer */
wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
wincl.lpszMenuName = NULL; /* No menu */
wincl.cbClsExtra = 0; /* No extra bytes after
the window class */
wincl.cbWndExtra = 0; /* structure or the window
instance */
/* Use Windows's default color as the background of the window */
wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
/* Register the window class, and if it fails quit the program */
if (!RegisterClassEx (&wincl))
return 0;
/* The class is registered, let's create the program*/
hwnd = CreateWindowEx (
0, /* Extended possibilites for variation */
szClassName, /* Classname */
"Windows App", /* Title Text */
WS_OVERLAPPEDWINDOW, /* default window */
CW_USEDEFAULT, /* Windows decides the position */
CW_USEDEFAULT, /* where the window ends up on the screen
*/
544, /* The programs width */
375, /* and height in pixels */
HWND_DESKTOP, /* The window is a child-window to
desktop */
NULL, /* No menu */
hThisInstance, /* Program Instance handler */
NULL /* No Window Creation data */
);
/* Make the window visible on the screen */
//ShowWindow (hwnd, nFunsterStil);
STARTUPINFO si ;
PROCESS_INFORMATION pi ;
ZeroMemory(&si, sizeof(si)) ;
si.cb = sizeof(si) ;
ZeroMemory(&pi, sizeof(pi)) ;
bool b = CreateProcessA(NULL, "javaw.exe TA_MAIN_CLASS", NULL, NULL,
false, CREATE_NO_WINDOW, NULL, NULL, &si, &pi) ;
CloseHandle(pi.hThread) ;
CloseHandle(pi.hProcess) ;
/* Run the message loop. It will run until GetMessage() returns 0 */
//while (GetMessage (&messages, NULL, 0, 0)) {
/* Translate virtual-key messages into character messages */
//TranslateMessage(&messages);
/* Send message to WindowProcedure */
//DispatchMessage(&messages);
//}
/* The program return-value is 0 - The value that PostQuitMessage()
gave */
return messages.wParam;
}
/* This function is called by the Windows function DispatchMessage() */
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam,
LPARAM lParam) {
switch (message) /* handle the messages */
{
case WM_DESTROY:
PostQuitMessage (0); /* send a WM_QUIT to the message
queue */
break;
default: /* for messages that we don't deal
with */
return DefWindowProc (hwnd, message, wParam, lParam);
}
return 0;
}
En fait, pour l'instant mon bat ressemble a ca:
@echo off
%JAVA_HOME%jrebinjavaw -classpath %CLASSPATH% myclass --param1
xxx --param2 yyy 2> error.log
exit
Peux tu developper la solution que tu propose? Je ne vois pas vraiment ce
que tu veux faire.
En fait, pour l'instant mon bat ressemble a ca:
@echo off
%JAVA_HOME%jrebinjavaw -classpath %CLASSPATH% myclass --param1
xxx --param2 yyy 2> error.log
exit
Peux tu developper la solution que tu propose? Je ne vois pas vraiment ce
que tu veux faire.
En fait, pour l'instant mon bat ressemble a ca:
@echo off
%JAVA_HOME%jrebinjavaw -classpath %CLASSPATH% myclass --param1
xxx --param2 yyy 2> error.log
exit
Peux tu developper la solution que tu propose? Je ne vois pas vraiment ce
que tu veux faire.
Dans le code, tu trouves la ligne :
bool b = CreateProcessA(NULL, "javaw.exe TA_MAIN_CLASS", NULL, NULL, false,
CREATE_NO_WINDOW, NULL, NULL, &si, &pi) ;
et tu modifies selon ton, besoin :
bool b = CreateProcessA(NULL, "javaw.exe myclass --param1 xxx --param2 yyy
2", NULL, NULL, false, CREATE_NO_WINDOW, NULL, NULL, &si, &pi) ;
capito !
Pour répondre à ton thread de dessous. Quand tu fabrique une appli Java, il
est bon de stocker tes classes au sein d'un fichier archive de type JAR.
Dans l'archive tu peux donner un point d'entrée à ton application via un
fichier MANIFEST. Et dans la ligne MAIN tu précises ton main. Regarde des
exemples sur Google.
Bon code,
Ulrich.
PS : Il s'agit de deux solutions de lancement différentes.
"fm" a écrit dans le message de news:
bmee64$pp2$Je viens de compiler sans probleme. Par contre, comment l'utilises tu?
A+
-------------------------
Le source en question:
#include <windows.h>
/* Declare Windows procedure */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
/* Make the class name into a global variable */
char szClassName[ ] = "WindowsApp";
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
HWND hwnd; /* This is the handle for our window */
MSG messages; /* Here messages to the application are
saved */WNDCLASSEX wincl; /* Data structure for the windowclass */
/* The Window structure */
wincl.hInstance = hThisInstance;
wincl.lpszClassName = szClassName;
wincl.lpfnWndProc = WindowProcedure; /* This function is called
by windows */wincl.style = CS_DBLCLKS; /* Catch double-clicks */
wincl.cbSize = sizeof (WNDCLASSEX);
/* Use default icon and mouse-pointer */
wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
wincl.lpszMenuName = NULL; /* No menu */
wincl.cbClsExtra = 0; /* No extra bytes after
the window class */wincl.cbWndExtra = 0; /* structure or the window
instance *//* Use Windows's default color as the background of the window */
wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
/* Register the window class, and if it fails quit the program */
if (!RegisterClassEx (&wincl))
return 0;
/* The class is registered, let's create the program*/
hwnd = CreateWindowEx (
0, /* Extended possibilites for variation */
szClassName, /* Classname */
"Windows App", /* Title Text */
WS_OVERLAPPEDWINDOW, /* default window */
CW_USEDEFAULT, /* Windows decides the position */
CW_USEDEFAULT, /* where the window ends up on the screen
*/544, /* The programs width */
375, /* and height in pixels */
HWND_DESKTOP, /* The window is a child-window to
desktop */NULL, /* No menu */
hThisInstance, /* Program Instance handler */
NULL /* No Window Creation data */
);
/* Make the window visible on the screen */
//ShowWindow (hwnd, nFunsterStil);
STARTUPINFO si ;
PROCESS_INFORMATION pi ;
ZeroMemory(&si, sizeof(si)) ;
si.cb = sizeof(si) ;
ZeroMemory(&pi, sizeof(pi)) ;
bool b = CreateProcessA(NULL, "javaw.exe TA_MAIN_CLASS", NULL, NULL,
false, CREATE_NO_WINDOW, NULL, NULL, &si, &pi) ;CloseHandle(pi.hThread) ;
CloseHandle(pi.hProcess) ;
/* Run the message loop. It will run until GetMessage() returns 0 */
//while (GetMessage (&messages, NULL, 0, 0)) {
/* Translate virtual-key messages into character messages */
//TranslateMessage(&messages);
/* Send message to WindowProcedure */
//DispatchMessage(&messages);
//}
/* The program return-value is 0 - The value that PostQuitMessage()
gave */return messages.wParam;
}
/* This function is called by the Windows function DispatchMessage() */
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam,
LPARAM lParam) {switch (message) /* handle the messages */
{
case WM_DESTROY:
PostQuitMessage (0); /* send a WM_QUIT to the message
queue */break;
default: /* for messages that we don't deal
with */return DefWindowProc (hwnd, message, wParam, lParam);
}
return 0;
}
Dans le code, tu trouves la ligne :
bool b = CreateProcessA(NULL, "javaw.exe TA_MAIN_CLASS", NULL, NULL, false,
CREATE_NO_WINDOW, NULL, NULL, &si, &pi) ;
et tu modifies selon ton, besoin :
bool b = CreateProcessA(NULL, "javaw.exe myclass --param1 xxx --param2 yyy
2", NULL, NULL, false, CREATE_NO_WINDOW, NULL, NULL, &si, &pi) ;
capito !
Pour répondre à ton thread de dessous. Quand tu fabrique une appli Java, il
est bon de stocker tes classes au sein d'un fichier archive de type JAR.
Dans l'archive tu peux donner un point d'entrée à ton application via un
fichier MANIFEST. Et dans la ligne MAIN tu précises ton main. Regarde des
exemples sur Google.
Bon code,
Ulrich.
PS : Il s'agit de deux solutions de lancement différentes.
"fm" <jean_bambois@yahoo.fr> a écrit dans le message de news:
bmee64$pp2$1@s1.read.news.oleane.net...
Je viens de compiler sans probleme. Par contre, comment l'utilises tu?
A+
-------------------------
Le source en question:
#include <windows.h>
/* Declare Windows procedure */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
/* Make the class name into a global variable */
char szClassName[ ] = "WindowsApp";
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
HWND hwnd; /* This is the handle for our window */
MSG messages; /* Here messages to the application are
saved */
WNDCLASSEX wincl; /* Data structure for the windowclass */
/* The Window structure */
wincl.hInstance = hThisInstance;
wincl.lpszClassName = szClassName;
wincl.lpfnWndProc = WindowProcedure; /* This function is called
by windows */
wincl.style = CS_DBLCLKS; /* Catch double-clicks */
wincl.cbSize = sizeof (WNDCLASSEX);
/* Use default icon and mouse-pointer */
wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
wincl.lpszMenuName = NULL; /* No menu */
wincl.cbClsExtra = 0; /* No extra bytes after
the window class */
wincl.cbWndExtra = 0; /* structure or the window
instance */
/* Use Windows's default color as the background of the window */
wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
/* Register the window class, and if it fails quit the program */
if (!RegisterClassEx (&wincl))
return 0;
/* The class is registered, let's create the program*/
hwnd = CreateWindowEx (
0, /* Extended possibilites for variation */
szClassName, /* Classname */
"Windows App", /* Title Text */
WS_OVERLAPPEDWINDOW, /* default window */
CW_USEDEFAULT, /* Windows decides the position */
CW_USEDEFAULT, /* where the window ends up on the screen
*/
544, /* The programs width */
375, /* and height in pixels */
HWND_DESKTOP, /* The window is a child-window to
desktop */
NULL, /* No menu */
hThisInstance, /* Program Instance handler */
NULL /* No Window Creation data */
);
/* Make the window visible on the screen */
//ShowWindow (hwnd, nFunsterStil);
STARTUPINFO si ;
PROCESS_INFORMATION pi ;
ZeroMemory(&si, sizeof(si)) ;
si.cb = sizeof(si) ;
ZeroMemory(&pi, sizeof(pi)) ;
bool b = CreateProcessA(NULL, "javaw.exe TA_MAIN_CLASS", NULL, NULL,
false, CREATE_NO_WINDOW, NULL, NULL, &si, &pi) ;
CloseHandle(pi.hThread) ;
CloseHandle(pi.hProcess) ;
/* Run the message loop. It will run until GetMessage() returns 0 */
//while (GetMessage (&messages, NULL, 0, 0)) {
/* Translate virtual-key messages into character messages */
//TranslateMessage(&messages);
/* Send message to WindowProcedure */
//DispatchMessage(&messages);
//}
/* The program return-value is 0 - The value that PostQuitMessage()
gave */
return messages.wParam;
}
/* This function is called by the Windows function DispatchMessage() */
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam,
LPARAM lParam) {
switch (message) /* handle the messages */
{
case WM_DESTROY:
PostQuitMessage (0); /* send a WM_QUIT to the message
queue */
break;
default: /* for messages that we don't deal
with */
return DefWindowProc (hwnd, message, wParam, lParam);
}
return 0;
}
Dans le code, tu trouves la ligne :
bool b = CreateProcessA(NULL, "javaw.exe TA_MAIN_CLASS", NULL, NULL, false,
CREATE_NO_WINDOW, NULL, NULL, &si, &pi) ;
et tu modifies selon ton, besoin :
bool b = CreateProcessA(NULL, "javaw.exe myclass --param1 xxx --param2 yyy
2", NULL, NULL, false, CREATE_NO_WINDOW, NULL, NULL, &si, &pi) ;
capito !
Pour répondre à ton thread de dessous. Quand tu fabrique une appli Java, il
est bon de stocker tes classes au sein d'un fichier archive de type JAR.
Dans l'archive tu peux donner un point d'entrée à ton application via un
fichier MANIFEST. Et dans la ligne MAIN tu précises ton main. Regarde des
exemples sur Google.
Bon code,
Ulrich.
PS : Il s'agit de deux solutions de lancement différentes.
"fm" a écrit dans le message de news:
bmee64$pp2$Je viens de compiler sans probleme. Par contre, comment l'utilises tu?
A+
-------------------------
Le source en question:
#include <windows.h>
/* Declare Windows procedure */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
/* Make the class name into a global variable */
char szClassName[ ] = "WindowsApp";
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
HWND hwnd; /* This is the handle for our window */
MSG messages; /* Here messages to the application are
saved */WNDCLASSEX wincl; /* Data structure for the windowclass */
/* The Window structure */
wincl.hInstance = hThisInstance;
wincl.lpszClassName = szClassName;
wincl.lpfnWndProc = WindowProcedure; /* This function is called
by windows */wincl.style = CS_DBLCLKS; /* Catch double-clicks */
wincl.cbSize = sizeof (WNDCLASSEX);
/* Use default icon and mouse-pointer */
wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
wincl.lpszMenuName = NULL; /* No menu */
wincl.cbClsExtra = 0; /* No extra bytes after
the window class */wincl.cbWndExtra = 0; /* structure or the window
instance *//* Use Windows's default color as the background of the window */
wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
/* Register the window class, and if it fails quit the program */
if (!RegisterClassEx (&wincl))
return 0;
/* The class is registered, let's create the program*/
hwnd = CreateWindowEx (
0, /* Extended possibilites for variation */
szClassName, /* Classname */
"Windows App", /* Title Text */
WS_OVERLAPPEDWINDOW, /* default window */
CW_USEDEFAULT, /* Windows decides the position */
CW_USEDEFAULT, /* where the window ends up on the screen
*/544, /* The programs width */
375, /* and height in pixels */
HWND_DESKTOP, /* The window is a child-window to
desktop */NULL, /* No menu */
hThisInstance, /* Program Instance handler */
NULL /* No Window Creation data */
);
/* Make the window visible on the screen */
//ShowWindow (hwnd, nFunsterStil);
STARTUPINFO si ;
PROCESS_INFORMATION pi ;
ZeroMemory(&si, sizeof(si)) ;
si.cb = sizeof(si) ;
ZeroMemory(&pi, sizeof(pi)) ;
bool b = CreateProcessA(NULL, "javaw.exe TA_MAIN_CLASS", NULL, NULL,
false, CREATE_NO_WINDOW, NULL, NULL, &si, &pi) ;CloseHandle(pi.hThread) ;
CloseHandle(pi.hProcess) ;
/* Run the message loop. It will run until GetMessage() returns 0 */
//while (GetMessage (&messages, NULL, 0, 0)) {
/* Translate virtual-key messages into character messages */
//TranslateMessage(&messages);
/* Send message to WindowProcedure */
//DispatchMessage(&messages);
//}
/* The program return-value is 0 - The value that PostQuitMessage()
gave */return messages.wParam;
}
/* This function is called by the Windows function DispatchMessage() */
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam,
LPARAM lParam) {switch (message) /* handle the messages */
{
case WM_DESTROY:
PostQuitMessage (0); /* send a WM_QUIT to the message
queue */break;
default: /* for messages that we don't deal
with */return DefWindowProc (hwnd, message, wParam, lParam);
}
return 0;
}