The only reason i cant upload a bitmap is because it says it has problems linking files.... is there something i missed? ask questions if u need any..
This is a discussion on Linking Files within the Windows Programming forums, part of the Platform Specific Boards category; The only reason i cant upload a bitmap is because it says it has problems linking files.... is there something ...
The only reason i cant upload a bitmap is because it says it has problems linking files.... is there something i missed? ask questions if u need any..
Code:#if _emo #define stereo_type_i_dislike #endif
OK...question 1 - what are you talking about??Originally posted by bluehead
The only reason i cant upload a bitmap is because it says it has problems linking files.... is there something i missed? ask questions if u need any..
Do you mean importing a bitmap as a resource?
i dont know! im asking you guys, lol, cus, when i try to compile, instead of being able to click on "execute" it says "show compiler results", and i click on that, and the title of the window is "Linker Output" and it has a bunch of **** like "C:\\dev C++\\blah blah" Object4@something" something...
post your code
Bmp_one.c
bmp_one.rcCode:#include <windows.h> #include "resource.h" const char g_szClassName[] = "myWindowClass"; HBITMAP g_hbmBall = NULL; LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_CREATE: g_hbmBall = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_BALL)); if(g_hbmBall == NULL) MessageBox(hwnd, "Could not load IDB_BALL!", "Error", MB_OK | MB_ICONEXCLAMATION); break; case WM_CLOSE: DestroyWindow(hwnd); break; case WM_PAINT: { // Just a note, never use a MessageBox from inside WM_PAINT // The box will cause more WM_PAINT messages and you'll probably end up // stuck in a loop BITMAP bm; PAINTSTRUCT ps; HDC hdc = BeginPaint(hwnd, &ps); HDC hdcMem = CreateCompatibleDC(hdc); HBITMAP hbmOld = SelectObject(hdcMem, g_hbmBall); GetObject(g_hbmBall, sizeof(bm), &bm); BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY); SelectObject(hdcMem, hbmOld); DeleteDC(hdcMem); EndPaint(hwnd, &ps); } break; case WM_DESTROY: DeleteObject(g_hbmBall); PostQuitMessage(0); break; default: return DefWindowProc(hwnd, msg, wParam, lParam); } return 0; } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { WNDCLASSEX wc; HWND hwnd; MSG Msg; wc.cbSize = sizeof(WNDCLASSEX); wc.style = 0; wc.lpfnWndProc = WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wc.lpszMenuName = NULL; wc.lpszClassName = g_szClassName; wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION); if(!RegisterClassEx(&wc)) { MessageBox(NULL, "Window Registration Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK); return 0; } hwnd = CreateWindowEx( WS_EX_CLIENTEDGE, g_szClassName, "A Bitmap Program", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 240, 120, NULL, NULL, hInstance, NULL); if(hwnd == NULL) { MessageBox(NULL, "Window Creation Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK); return 0; } ShowWindow(hwnd, nCmdShow); UpdateWindow(hwnd); while(GetMessage(&Msg, NULL, 0, 0) > 0) { TranslateMessage(&Msg); DispatchMessage(&Msg); } return Msg.wParam; }
and i cant find the .h file right now..Code:IDB_BALL BITMAP DISCARDABLE "ball.bmp"
maybe thats why, maybe i didn't use a .h file, can ya tell me what i put in there so i can test again
and dont forget the
#include "resource.h"
file in the .rc
Can one of you guys that are reading this, can you tell me a
1.) File name
2.)Code for the file name
and i'll copy + paste it and see if it works.. if it doesn't i'll tell u and u help me... if it does than i'll look over the code and see wut u have done...
Code:#if _emo #define stereo_type_i_dislike #endif