Every time i try to compile c code i get different errors each time. Could someone explain why. It is every program i try to compile.
Here is the source code:
/*@@ Wedit generated application. Written Mon Apr 10 12:39:03 2006
@@header: c:\user2sid\user2sidres.h
@@resources: c:\user2sid\user2sid.rc
Do not edit outside the indicated areas */
/*<---------------------------------------------------------------------->*/
/*<---------------------------------------------------------------------->*/
#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include <string.h>
#include "user2sidres.h"
/*<---------------------------------------------------------------------->*/
HINSTANCE hInst; // Instance handle
HWND hwndMain; //Main window handle
LRESULT CALLBACK MainWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
/* --- The following code comes from C:\lcc\lib\wizard\statbar.tpl. */
// Global Variables for the status bar control.
HWND hWndStatusbar;
/*------------------------------------------------------------------------
Procedure: UpdateStatusBar ID:1
Purpose: Updates the statusbar control with the appropiate
text
Input: lpszStatusString: Charactar string that will be shown
partNumber: index of the status bar part number.
displayFlags: Decoration flags
Output: none
Errors: none
------------------------------------------------------------------------*/
void UpdateStatusBar(LPSTR lpszStatusString, WORD partNumber, WORD displayFlags)
{
SendMessage(hWndStatusbar,
SB_SETTEXT,
partNumber | displayFlags,
(LPARAM)lpszStatusString);
}
/*------------------------------------------------------------------------
Procedure: MsgMenuSelect ID:1
Purpose: Shows in the status bar a descriptive explaation of
the purpose of each menu item.The message
WM_MENUSELECT is sent when the user starts browsing
the menu for each menu item where the mouse passes.
Input: Standard windows.
Output: The string from the resources string table is shown
Errors: If the string is not found nothing will be shown.
------------------------------------------------------------------------*/
LRESULT MsgMenuSelect(HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
{
static char szBuffer[256];
UINT nStringID = 0;
UINT fuFlags = GET_WM_MENUSELECT_FLAGS(wparam, lparam) & 0xffff;
UINT uCmd = GET_WM_MENUSELECT_CMD(wparam, lparam);
HMENU hMenu = GET_WM_MENUSELECT_HMENU(wparam, lparam);
szBuffer[0] = 0; // First reset the buffer
if (fuFlags == 0xffff && hMenu == NULL) // Menu has been closed
nStringID = 0;
else if (fuFlags & MFT_SEPARATOR) // Ignore separators
nStringID = 0;
else if (fuFlags & MF_POPUP) // Popup menu
{
if (fuFlags & MF_SYSMENU) // System menu
nStringID = IDS_SYSMENU;
else
// Get string ID for popup menu from idPopup array.
nStringID = 0;
} // for MF_POPUP
else // Must be a command item
nStringID = uCmd; // String ID == Command ID
// Load the string if we have an ID
if (0 != nStringID)
LoadString(hInst, nStringID, szBuffer, sizeof(szBuffer));
// Finally... send the string to the status bar
UpdateStatusBar(szBuffer, 0, 0);
return 0;
}
/*------------------------------------------------------------------------
Procedure: InitializeStatusBar ID:1
Purpose: Initialize the status bar
Input: hwndParent: the parent window
nrOfParts: The status bar can contain more than one
part. What is difficult, is to figure out how this
should be drawn. So, for the time being only one is
being used...
Output: The status bar is created
Errors:
------------------------------------------------------------------------*/
void InitializeStatusBar(HWND hwndParent,int nrOfParts)
{
const int cSpaceInBetween = 8;
int ptArray[40]; // Array defining the number of parts/sections
RECT rect;
HDC hDC;
/* * Fill in the ptArray... */
hDC = GetDC(hwndParent);
GetClientRect(hwndParent, &rect);
ptArray[nrOfParts-1] = rect.right;
//---TODO--- Add code to calculate the size of each part of the status
// bar here.
ReleaseDC(hwndParent, hDC);
SendMessage(hWndStatusbar,
SB_SETPARTS,
nrOfParts,
(LPARAM)(LPINT)ptArray);
UpdateStatusBar("Ready", 0, 0);
//---TODO--- Add code to update all fields of the status bar here.
// As an example, look at the calls commented out below.
// UpdateStatusBar("Cursor Pos:", 1, SBT_POPOUT);
// UpdateStatusBar("Time:", 3, SBT_POPOUT);
}
/*------------------------------------------------------------------------
Procedure: CreateSBar ID:1
Purpose: Calls CreateStatusWindow to create the status bar
Input: hwndParent: the parent window
initial text: the initial contents of the status bar
Output:
Errors:
------------------------------------------------------------------------*/
static BOOL CreateSBar(HWND hwndParent,char *initialText,int nrOfParts)
{
hWndStatusbar = CreateStatusWindow(WS_CHILD | WS_VISIBLE | WS_BORDER|SBARS_SIZEGRIP,
initialText,
hwndParent,
IDM_STATUSBAR);
if(hWndStatusbar)
{
InitializeStatusBar(hwndParent,nrOfParts);
return TRUE;
}
return FALSE;
}
/*<---------------------------------------------------------------------->*/
/*@@0->@@*/
static BOOL InitApplication(void)
{
WNDCLASS wc;
memset(&wc,0,sizeof(WNDCLASS));
wc.style = CS_HREDRAW|CS_VREDRAW |CS_DBLCLKS ;
wc.lpfnWndProc = (WNDPROC)MainWndProc;
wc.hInstance = hInst;
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszClassName = "user2sidWndClass";
wc.lpszMenuName = MAKEINTRESOURCE(IDMAINMENU);
wc.hCursor = LoadCursor(NULL,IDC_ARROW);
wc.hIcon = LoadIcon(NULL,IDI_APPLICATION);
if (!RegisterClass(&wc))
return 0;
/*@@0<-@@*/
// ---TODO--- Call module specific initialization routines here
return 1;
}
/*<---------------------------------------------------------------------->*/
/*@@1->@@*/
HWND Createuser2sidWndClassWnd(void)
{
return CreateWindow("user2sidWndClass","user2sid",
WS_MINIMIZEBOX|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_MAXIMIZEBOX|WS_CAPTION|WS_BORDER|WS_SYSMENU|WS_THICKFRAME,
CW_USEDEFAULT,0,CW_USEDEFAULT,0,
NULL,
NULL,
hInst,
NULL);
}
/*@@1<-@@*/
/*<---------------------------------------------------------------------->*/
/* --- The following code comes from C:\lcc\lib\wizard\defOnCmd.tpl. */
void MainWndProc_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
switch(id) {
// ---TODO--- Add new menu commands here
/*@@NEWCOMMANDS@@*/
case IDM_EXIT:
PostMessage(hwnd,WM_CLOSE,0,0);
break;
}
}
/*<---------------------------------------------------------------------->*/
/*@@2->@@*/
LRESULT CALLBACK MainWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
switch (msg) {
/*@@3->@@*/
case WM_SIZE:
SendMessage(hWndStatusbar,msg,wParam,lParam);
InitializeStatusBar(hWndStatusbar,1);
break;
case WM_MENUSELECT:
return MsgMenuSelect(hwnd,msg,wParam,lParam);
case WM_COMMAND:
HANDLE_WM_COMMAND(hwnd,wParam,lParam,MainWndProc_OnCommand);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd,msg,wParam,lParam);
}
/*@@3<-@@*/
return 0;
}
/*@@2<-@@*/
/*<---------------------------------------------------------------------->*/
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow)
{
MSG msg;
HANDLE hAccelTable;
hInst = hInstance;
if (!InitApplication())
return 0;
hAccelTable = LoadAccelerators(hInst,MAKEINTRESOURCE(IDACCEL));
if ((hwndMain = Createuser2sidWndClassWnd()) == (HWND)0)
return 0;
CreateSBar(hwndMain,"Ready",1);
ShowWindow(hwndMain,SW_SHOW);
while (GetMessage(&msg,NULL,0,0)) {
if (!TranslateAccelerator(msg.hwnd,hAccelTable,&msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return msg.wParam;
}
Here is the error:
------ Build started: Project: test2, Configuration: Debug Win32 ------
Compiling...
user2sid.c
c:\program files\microsoft visual studio 8\vc\include\winnt.h(3035) : warning C4103: 'c:\program files\microsoft visual studio 8\vc\include\winnt.h' : alignment changed after including header, may be due to missing #pragma pack(pop)
c:\program files\microsoft visual studio 8\vc\include\winnt.h(3327) : warning C4103: 'c:\program files\microsoft visual studio 8\vc\include\winnt.h' : alignment changed after including header, may be due to missing #pragma pack(pop)
c:\program files\microsoft visual studio 8\vc\include\winnt.h(3423) : warning C4068: unknown pragma
c:\program files\microsoft visual studio 8\vc\include\winnt.h(3428) : warning C4068: unknown pragma
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1252) : error C2054: expected '(' to follow 'DECLSPEC_NORETURN'
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1252) : error C2085: 'ExitProcess' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1253) : error C2061: syntax error : identifier 'DECLSPEC_NORETURN'
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1313) : error C2054: expected '(' to follow 'DECLSPEC_NORETURN'
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1313) : error C2085: 'FreeLibraryAndExitThread' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1317) : error C2085: 'FreeResource' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1319) : error C2085: 'FreeSid' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1320) : error C2085: 'GetAce' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1321) : error C2085: 'GetAclInformation' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1322) : error C2085: 'GetAtomNameA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1323) : error C2085: 'GetAtomNameW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1324) : error C2085: 'GetBinaryTypeA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1325) : error C2085: 'GetBinaryTypeW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1326) : error C2085: 'GetCommandLineA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1327) : error C2085: 'GetCommandLineW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1328) : error C2085: 'GetCommConfig' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1329) : error C2085: 'GetCommMask' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1330) : error C2085: 'GetCommModemStatus' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1331) : error C2085: 'GetCommProperties' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1332) : error C2085: 'GetCommState' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1333) : error C2085: 'GetCommTimeouts' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1334) : error C2085: 'GetCompressedFileSizeA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1335) : error C2085: 'GetCompressedFileSizeW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1336) : error C2085: 'GetComputerNameA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1337) : error C2085: 'GetComputerNameW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1345) : error C2085: 'GetCurrentDirectoryA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1346) : error C2085: 'GetCurrentDirectoryW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1347) : error C2085: 'GetCurrentHwProfileA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1348) : error C2085: 'GetCurrentHwProfileW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1349) : error C2085: 'GetCurrentProcess' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1350) : error C2085: 'GetCurrentProcessId' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1351) : error C2085: 'GetCurrentThread' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1352) : error C2085: 'GetCurrentThreadId' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1354) : error C2085: 'GetDefaultCommConfigA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1355) : error C2085: 'GetDefaultCommConfigW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1356) : error C2085: 'GetDiskFreeSpaceA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1357) : error C2085: 'GetDiskFreeSpaceW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1358) : error C2085: 'GetDiskFreeSpaceExA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1359) : error C2085: 'GetDiskFreeSpaceExW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1364) : error C2085: 'GetDriveTypeA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1365) : error C2085: 'GetDriveTypeW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1366) : error C2085: 'GetEnvironmentStrings' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1367) : error C2085: 'GetEnvironmentStringsA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1368) : error C2085: 'GetEnvironmentStringsW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1369) : error C2085: 'GetEnvironmentVariableA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1370) : error C2085: 'GetEnvironmentVariableW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1371) : error C2085: 'GetExitCodeProcess' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1372) : error C2085: 'GetExitCodeThread' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1373) : error C2085: 'GetFileAttributesA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1374) : error C2085: 'GetFileAttributesW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1375) : error C2085: 'GetFileAttributesExA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1376) : error C2085: 'GetFileAttributesExW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1377) : error C2085: 'GetFileInformationByHandle' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1378) : error C2085: 'GetFileSecurityA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1379) : error C2085: 'GetFileSecurityW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1380) : error C2085: 'GetFileSize' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1384) : error C2085: 'GetFileTime' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1385) : error C2085: 'GetFileType' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1387) : error C2085: 'GetFullPathNameA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1388) : error C2085: 'GetFullPathNameW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1389) : error C2085: 'GetHandleInformation' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1390) : error C2085: 'GetKernelObjectSecurity' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1391) : error C2085: 'GetLastError' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1392) : error C2085: 'GetLengthSid' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1393) : error C2085: 'GetLocalTime' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1394) : error C2085: 'GetLogicalDrives' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1395) : error C2085: 'GetLogicalDriveStringsA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1396) : error C2085: 'GetLogicalDriveStringsW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1401) : error C2085: 'GetMailslotInfo' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1402) : error C2085: 'GetModuleFileNameA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1403) : error C2085: 'GetModuleFileNameW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1404) : error C2085: 'GetModuleHandleA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1405) : error C2085: 'GetModuleHandleW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1410) : error C2085: 'GetNamedPipeHandleStateA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1411) : error C2085: 'GetNamedPipeHandleStateW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1412) : error C2085: 'GetNamedPipeInfo' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1416) : error C2085: 'GetNumberOfEventLogRecords' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1417) : error C2085: 'GetOldestEventLogRecord' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1418) : error C2085: 'GetOverlappedResult' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1419) : error C2085: 'GetPriorityClass' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1420) : error C2085: 'GetPrivateObjectSecurity' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1421) : error C2085: 'GetPrivateProfileIntA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1422) : error C2085: 'GetPrivateProfileIntW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1423) : error C2085: 'GetPrivateProfileSectionA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1424) : error C2085: 'GetPrivateProfileSectionW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1425) : error C2085: 'GetPrivateProfileSectionNamesA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1426) : error C2085: 'GetPrivateProfileSectionNamesW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1427) : error C2085: 'GetPrivateProfileStringA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1428) : error C2085: 'GetPrivateProfileStringW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1429) : error C2085: 'GetPrivateProfileStructA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1430) : error C2085: 'GetPrivateProfileStructW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1431) : error C2085: 'GetProcAddress' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1432) : error C2085: 'GetProcessAffinityMask' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1436) : error C2085: 'GetProcessHeap' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1437) : error C2085: 'GetProcessHeaps' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1444) : error C2085: 'GetProcessPriorityBoost' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1445) : error C2085: 'GetProcessShutdownParameters' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1446) : error C2085: 'GetProcessTimes' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1447) : error C2085: 'GetProcessVersion' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1448) : error C2085: 'GetProcessWindowStation' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1449) : error C2085: 'GetProcessWorkingSetSize' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1449) : fatal error C1003: error count exceeds 100; stopping compilation
Build log was saved at "file://c:\c++\Debug\BuildLog.htm"
test2 - 102 error(s), 4 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
JOhn B. CCNA, CCDA, MCSA, NETWORK+, A+
Here is the source code:
/*@@ Wedit generated application. Written Mon Apr 10 12:39:03 2006
@@header: c:\user2sid\user2sidres.h
@@resources: c:\user2sid\user2sid.rc
Do not edit outside the indicated areas */
/*<---------------------------------------------------------------------->*/
/*<---------------------------------------------------------------------->*/
#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include <string.h>
#include "user2sidres.h"
/*<---------------------------------------------------------------------->*/
HINSTANCE hInst; // Instance handle
HWND hwndMain; //Main window handle
LRESULT CALLBACK MainWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
/* --- The following code comes from C:\lcc\lib\wizard\statbar.tpl. */
// Global Variables for the status bar control.
HWND hWndStatusbar;
/*------------------------------------------------------------------------
Procedure: UpdateStatusBar ID:1
Purpose: Updates the statusbar control with the appropiate
text
Input: lpszStatusString: Charactar string that will be shown
partNumber: index of the status bar part number.
displayFlags: Decoration flags
Output: none
Errors: none
------------------------------------------------------------------------*/
void UpdateStatusBar(LPSTR lpszStatusString, WORD partNumber, WORD displayFlags)
{
SendMessage(hWndStatusbar,
SB_SETTEXT,
partNumber | displayFlags,
(LPARAM)lpszStatusString);
}
/*------------------------------------------------------------------------
Procedure: MsgMenuSelect ID:1
Purpose: Shows in the status bar a descriptive explaation of
the purpose of each menu item.The message
WM_MENUSELECT is sent when the user starts browsing
the menu for each menu item where the mouse passes.
Input: Standard windows.
Output: The string from the resources string table is shown
Errors: If the string is not found nothing will be shown.
------------------------------------------------------------------------*/
LRESULT MsgMenuSelect(HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
{
static char szBuffer[256];
UINT nStringID = 0;
UINT fuFlags = GET_WM_MENUSELECT_FLAGS(wparam, lparam) & 0xffff;
UINT uCmd = GET_WM_MENUSELECT_CMD(wparam, lparam);
HMENU hMenu = GET_WM_MENUSELECT_HMENU(wparam, lparam);
szBuffer[0] = 0; // First reset the buffer
if (fuFlags == 0xffff && hMenu == NULL) // Menu has been closed
nStringID = 0;
else if (fuFlags & MFT_SEPARATOR) // Ignore separators
nStringID = 0;
else if (fuFlags & MF_POPUP) // Popup menu
{
if (fuFlags & MF_SYSMENU) // System menu
nStringID = IDS_SYSMENU;
else
// Get string ID for popup menu from idPopup array.
nStringID = 0;
} // for MF_POPUP
else // Must be a command item
nStringID = uCmd; // String ID == Command ID
// Load the string if we have an ID
if (0 != nStringID)
LoadString(hInst, nStringID, szBuffer, sizeof(szBuffer));
// Finally... send the string to the status bar
UpdateStatusBar(szBuffer, 0, 0);
return 0;
}
/*------------------------------------------------------------------------
Procedure: InitializeStatusBar ID:1
Purpose: Initialize the status bar
Input: hwndParent: the parent window
nrOfParts: The status bar can contain more than one
part. What is difficult, is to figure out how this
should be drawn. So, for the time being only one is
being used...
Output: The status bar is created
Errors:
------------------------------------------------------------------------*/
void InitializeStatusBar(HWND hwndParent,int nrOfParts)
{
const int cSpaceInBetween = 8;
int ptArray[40]; // Array defining the number of parts/sections
RECT rect;
HDC hDC;
/* * Fill in the ptArray... */
hDC = GetDC(hwndParent);
GetClientRect(hwndParent, &rect);
ptArray[nrOfParts-1] = rect.right;
//---TODO--- Add code to calculate the size of each part of the status
// bar here.
ReleaseDC(hwndParent, hDC);
SendMessage(hWndStatusbar,
SB_SETPARTS,
nrOfParts,
(LPARAM)(LPINT)ptArray);
UpdateStatusBar("Ready", 0, 0);
//---TODO--- Add code to update all fields of the status bar here.
// As an example, look at the calls commented out below.
// UpdateStatusBar("Cursor Pos:", 1, SBT_POPOUT);
// UpdateStatusBar("Time:", 3, SBT_POPOUT);
}
/*------------------------------------------------------------------------
Procedure: CreateSBar ID:1
Purpose: Calls CreateStatusWindow to create the status bar
Input: hwndParent: the parent window
initial text: the initial contents of the status bar
Output:
Errors:
------------------------------------------------------------------------*/
static BOOL CreateSBar(HWND hwndParent,char *initialText,int nrOfParts)
{
hWndStatusbar = CreateStatusWindow(WS_CHILD | WS_VISIBLE | WS_BORDER|SBARS_SIZEGRIP,
initialText,
hwndParent,
IDM_STATUSBAR);
if(hWndStatusbar)
{
InitializeStatusBar(hwndParent,nrOfParts);
return TRUE;
}
return FALSE;
}
/*<---------------------------------------------------------------------->*/
/*@@0->@@*/
static BOOL InitApplication(void)
{
WNDCLASS wc;
memset(&wc,0,sizeof(WNDCLASS));
wc.style = CS_HREDRAW|CS_VREDRAW |CS_DBLCLKS ;
wc.lpfnWndProc = (WNDPROC)MainWndProc;
wc.hInstance = hInst;
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszClassName = "user2sidWndClass";
wc.lpszMenuName = MAKEINTRESOURCE(IDMAINMENU);
wc.hCursor = LoadCursor(NULL,IDC_ARROW);
wc.hIcon = LoadIcon(NULL,IDI_APPLICATION);
if (!RegisterClass(&wc))
return 0;
/*@@0<-@@*/
// ---TODO--- Call module specific initialization routines here
return 1;
}
/*<---------------------------------------------------------------------->*/
/*@@1->@@*/
HWND Createuser2sidWndClassWnd(void)
{
return CreateWindow("user2sidWndClass","user2sid",
WS_MINIMIZEBOX|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_MAXIMIZEBOX|WS_CAPTION|WS_BORDER|WS_SYSMENU|WS_THICKFRAME,
CW_USEDEFAULT,0,CW_USEDEFAULT,0,
NULL,
NULL,
hInst,
NULL);
}
/*@@1<-@@*/
/*<---------------------------------------------------------------------->*/
/* --- The following code comes from C:\lcc\lib\wizard\defOnCmd.tpl. */
void MainWndProc_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
switch(id) {
// ---TODO--- Add new menu commands here
/*@@NEWCOMMANDS@@*/
case IDM_EXIT:
PostMessage(hwnd,WM_CLOSE,0,0);
break;
}
}
/*<---------------------------------------------------------------------->*/
/*@@2->@@*/
LRESULT CALLBACK MainWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
switch (msg) {
/*@@3->@@*/
case WM_SIZE:
SendMessage(hWndStatusbar,msg,wParam,lParam);
InitializeStatusBar(hWndStatusbar,1);
break;
case WM_MENUSELECT:
return MsgMenuSelect(hwnd,msg,wParam,lParam);
case WM_COMMAND:
HANDLE_WM_COMMAND(hwnd,wParam,lParam,MainWndProc_OnCommand);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd,msg,wParam,lParam);
}
/*@@3<-@@*/
return 0;
}
/*@@2<-@@*/
/*<---------------------------------------------------------------------->*/
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow)
{
MSG msg;
HANDLE hAccelTable;
hInst = hInstance;
if (!InitApplication())
return 0;
hAccelTable = LoadAccelerators(hInst,MAKEINTRESOURCE(IDACCEL));
if ((hwndMain = Createuser2sidWndClassWnd()) == (HWND)0)
return 0;
CreateSBar(hwndMain,"Ready",1);
ShowWindow(hwndMain,SW_SHOW);
while (GetMessage(&msg,NULL,0,0)) {
if (!TranslateAccelerator(msg.hwnd,hAccelTable,&msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return msg.wParam;
}
Here is the error:
------ Build started: Project: test2, Configuration: Debug Win32 ------
Compiling...
user2sid.c
c:\program files\microsoft visual studio 8\vc\include\winnt.h(3035) : warning C4103: 'c:\program files\microsoft visual studio 8\vc\include\winnt.h' : alignment changed after including header, may be due to missing #pragma pack(pop)
c:\program files\microsoft visual studio 8\vc\include\winnt.h(3327) : warning C4103: 'c:\program files\microsoft visual studio 8\vc\include\winnt.h' : alignment changed after including header, may be due to missing #pragma pack(pop)
c:\program files\microsoft visual studio 8\vc\include\winnt.h(3423) : warning C4068: unknown pragma
c:\program files\microsoft visual studio 8\vc\include\winnt.h(3428) : warning C4068: unknown pragma
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1252) : error C2054: expected '(' to follow 'DECLSPEC_NORETURN'
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1252) : error C2085: 'ExitProcess' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1253) : error C2061: syntax error : identifier 'DECLSPEC_NORETURN'
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1313) : error C2054: expected '(' to follow 'DECLSPEC_NORETURN'
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1313) : error C2085: 'FreeLibraryAndExitThread' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1317) : error C2085: 'FreeResource' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1319) : error C2085: 'FreeSid' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1320) : error C2085: 'GetAce' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1321) : error C2085: 'GetAclInformation' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1322) : error C2085: 'GetAtomNameA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1323) : error C2085: 'GetAtomNameW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1324) : error C2085: 'GetBinaryTypeA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1325) : error C2085: 'GetBinaryTypeW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1326) : error C2085: 'GetCommandLineA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1327) : error C2085: 'GetCommandLineW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1328) : error C2085: 'GetCommConfig' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1329) : error C2085: 'GetCommMask' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1330) : error C2085: 'GetCommModemStatus' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1331) : error C2085: 'GetCommProperties' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1332) : error C2085: 'GetCommState' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1333) : error C2085: 'GetCommTimeouts' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1334) : error C2085: 'GetCompressedFileSizeA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1335) : error C2085: 'GetCompressedFileSizeW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1336) : error C2085: 'GetComputerNameA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1337) : error C2085: 'GetComputerNameW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1345) : error C2085: 'GetCurrentDirectoryA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1346) : error C2085: 'GetCurrentDirectoryW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1347) : error C2085: 'GetCurrentHwProfileA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1348) : error C2085: 'GetCurrentHwProfileW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1349) : error C2085: 'GetCurrentProcess' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1350) : error C2085: 'GetCurrentProcessId' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1351) : error C2085: 'GetCurrentThread' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1352) : error C2085: 'GetCurrentThreadId' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1354) : error C2085: 'GetDefaultCommConfigA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1355) : error C2085: 'GetDefaultCommConfigW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1356) : error C2085: 'GetDiskFreeSpaceA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1357) : error C2085: 'GetDiskFreeSpaceW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1358) : error C2085: 'GetDiskFreeSpaceExA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1359) : error C2085: 'GetDiskFreeSpaceExW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1364) : error C2085: 'GetDriveTypeA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1365) : error C2085: 'GetDriveTypeW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1366) : error C2085: 'GetEnvironmentStrings' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1367) : error C2085: 'GetEnvironmentStringsA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1368) : error C2085: 'GetEnvironmentStringsW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1369) : error C2085: 'GetEnvironmentVariableA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1370) : error C2085: 'GetEnvironmentVariableW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1371) : error C2085: 'GetExitCodeProcess' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1372) : error C2085: 'GetExitCodeThread' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1373) : error C2085: 'GetFileAttributesA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1374) : error C2085: 'GetFileAttributesW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1375) : error C2085: 'GetFileAttributesExA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1376) : error C2085: 'GetFileAttributesExW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1377) : error C2085: 'GetFileInformationByHandle' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1378) : error C2085: 'GetFileSecurityA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1379) : error C2085: 'GetFileSecurityW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1380) : error C2085: 'GetFileSize' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1384) : error C2085: 'GetFileTime' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1385) : error C2085: 'GetFileType' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1387) : error C2085: 'GetFullPathNameA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1388) : error C2085: 'GetFullPathNameW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1389) : error C2085: 'GetHandleInformation' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1390) : error C2085: 'GetKernelObjectSecurity' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1391) : error C2085: 'GetLastError' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1392) : error C2085: 'GetLengthSid' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1393) : error C2085: 'GetLocalTime' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1394) : error C2085: 'GetLogicalDrives' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1395) : error C2085: 'GetLogicalDriveStringsA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1396) : error C2085: 'GetLogicalDriveStringsW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1401) : error C2085: 'GetMailslotInfo' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1402) : error C2085: 'GetModuleFileNameA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1403) : error C2085: 'GetModuleFileNameW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1404) : error C2085: 'GetModuleHandleA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1405) : error C2085: 'GetModuleHandleW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1410) : error C2085: 'GetNamedPipeHandleStateA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1411) : error C2085: 'GetNamedPipeHandleStateW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1412) : error C2085: 'GetNamedPipeInfo' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1416) : error C2085: 'GetNumberOfEventLogRecords' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1417) : error C2085: 'GetOldestEventLogRecord' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1418) : error C2085: 'GetOverlappedResult' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1419) : error C2085: 'GetPriorityClass' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1420) : error C2085: 'GetPrivateObjectSecurity' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1421) : error C2085: 'GetPrivateProfileIntA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1422) : error C2085: 'GetPrivateProfileIntW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1423) : error C2085: 'GetPrivateProfileSectionA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1424) : error C2085: 'GetPrivateProfileSectionW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1425) : error C2085: 'GetPrivateProfileSectionNamesA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1426) : error C2085: 'GetPrivateProfileSectionNamesW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1427) : error C2085: 'GetPrivateProfileStringA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1428) : error C2085: 'GetPrivateProfileStringW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1429) : error C2085: 'GetPrivateProfileStructA' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1430) : error C2085: 'GetPrivateProfileStructW' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1431) : error C2085: 'GetProcAddress' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1432) : error C2085: 'GetProcessAffinityMask' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1436) : error C2085: 'GetProcessHeap' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1437) : error C2085: 'GetProcessHeaps' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1444) : error C2085: 'GetProcessPriorityBoost' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1445) : error C2085: 'GetProcessShutdownParameters' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1446) : error C2085: 'GetProcessTimes' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1447) : error C2085: 'GetProcessVersion' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1448) : error C2085: 'GetProcessWindowStation' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1449) : error C2085: 'GetProcessWorkingSetSize' : not in formal parameter list
c:\program files\microsoft visual studio 8\vc\include\winbase.h(1449) : fatal error C1003: error count exceeds 100; stopping compilation
Build log was saved at "file://c:\c++\Debug\BuildLog.htm"
test2 - 102 error(s), 4 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
JOhn B. CCNA, CCDA, MCSA, NETWORK+, A+