Archived

This topic is now archived and is closed to further replies.

braves

odd problem

Recommended Posts

Hello everyone. I am hoping someone could tell me the problem with this code. This code works on Windows200 Professional but does not work on WindowsNT 4.0. I am using VisualC++ 6.0 with a windows api project and passing in a path in the program arguments inside of projects->settings debug tab. Now my code worked on both Windows2k Pro and windowsNT 4.0 yesterday, this was the code yesterday WndClass.cbSize = sizeof(WNDCLASSEX); WndClass.style = NULL; WndClass.lpfnWndProc = WindowFunc; WndClass.cbClsExtra = 0; WndClass.cbWndExtra = 0; WndClass.hInstance = hInstance; WndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION); WndClass.hCursor = LoadCursor(NULL, IDC_ARROW); WndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); WndClass.lpszMenuName = NULL; WndClass.lpszClassName = "test"; WndClass.hIconSm = LoadIcon(NULL, IDI_APPLICATION); if(!RegisterClassEx(&WndClass)) { MessageBox(0, "Window Registration Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL); return 0; } hwnd = CreateWindowEx( WS_EX_CLIENTEDGE, "test", "Rimage CD Feeder", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 320, 240, NULL, NULL, hInstance, NULL); if(hwnd == NULL) { MessageBox(0, "Window Creation Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL); return 0; } ShowWindow(hwnd, SW_MINIMIZE); UpdateWindow(hwnd); PostMessage(hwnd, WM_COMMAND, (WPARAM)NULL, (LPARAM)NULL); As I said this worked on both Win2k and WindowsNT 4.0 yesterday and I changed the code to look like this... if(strlen(lpszArgs)) { strcpy(INIFileName, lpszArgs); } else { GetModuleFileName(hInstance, INIFileName, MAX_PATH); ptrFilePosition = strrchr(INIFileName, ''.''); *(++ptrFilePosition) = NULL; strcat(INIFileName, "ini"); } WndClass.cbSize = sizeof(WNDCLASSEX); WndClass.style = NULL; WndClass.lpfnWndProc = WindowFunc; WndClass.cbClsExtra = 0; WndClass.cbWndExtra = 0; WndClass.hInstance = hInstance; WndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION); WndClass.hCursor = LoadCursor(NULL, IDC_ARROW); WndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); WndClass.lpszMenuName = NULL; WndClass.lpszClassName = "test"; WndClass.hIconSm = LoadIcon(NULL, IDI_APPLICATION); if(!RegisterClassEx(&WndClass)) { MessageBox(0, "Window Registration Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL); return 0; } hwnd = CreateWindowEx( WS_EX_CLIENTEDGE, "test", "Rimage CD Feeder", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 320, 240, NULL, NULL, hInstance, NULL); if(hwnd == NULL) { MessageBox(0, "Window Creation Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL); return 0; } ShowWindow(hwnd, SW_MINIMIZE); UpdateWindow(hwnd); PostMessage(hwnd, WM_COMMAND, (WPARAM)NULL, (LPARAM)NULL); where lpszArgs is the 3rd param from WinMain. I also modified another function including adding a new param to the function which gets called later in the program, which should have nothen to do with this problem i would think? Now When I run this code she works fine on both WindowsNT 4.o and Win2k Pro until I get to this part of the code : hwnd = CreateWindowEx( WS_EX_CLIENTEDGE, "test", "Rimage CD Feeder", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 320, 240, NULL, NULL, hInstance, NULL); When I get to this code she just ENDS with the message "The thread 0x36 has exited with code 1 (0x1)." and The program has exited with code 1 (0x1). Now when I run this on Windows2k it works fine, it creates the window and able to step through the rest of my program. I can''t figure out what could be wrong? I have tried this code on 1 windows2k pro machine which it works fine and 2 different WinNT 4.0 machines which it don''t work at all. Can someone tell me why i''m having this problem? Thanks in advance. Braves

Share this post


Link to post
Share on other sites