Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
T

TheDelChop

@TheDelChop
About
Posts
36
Topics
21
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • DirectDraw Question
    T TheDelChop

    Guys, I have a question concerning blitting to a DirectDraw7 surface using Blt. My objective here is to take the source surface, lets call it XYSurface, and blit it back onto itself, simply rotating it during the blit. Can I do something like this? LPDIRECTDRAWSURFACE7 pXYSurface; RECT rc; GetClintRect(hDlg, &rc); hRet = pXYSurface->Blt(&rc,pXYSurface,&rc,DDBLT_ROTATIONANGLE,&ddbltfx); if(hRet != DD_OK) { HandleDDErrors(hRet, errorMessage); MessageBox(NULL,errorMessage,"Error",MB_OK); return -1; } When I do this, hRet is DDERR_SURFACEBUSY. Which reveals that "Access to the surface is refused because the surface is locked by another thread." Is this because I am trying to Blit back on to the source? Thanks, Joe

    C / C++ / MFC question help

  • Launching Paint from different OS
    T TheDelChop

    Guys, I am writing a program that permits the user to launch paint from within my application if he/she chooses. Since my program must support a wide range of Windows OSs, I am faced with the dilemma that paint is located in different folders in different OSs. My question is, can I use the environment variable %SystemRoot% when specifying the location to launch? For example: C:\\%SystemRoot%\\System32\\mspaint.exe If this isn't the way to do it, any suggestions of a good way to do this?

    C / C++ / MFC question tutorial workspace

  • Bread bread bread bread
    T TheDelChop

    brianwelsch wrote:

    To be honest, I do get tired of conversations bogged down with exceptions and minute details and specs spelled out for common sense things.

    If the number of slices of bread in a loaf is so common sense then why can't you just give me an answer.

    brianwelsch wrote:

    I am curious why you're interested in slices of bread, though.

    I'm at work. I am bored. My board is out for X-Ray. I am planning my grocery shopping and was trying to figure out how many loaves of bread I need to buy. Yes, I understand when I go to the market I can just count them there and figure it out, but now I just want to know.

    The Lounge question

  • Bread bread bread bread
    T TheDelChop

    whoah, relax, just bustin some balls. No need for nasty language, as remember, I'm a programmer too.

    The Lounge question

  • Bread bread bread bread
    T TheDelChop

    DavidCrow wrote:

    There is no consistent number. Each manufacturer has different-sized (i.e., length) loaves. The thickness of each slice will also govern how many are in the package.

    leave it to a bunch of engineers to give me an answer like that. Can't anybody just count the slices of break in the loaf they have at their house, or do all you guys just live off the satisfaction that writing good code brings?

    The Lounge question

  • Bread bread bread bread
    T TheDelChop

    Ok anybody who's at home right now and has an unopened loaf of bread in the house, can you tell me how many slices (not counting the ends) are in it? Thanks, Joe

    The Lounge question

  • Downconverting froma 32-bit bitmap to a 4-bit bitmap
    T TheDelChop

    I am trying to create a 4-bit bitmap from a 32-bit bitmap. Obviously this demands some sort of downcoversion from the 32-bit pixel values to the 4-bit values. I call GetDIBits with a PBITMIPINFO that is a 4-bit bitmap with a 16 color table. GetDIBits will do the downcoversion for me automatically right?

    C / C++ / MFC graphics question

  • Creating a color table
    T TheDelChop

    Hi guys, I am trying to use the Win32 API to fill a bitmap, using the function GetDIBBits(). My source bitmap is a 32-bit image, but I am hoping to create a 4-bit destination bitmap. I am of the understanding that this requires me to create a color table, and keep it in a BITMAPINFO structure. Does anybody see a problem with this snippet of code? pbmi = (PBITMAPINFO) LocalAlloc(LPTR,sizeof(BITMAPINFO)); // Initialize the fields in the BITMAPINFO structure. pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER) + 16*sizeof(long); pbmi->bmiHeader.biWidth = bmp.bmWidth; pbmi->bmiHeader.biHeight = bmp.bmHeight; pbmi->bmiHeader.biPlanes = bmp.bmPlanes; pbmi->bmiHeader.biBitCount = 4; pbmi->bmiHeader.biCompression = BI_RGB; if (pbmi->bmiHeader.biSizeImage == 0) pbmi->bmiHeader.biSizeImage = WIDTHBYTES((DWORD)pbmi->bmiHeader.biWidth * pbmi->bmiHeader.biBitCount) * pbmi->bmiHeader.biHeight; pbmi->bmiHeader.biClrImportant = 0; for(i = 0; i<16; i++) { pbmi->bmiColors[i].rgbRed = 0; pbmi->bmiColors[i].rgbBlue = 0; pbmi->bmiColors[i].rgbGreen = 0; pbmi->bmiColors[i].rgbReserved = 0; } // Bright Red pbmi->bmiColors[1].rgbRed = 255; // Red pbmi->bmiColors[2].rgbRed = 128; // Bright Green pbmi->bmiColors[3].rgbGreen = 255; // Green pbmi->bmiColors[4].rgbGreen = 128; // Bright Blue pbmi->bmiColors[5].rgbBlue = 255; // Blue pbmi->bmiColors[6].rgbBlue = 128; //Yellow pbmi->bmiColors[7].rgbRed = 255; pbmi->bmiColors[7].rgbGreen = 255; //Brown pbmi->bmiColors[8].rgbRed = 128; pbmi->bmiColors[8].rgbGreen = 128; //Bright Magenta pbmi->bmiColors[9].rgbRed = 255; pbmi->bmiColors[9].rgbBlue = 255; //Magenta pbmi->bmiColors[10].rgbRed = 128; pbmi->bmiColors[10].rgbBlue = 128; //Bright Cyan pbmi->bmiColors[11].rgbGreen = 255; pbmi->bmiColors[11].rgbBlue = 255; //Cyan pbmi->bmiColors[12].rgbGreen = 128; pbmi->bmiColors[12].rgbBlue = 128; //Gray pbmi->bmiColors[13].rgbRed = 0; pbmi->bmiColors[13].rgbGreen = 128; pbmi->bmiColors[13].rgbBlue = 0; //Bright Gray pbmi->bmiColors[14].rgbRed = 192; pbmi->bmiColors[14].rgb

    C / C++ / MFC graphics json help question

  • GetDIBits() function call fails
    T TheDelChop

    Anybody see what the problem is with this code? GetDIBits fails, and when I call GetLastError(), it tells me that Windows "ERROR_FILE_NOT_FOUND". GetClientRect(hDlg, &rc); // Get the rectangle dimensions of the Dialog Box hdc = GetDC(hDlg); // Get a handle to the Drawing Context of the Dialog Box rc.bottom -= (GetSystemMetrics(SM_CYHSCROLL)+GetSystemMetrics(SM_CYEDGE)); hSavedXYContext = CreateCompatibleDC(hdc); // Create a drawing context that is compatiable to // the drawing context on the screen hSavedXYBitmap = CreateCompatibleBitmap(hdc, rc.right-rc.left,rc.bottom-rc.top); hTheDCsOriginalBitmap = (HBITMAP)SelectObject(hSavedXYContext, hSavedXYBitmap); BitBlt(hSavedXYContext,0,0,rc.right-rc.left, rc.bottom-rc.top,hdc,0,0,SRCCOPY); hSavedXYBitmap = (HBITMAP)SelectObject(hSavedXYContext, hTheDCsOriginalBitmap); // As far as I can tell above code does exactly what it should. It grabs a handle to the drawing // context, along with the rectangular coordinates of the drawing context. Then after creating // a compatible bitmap, and selecting it into the saved drawing context, before blting it in. // Now we have the DC saved to hSavedContext, so we need to take it and create a // bitmap file that we can open in Paint. // This involves creating a bmp structure then writing it to a file. GetObject(hSavedXYBitmap,sizeof(BITMAP),(LPSTR)(&bmp)); cClrBits = (WORD)(bmp.bmPlanes*bmp.bmBitsPixel); cClrBits = 4; pbmi = (PBITMAPINFO) LocalAlloc(LPTR,sizeof(BITMAPINFOHEADER)); // Initialize the fields in the BITMAPINFO structure. pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); pbmi->bmiHeader.biWidth = bmp.bmWidth; pbmi->bmiHeader.biHeight = bmp.bmHeight; pbmi->bmiHeader.biPlanes = bmp.bmPlanes; pbmi->bmiHeader.biBitCount =4; pbmi->bmiHeader.biCompression = BI_RGB; pbmi->bmiHeader.biSizeImage = (pbmi->bmiHeader.biWidth + 15)/16 * pbmi->bmiHeader.biHeight * 4; pbmi->bmiHeader.biClrImportant = 0; // Make sure to fill in the rest of the BITMAP info in the header. pBitmapInfoHeader = (PBITMAPINFOHEADER)pbmi; lpBits = (LPBYTE) GlobalAlloc(GMEM_FIXED,pbmi->bmiHeader.biSizeImage); test = GetDIBits(hdc

    C / C++ / MFC graphics help json question

  • Unselecting a bitmap in a context
    T TheDelChop

    Guys, I am attempting to take a drawing context, basically the entire area of a dialog box and save it as a bitmap so that I can open it up in Paint. I understand that I might be able to take a screen shot using Print Screen, but I only want the drawing area, not the menu and borders etc... This is my code, as far as I can tell it works until I make the call to GetDIBits. This function returns 0, and when I call GetLastError() it returns ERROR_FILE_NOT_FOUND. The function GetDIBits remarks that I must pass an bitmap that isn't selected into a DC. Could somebody give me a hint about where I am going wrong? I am not sure how to unselect an object from a DC, or how to create a copy of the DC after I Blt in the viewing area. GetClientRect(hDlg, &rc); // Get the rectangle dimensions of the Dialog Box hdc = GetDC(hDlg); // Get a handle to the Drawing Context of the Dialog Box blankDC = GetDC(NULL); rc.bottom -= (GetSystemMetrics(SM_CYHSCROLL)+GetSystemMetrics(SM_CYEDGE)); hSavedXYContext = CreateCompatibleDC(hdc); // Create a drawing context that is // compatiable to the drawing context on the screen hSavedXYBitmap = CreateCompatibleBitmap(hdc, rc.right-rc.left,rc.bottom-rc.top); hUnSelectedBitmap= CreateCompatibleBitmap(hdc,rc.right-rc.left,rc.bottom-rc.top); SelectObject(hSavedXYContext, hSavedXYBitmap); BitBlt(hSavedXYContext,0,0,rc.right-rc.left, rc.bottom-rc.top,hdc,0,0,SRCCOPY); // As far as I can tell above code does exactly what it should. It grabs a // handle to the drawing context, along with the rectangular coordinates of the // drawing context. Then after creating a compatible bitmap, and selecting it // into the saved drawing context, before blting it in. // Now we have the DC saved to hSavedContext, so we need to take it and create a // bitmap file that we can open in Paint. // This involves creating a bmp structure then writing it to a file. GetObject(hSavedXYBitmap,sizeof(BITMAP),(LPSTR)(&bmp)); cClrBits = (WORD)(bmp.bmPlanes*bmp.bmBitsPixel); cClrBits = 32; pbmi = (PBITMAPINFO) LocalAlloc(LPTR,sizeof(BITMAPINFOHEADER)); // Initialize the fields in the BITMAPINFO structure. pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); pbmi->

    C / C++ / MFC graphics help tutorial question

  • Main Arguments
    T TheDelChop

    Hi guys, I am writing a simple program that the user would like to be able to run from the command prompt. I am wondering how I pass that infromation into the main of my program. For example, if you wish to run Windows explorer from the command line you pass the command "explorer". This will launch Windows explorer and default to showing C:\. However, you can also call explorer and have it open a specific directory "explorer C:\Test\MyTest". My question is this: Is the second part of that simply passed as the argument to main? For example if I wanted my program to specify a string, could I have my main function accept a const char *? I.E. void main(const char *inputString) ? where inputString would be whatever it is that I have passed immediately after my *.exe name? so the total call would be something like: C:\> stringParser This Is My Test which would hopefully pass a pointer to "This is My Test" into my main argument. Thanks, Joe

    C / C++ / MFC question tutorial

  • Odd error when using GetDIBits
    T TheDelChop

    Guys, I am trying to make a call to retrieve the bitmap information from a drawing context. When calling GetDIBits, it returns NULL and when I call GetLastError() it gives me ERROR_FILE_NOT_FOUND. Could anybody shed some light on what exactly it is that Windows is trying to tell me?

    C / C++ / MFC graphics help question

  • Returning a class reference
    T TheDelChop

    Michael Dunn wrote:

    So you can write chained assignments like x = y = z; If y=z doesn't return a reference to y, then the second assignment may not compile, or may call some other operator= that you weren't expecting.

    Nice, this is exactly the explanation I was looking for. Thank you very much Mike.

    C / C++ / MFC question learning

  • Returning a class reference
    T TheDelChop

    Question about the 'this' pointer and properly returning a reference to an object. I am learning about OOP and working through some examples. One of the examples has me overloading the *= operator. CRegister& CRegister::operator *=(const CRegister &rhs) { this->m_dStore *= rhs.m_dStore; return *this; } I have two questions, why does an overloaded operator need to return a reference to the lvalue? Second if I did want to return the address of the lvalue shouldn't the code look like this? CRegister& CRegister::operator *=(const CRegister &rhs) { this->m_dStore *= rhs.m_dStore; return &this; } Or because 'this' is a pointer, by returning '&this' am I creating a second level of indirection, because i don't want the address of the 'this' pointer, but rather the address that the 'this' pointer points to? Thanks guys, Joe

    C / C++ / MFC question learning

  • The Windows GDI and Regions
    T TheDelChop

    Hola friends, I'm working with a Dialog Box that has a rectangle associated with it so that I may draw in it. However, I am interested in adding regions to the rectangle, which I don't seem to have too much trouble doing. However, once I add my regions (three) all of the code within my WM_PAINT message seems to be constricted to drawing within the last region. Does anyone know what happens to the DC when I create a region, and does anybody have any suggestions on how I might be able to change it back to the entire rectangle, like it was originally set? Thanks, Joe

    C / C++ / MFC graphics question

  • bind function in SDK
    T TheDelChop

    yeah, bind simply finds and open and available socket to commense ethernet communication. Without a binded socket, (an address through which the computer knows it can send data) it is impossible to process function like send and recv.

    C / C++ / MFC

  • Shading in regions of a graph
    T TheDelChop

    Hello, I am currently working on a simple program with the Windows API that will be drawing polygons in a dialog box to provide the user with a guide to the values that are being graphed over them. My question is this: I would like to be able to draw two shapes (bascially using the LineTo function and connecting all the lines) and then shade in the area between them. To give an example, think of a bullseye, I would like a large ring with a smaller ring inside it, with the larger ring colored in. Anyone have any suggestions on where to start? I am fairly new to the drawing functions in Windows. Thanks guys, Joe

    C / C++ / MFC tutorial question graphics data-structures json

  • Using Adobe Acrobat to open a .PDF
    T TheDelChop

    Hi, I am using the Windows API to write some code that uses the end user's already installed Adobe Acrobat Reader to open up a *.PDF file. My problem is locating the file. Everytime Adobe upgrades to another version of Adobe Acrobat the pathname changes, say for example from C:\Program Files\Adobe\Acrobat 5.0\Reader\Acrord32.exe to C:\Program Files\Adobe\Acrobat 7.0\Reader\Acrord32.exe which at the moment causes the routine to fail unless I have specified the correct directory. I am guessing there must be a much better way to do this, could anybody point me in the right direction? I would assume that you can ask the operating system what *.exe it uses to open up *.pdf and tell it to use that, but I am unsure how I code that. Could someone point me in the right direction? Thanks, Joe

    C / C++ / MFC adobe json help tutorial question

  • Problem displaying characters above the normal ASCII Range
    T TheDelChop

    I will try to post some code tomorrow, however, the keyboard procedure is pretty large, so I will try to post some relevent pieces.

    C / C++ / MFC json help tutorial

  • Problem displaying characters above the normal ASCII Range
    T TheDelChop

    Hello, I am working with an on-screen keyboard that was designed from scratch using the Win32 API, and it designed to be used with 4 or 5 languages. The keyboard works absolutely perfectly except when attempting to display some of the special characters for the other forgein languages(characters above 0x7F on the ASCII table). When I attempt to print these characters using the WM_CHAR message, the following character ÿ always appears before it. For example: If I were to press the "A" key, the edit box above the keyboard display "A". However, if I press the "Ö" button on the onscreen keyboard, the edit box about the keyboard displays "ÿÖ". I am totally stumped and was hoping anyone could provide any insight into why this is happening. Thanks in advance, Joe

    C / C++ / MFC json help tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups