C
Cathy L. _
Guest
Hello
Here is the beginning of the code in my winmain:
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPWSTR lpCmdLine,
_In_ int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
// TODO: placez ici le code.
// Initialise les chaînes globales
WNDCLASSEXW wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_LUTHERIE));
wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_LUTHERIE);
wcex.lpszClassName = L"maclasse";
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
if (!RegisterClassExW(&wcex))
{
wchar_t err[256];
memset(err, 0, 256);
FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(),MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), err, 255, NULL);
MessageBoxW(NULL,err,(LPCWSTR)L"Erreur", MB_OK);
return -1;
}
// Effectue l'initialisation de l'application :
hInst = hInstance; // Stocke le handle d'instance dans la variable globale
hWindow = CreateWindowW(L"maclasse", L"Lignes de niveaux", WS_OVERLAPPEDWINDOW,CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr);
if (!hWindow)
{
return FALSE;
}
return 0;
...
}
If I put the "return 0;" before CreateWindow (and leave the program, so) everything seems OK, but if I do like written in the code above, it throws a 0xC0000005 exception reading 0x00000000 with Kernel32.dll
Any idea, please
Thanks
Cathy L.
Continue reading...
Here is the beginning of the code in my winmain:
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPWSTR lpCmdLine,
_In_ int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
// TODO: placez ici le code.
// Initialise les chaînes globales
WNDCLASSEXW wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_LUTHERIE));
wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_LUTHERIE);
wcex.lpszClassName = L"maclasse";
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
if (!RegisterClassExW(&wcex))
{
wchar_t err[256];
memset(err, 0, 256);
FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(),MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), err, 255, NULL);
MessageBoxW(NULL,err,(LPCWSTR)L"Erreur", MB_OK);
return -1;
}
// Effectue l'initialisation de l'application :
hInst = hInstance; // Stocke le handle d'instance dans la variable globale
hWindow = CreateWindowW(L"maclasse", L"Lignes de niveaux", WS_OVERLAPPEDWINDOW,CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr);
if (!hWindow)
{
return FALSE;
}
return 0;
...
}
If I put the "return 0;" before CreateWindow (and leave the program, so) everything seems OK, but if I do like written in the code above, it throws a 0xC0000005 exception reading 0x00000000 with Kernel32.dll
Any idea, please
Thanks
Cathy L.
Continue reading...