Jump to content

Search the Community

Showing results for tags 'c++'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • The General Stuff
    • Announcements
    • Introduce Yourself!
    • General Discussion
  • Microsoft Software Products
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows Server
    • Older Windows NT-Family OSes
    • Windows 9x/ME
    • Other Microsoft Products
  • Unattended Windows Discussion & Support
    • Unattended Windows
    • Other Unattended Projects
  • Member Contributed Projects
    • Nuhi Utilities
    • Member Projects
    • Other Member Contributed Projects
    • Windows Updates Downloader
  • Software, Hardware, Media and Games
    • Forum Categories
    • Mobile Devices
  • Customizing Windows and Graphics
    • Customizing Windows
    • Customizing Graphics
  • Coding, Scripting and Servers
    • Web Development (HTML, Java, PHP, ASP, XML, etc.)
    • Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
    • Server - Side Help (IIS, Apache, etc.)
  • X's Concepts
  • The Compaq Computer Corporation Club's Discussion

Calendars

There are no results to display.

There are no results to display.

Product Groups

  • MSFN Sponsorship

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype

Found 3 results

  1. #include using namespace std; struct node { struct node* head; int date; struct node* later; }; struct node* headnode()//Create table header { struct node* head = new struct node; head->head = head; head->later = head; return head; } //Node struct node* headnode(int dat) { struct node* headnode = new struct node; headnode->date = dat; headnode->head = NULL; headnode->later = NULL; return headnode; } // void print(struct nodehead,int date)//Head insertion method { struct node newhead = headnode(date); newhead->head = head; newhead->later = head->later; head->later->head = newhead; newhead->later = newhead; } void printf(struct node* head)//print { struct node* newnode = head->later; while(newnode != head) { cout << newnode->date << endl; newnode = newnode->head; } } int main() { struct node* head = headnode(); print(head, 44); print(head, 33); print(head, 22); printf(head); cout << "Really hard" << endl; system("pause"); return 0; }
  2. Earlier versions of Windows come with CRTDLL.DLL, but not MSVCRT.DLL With a few minor patches to GCC it's possible to make it link against CRTDLL.DLL by default instead of MSVCRT.DLL. This means when you compile using the patched toolchain your program assuming it uses no features only available on newer versions of Windows will automatically work on older versions of Windows such as NT 3.51. By using the files from Mingw32 instead of Mingw-w64 it resolved an issue where DLLs would have a .tls section and LoadLibrary would fail on Windows 95 or it would cause crashing on Windows 98 or Windows 2000. I put C++ for pre-2000 in the title because I also patched out a few functions in libstdc++ which require Windows 2000 or later. If you are running Arch Linux you can checkout the PKGBUILD files. https://github.com/ComputerNerd/mingw32-crtdll If you are not a Linux person but want to use this, you can run Arch Linux using a Virtual Machine or look at the PKGBUILD files and run them manually.
  3. I want to make my programs compatible with all versions of Windows from Windows 95 to Windows 8. I'm currently working on a small word processor and I need to have working open and save file requesters. However, I can't seem to get the GetOpenFileName function to work properly. This is the code for a simple bitmap viewer program I made. It runs fine on Windows 98, XP, Vista, and 7, but on Windows 95, GetOpenFileName fails, and CommDlgExtendedError() returns error code 1 (CDERR_STRUCTSIZE). Now, I specified sizeof(ofn) for ofn.lStructSize, which should be valid, and it is on other Windows versions. Any ideas why this happens? #include <windows.h>#include <stdio.h>#include <commctrl.h>#define MSGBOX_ERROR(MESSAGE) MessageBox(NULL, MESSAGE, NULL, MB_OK|MB_ICONERROR)#define COMMAND_EXIT 9000#define COMMAND_OPEN 9001#define COMMAND_STRETCH 9002LRESULT CALLBACK MainWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){ static BOOL IsStretched; static HBITMAP hBmp; switch(msg) { case WM_PAINT: { if(hBmp==NULL) //Leave WM_PAINT to DefWindowProc if no bitmap is loaded. goto defwndproc; RECT client_rect; GetClientRect(hwnd,&client_rect); BITMAP bmp; PAINTSTRUCT ps; HDC hdc = BeginPaint(hwnd, &ps); HDC hdcmem = CreateCompatibleDC(hdc); HBITMAP hbmOld = SelectObject(hdcmem, hBmp); GetObject(hBmp,sizeof(bmp),&bmp); if(IsStretched) StretchBlt(hdc,0,0,client_rect.right-client_rect.left,client_rect.bottom-client_rect.top,hdcmem,0,0,bmp.bmWidth,bmp.bmHeight,SRCCOPY); else BitBlt(hdc,0,0,bmp.bmWidth,bmp.bmHeight,hdcmem,0,0,SRCCOPY); SelectObject(hdcmem, hbmOld); DeleteDC(hdcmem); EndPaint(hwnd, &ps); break; } case WM_CREATE: { HMENU hMenuBar = CreateMenu(); HMENU hFileMenu = CreatePopupMenu(); HMENU hViewMenu = CreatePopupMenu(); AppendMenu(hFileMenu,MF_STRING,COMMAND_OPEN,"&Open"); AppendMenu(hFileMenu,MF_SEPARATOR,0,NULL); AppendMenu(hFileMenu,MF_STRING,COMMAND_EXIT,"&Exit"); AppendMenu(hViewMenu,MF_STRING|MF_UNCHECKED,COMMAND_STRETCH,"&Stretch to fit window"); AppendMenu(hMenuBar,MF_STRING|MF_POPUP,(UINT)hFileMenu,"&File"); AppendMenu(hMenuBar,MF_STRING|MF_POPUP,(UINT)hViewMenu,"&View"); SetMenu(hwnd,hMenuBar); IsStretched = FALSE; break; } case WM_SIZE: if(IsStretched) InvalidateRect(hwnd,NULL,FALSE); break; case WM_COMMAND: switch(LOWORD(wParam)) { case COMMAND_OPEN: { OPENFILENAME ofn; char szFile[MAX_PATH]; ZeroMemory(&ofn,sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hwnd; ofn.lpstrFile = szFile; ofn.lpstrFile[0] = '\0'; ofn.nMaxFile = sizeof(szFile); ofn.lpstrFilter = "Windows Bitmap (*.bmp)\0*.bmp\0All Files\0*.*\0"; ofn.nFilterIndex = 1; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; ofn.lpstrInitialDir = NULL; ofn.Flags = OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST; GetOpenFileName(&ofn); //Testing to see if GetOpenFileName worked if(fopen(ofn.lpstrFile,"r")==NULL) { char errorbuf[20]; sprintf(errorbuf,"Failed to open a file. Error code: %hu",(unsigned short)CommDlgExtendedError()); MSGBOX_ERROR(errorbuf); return 0; } hBmp = LoadImage(NULL,szFile,IMAGE_BITMAP,0,0,LR_LOADFROMFILE); if(!hBmp) MSGBOX_ERROR("Failed to load bitmap."); InvalidateRect(hwnd,NULL,FALSE); UpdateWindow(hwnd); break; } case COMMAND_EXIT: goto close; case COMMAND_STRETCH: IsStretched = !IsStretched; InvalidateRect(hwnd,NULL,TRUE); break; } break; case WM_CLOSE: close: ExitProcess(0); default: defwndproc: return DefWindowProc(hwnd,msg,wParam,lParam); } return 0;}int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){ InitCommonControls(); WNDCLASS rwc; rwc.style = 0; rwc.lpfnWndProc = MainWndProc; rwc.cbClsExtra = 0; rwc.cbWndExtra = 0; rwc.hInstance = hInst; rwc.hIcon = NULL; rwc.hCursor = LoadCursor(NULL, IDC_ARROW); rwc.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE+1); rwc.lpszMenuName = NULL; rwc.lpszClassName = "yo mama"; RegisterClass(&rwc); HWND hMainWnd = CreateWindow("yo mama", "Bitmap Viewer", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 450, 450, 0, 0, hInst, 0); ShowWindow(hMainWnd,nCmdShow); UpdateWindow(hMainWnd); MSG msg; msgloop: GetMessage(&msg,NULL,0,0); TranslateMessage(&msg); DispatchMessage(&msg); goto msgloop;}


×
×
  • Create New...