Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

214 Neutral

About RonHiler

  • Rank
  1. I have a rich edit control, but in certain cases I need to resize it.   Basically, it comes down to this. I know the contents of the control. I know the width. Given those, I need to calculate the height.   I've played with all kinds of variations of EN_REQUESTRESIZE, but no matter the width of the window I pass in, it doesn't recalculate the height properly (I even deliberately set the window height to something ridiculous (5) to force a recalculation of the height of the REQRESIZE fuction, but it always comes back with the same values in rc->top and rc->bottom (0 and 825 to be exact)), so I think I need to do a more manual recalculation of the height of the window.   It seems like this should be something you ought to be able to do, but there doesn't seem to be an obvious way to do it.   Here is the code I am using:           case WM_NOTIFY:             {             ostringstream ss;             if (wParam == TTW_TOOLTIPTEXT)                 {                 if (((NMHDR*)lParam)->code == EN_REQUESTRESIZE)                     {                     GetWindowRect(ConfiningWindow, &ConfiningRect);                     ReqResize = (REQRESIZE*)lParam;                     GetCursorPos(&CursorPoint);                     X = CursorPoint.x + 10;                     Y = CursorPoint.y + 10;                     //don't fall off the bottom of the confining window                     if (Y + (ReqResize->rc.bottom - ReqResize->rc.top) +15 > ConfiningRect.bottom)                         Y = ConfiningRect.bottom - (ReqResize->rc.bottom - ReqResize->rc.top) - 15;                     //also, don't go past the right side of the main window                     if (X + (ReqResize->rc.right - ReqResize->rc.left) +15 > ConfiningRect.right)                         X = CursorPoint.x - (ReqResize->rc.right - ReqResize->rc.left) - 15;                     //at this point we should be entirely inside the window, unless the text is so large the tooltip is higher than the entire window itself.                     if (Y < ConfiningRect.top)                         {                         ss << "Retry: X,Y: " << X << "," << Y << "    ReqResize: " << ReqResize->rc.left << "," << ReqResize->rc.right << "," << ReqResize->rc.top << "," << ReqResize->rc.bottom << "    Confining: " << ConfiningRect.left << "," << ConfiningRect.right << "," << ConfiningRect.top << "," << ConfiningRect.bottom << "\r\n";                         OutputDebugString(ss.str().c_str());                         ReqResize->rc.right += 50;                         SetWindowPos(ToolTipWindow, HWND_TOPMOST, X, Y, ReqResize->rc.right - ReqResize->rc.left+8, ReqResize->rc.bottom - ReqResize->rc.top+8, SWP_HIDEWINDOW);                         SetWindowPos(ToolTipText, HWND_TOP, 0, 0, ReqResize->rc.right - ReqResize->rc.left, ReqResize->rc.bottom - ReqResize->rc.top, SWP_HIDEWINDOW);                         SendMessage(ReqResize->nmhdr.hwndFrom, EM_REQUESTRESIZE, 0, 0);                         return 0;                         }                       SetWindowPos(ToolTipWindow, HWND_TOPMOST, X, Y, ReqResize->rc.right - ReqResize->rc.left+8, ReqResize->rc.bottom - ReqResize->rc.top+8, SWP_SHOWWINDOW);                     SetWindowPos(ToolTipText, HWND_TOP, 0, 0, ReqResize->rc.right - ReqResize->rc.left, ReqResize->rc.bottom - ReqResize->rc.top, SWP_SHOWWINDOW);                     return 0;                     }                 return 0;                 }             return 0;             }     So, just to clarify, that ODS string gives values like such:   Retry: X,Y: 1015,30    ReqResize: 0,200,0,825    Confining: 460,1460,330,870 Retry: X,Y: 1015,30    ReqResize: 0,250,0,825    Confining: 460,1460,330,870 Retry: X,Y: 1015,30    ReqResize: 0,300,0,825    Confining: 460,1460,330,870   Notice ReqResize width is increasing by 50 at a time, but the height isn't changing.   Any suggestions?
  2.   Ahhh, there it is. It's a child window alright. I didn't know they couldn't be TOPMOST.   Huh. Now I have to figure out a way to get it to draw where I want. Drat it.
  3. Ah, gotcha.   It was a great idea, but still no go. With two separate calls, the window again moves and resizes, but still won't stay above other windows (one window in particular). It's the weirdest thing. The window drawing on top of it is definitely not a TopMost window. I wonder if I have an issue with painting or something. Grrrr.
  4.   The application is in the foreground (it is the acive application).   The hwnd is the active window. But just to be sure, I modified the code:     SetActiveWindow(ReqResize->nmhdr.hwndFrom);     SetWindowPos(ReqResize->nmhdr.hwndFrom, HWND_TOPMOST, X, Y, ReqResize->rc.right - ReqResize->rc.left, ReqResize->rc.bottom - ReqResize->rc.top, SWP_SHOWWINDOW); Sadly, no difference.   I gave this a try in place of SetWindowPos(), and it works just like HWND_TOP (even though I created the window with a WS_EX_TOPMOST flag, it's not acting as such). MoveWindow(ReqResize->nmhdr.hwndFrom, X, Y, ReqResize->rc.right - ReqResize->rc.left, ReqResize->rc.bottom - ReqResize->rc.top, true);   Uh, the window is moved and resized because the purpose of the routine is to move and resize the window. I think you are misunderstanding the purpose.
  5. Hey guys,   I have a weird problem I can't figure out:   This code is meant to calculate a position of a window and put it there. And it pretty much works just fine, the window appears where it is supposed to be. The only issue with it is I really need the final line to make it a topmost window.         case WM_NOTIFY:             {             if (wParam == MEW_TOOLTIPWINDOW || wParam == EW_TOOLTIPWINDOW)                 {                 if (((NMHDR*)lParam)->code == EN_REQUESTRESIZE)                     {                     ReqResize = (REQRESIZE*)lParam;                     GetWindowRect(EnhancementWindowHandle, &WindowRect);                     GetCursorPos(&CursorPoint);                     X = CursorPoint.x - WindowRect.left+10;                     Y = CursorPoint.y - WindowRect.top+10;                     //don't fall off the bottom of the main window                     if (Y + (ReqResize->rc.bottom - ReqResize->rc.top) > (WindowRect.bottom - WindowRect.top))                         Y = (WindowRect.bottom - WindowRect.top) - (ReqResize->rc.bottom - ReqResize->rc.top);                     //also, don't go past the right side of the main window                     if (X + (ReqResize->rc.right - ReqResize->rc.left) > (WindowRect.right - WindowRect.left))                         X = (CursorPoint.x - WindowRect.left) - (ReqResize->rc.right - ReqResize->rc.left) - 10;                     //at this point we should be entirely inside the window, unless the text is so large the tooltip is higher than the entire window itself.                     // TODO: Handle fringe case of too tall a tooltip window...                     SetWindowPos(ReqResize->nmhdr.hwndFrom, HWND_TOP, X, Y, ReqResize->rc.right - ReqResize->rc.left, ReqResize->rc.bottom - ReqResize->rc.top, SWP_SHOWWINDOW);                     }                 }             return 0;             } so I changed the final line to such:   SetWindowPos(ReqResize->nmhdr.hwndFrom, HWND_TOPMOST, X, Y, ReqResize->rc.right - ReqResize->rc.left, ReqResize->rc.bottom - ReqResize->rc.top, SWP_SHOWWINDOW); That's the only change I made, just changed HWND_TOP to HWND_TOPMOST. And the result is the window no longer resizes or moves. It is in it's default size at parent window 0,0. The return value of the function does not indicate a failure (return is non-zero), it just doesn't do what I expect it to do.   I even tried forcing it to move:   SetWindowPos(ReqResize->nmhdr.hwndFrom, HWND_TOPMOST, 100, 100, 500, 500, SWP_SHOWWINDOW); Same thing, it is ignoring the x, y, sizex, and sizey parameters when using HWND_TOPMOST   Any ideas why? What am I doing wrong?
  6. Hey guys, I'm hoping someone has some ideas on what might be happening. My program will hang when the user closes, but only after they print something. The Symptoms: The print works fine in every case. Even multiple prints in the same session. After a print, the program works just fine, everything appears normal. The program will close fine if no print has been done in that session. There is no time issue. If the user prints on a problematic printer, they can wait 30 minutes, then close the program, and the hangup will still occur. The hangup only occurs for SOME printers, others don't cause a hangup (tentatively, it seems like laser jets don't cause an issue, but ink-jets do). No errors are being reported by StartDoc(), StartPage(), EndPage(), or EndDoc(). The print routine creates a Pen and a few Fonts, but all of them are destroyed when the print is completed, and the original pen/fonts are reslected as such void SystemClass::PrintCleanup() { SelectObject(PrinterDC, OriginalFont); SelectObject(PrinterDC, OriginalPen); DeleteObject(Pen); DeleteObject(TNR); DeleteObject(TNRBold); DeleteObject(TNRLarge); DeleteObject(TNRSmall); DeleteDC(PrinterDC); Pen = nullptr; TNR = nullptr; TNRBold = nullptr; TNRLarge = nullptr; TNRSmall = nullptr; PrinterDC = nullptr; } Tracing the code, the program hits this line okay (which is just the handler for the quit button): if ((HWND)lParam == QuitButton) { PostQuitMessage(0); } return 0; Past this, the program goes into user32.dll and seems to hang inside there (where I can't see the code). Anyone have any ideas on what would be causing that?
  7. Hey guys, I need to have an input grid in my program. I have it working fine except for one detail. The grid itself is of fixed height, and I created it like such: VialGrid = CreateWindowEx(NULL, WC_LISTVIEW, "", WS_CHILD | WS_BORDER | LVS_REPORT | LVS_EDITLABELS | LBS_NOTIFY, 5, 270, 530, 250, MasterWindowHandle, (HMENU)ID_PDS_VIALGRID, Instance, NULL); //add gridlines to the vial grid box ListView_SetExtendedListViewStyle(VialGrid, LVS_EX_GRIDLINES); So the height of the overall window is 250, and that's where I want it to stay. The problem is the grid at that height displays about 15 and a half rows. I need for it to display exactly 11 rows. Which means I need to change the height of those rows. But I don't see a way to do that. There is a LVM_SETCOLUMNWIDTH message, but I don't see any corresponding LVM_SETROWHEIGHT message. What do I need to do to modify the row heights?
  8. Cool, thanks V-man, that was the problem (as I'm sure you knew). I bookmarked that page for future issues
  9. Hey guys, I'm doing something wrong, but I really can't figure out what it is. I create 4 textures during initialization, using this routine: void OGLWrapper::CreateTexture(void*, unsigned int Width, unsigned int Height, BYTE *Data, void**, GLuint *TextureOGL) { glGenTextures(1, TextureOGL); CheckError("CreateTexture (glGenTextures)"); glBindTexture(GL_TEXTURE_2D, *TextureOGL); CheckError("CreateTexture (glBindTexture)"); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, Width, Height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, Data); CheckError("CreateTexture (glTexImage2D)"); } That routine is called 4 times to create the four textures. The TextureOGL value is stored in the material class (and it turns out to be 1 through 4 for the 4 textures). This runs with no errors reported. Then I want to use those textures to draw. So I simply try to bind them again with this function, passing in the stored Texture: //--------------------------------------------------------------------------- void OGLWrapper::PSSetShaderResource(void*, void*, void*, void*, GLuint TextureOGL) { glBindTexture(GL_TEXTURE_2D, TextureOGL); CheckError("PSSetShaderResource"); } The values coming into this routine are in the range of 1 to 4, so they seem right. But the function is erroring with a GL_INVALID_VALUE. According to the docs, I get this error if "target is not a name returned from a previous call to glGenTextures". I'm not sure I understand that description, the prototype for that function is void GlBindTexture(GLenum target, GLuint texture); Did they mean "texture is not a name returned from.."? Because glGenTextures has nothing to do with the target as far as I can tell. But either way, the input parameters seem right, so I don't really understand what I'm doing wrong here. Anyone have any ideas? What am I missing?
  10. RonHiler

    Odd D3D9 bug

    Ack, never mind. I got it. Had to turn off the depth test. My bad.
  11. RonHiler

    Odd D3D9 bug

    Hey guys, so I have a very strange bug that is driving me nuts. Check out this shot rendered with D3D10. This is what it should look like: Okay, now here it is in D3D9 Now, ignoring the text difference (that's a different issue), notice in D3D9 the alpha blending is not working properly. So, okay, I figured I'd track it down in Pix. But when I ran it in Pix, it looked like the D3D10 version! Which is to say, the blending worked fine. However, when I run it in the MSVC IDE or straight from the exe file, it looks like the screenshot. So Pix isn't helping me (which is what is very strange about this). So without Pix to help me, I'm not sure where to look. Do you guys have any idea? This is my code for blending in D3D9 (minus error checking): //we don't have blend states in D3D9, so set render state to include an alpha blend static_cast<IDirect3DDevice9*>(Device)->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD); static_cast<IDirect3DDevice9*>(Device)->SetRenderState(D3DRS_BLENDOPALPHA, D3DBLENDOP_ADD); static_cast<IDirect3DDevice9*>(Device)->SetRenderState(D3DRS_ALPHABLENDENABLE, true); static_cast<IDirect3DDevice9*>(Device)->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_SRCALPHA); static_cast<IDirect3DDevice9*>(Device)->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA); static_cast<IDirect3DDevice9*>(Device)->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE,true); static_cast<IDirect3DDevice9*>(Device)->SetRenderState(D3DRS_SRCBLENDALPHA,D3DBLEND_ONE); static_cast<IDirect3DDevice9*>(Device)->SetRenderState(D3DRS_DESTBLENDALPHA,D3DBLEND_ZERO); compared to what I do for D3D10: BlendDesc.AlphaToCoverageEnable = false; for (unsigned int i=0; i<8; i++) { BlendDesc.BlendEnable = false; BlendDesc.RenderTargetWriteMask = D3D10_COLOR_WRITE_ENABLE_ALL; } BlendDesc.BlendEnable[0] = true; BlendDesc.BlendOp = D3D10_BLEND_OP_ADD; BlendDesc.BlendOpAlpha = D3D10_BLEND_OP_ADD; BlendDesc.DestBlend = D3D10_BLEND_INV_SRC_ALPHA; BlendDesc.DestBlendAlpha = D3D10_BLEND_ZERO; BlendDesc.SrcBlend = D3D10_BLEND_SRC_ALPHA; BlendDesc.SrcBlendAlpha = D3D10_BLEND_ONE; static_cast<ID3D10Device1*>(Device)->CreateBlendState(&BlendDesc, reinterpret_cast<ID3D10BlendState**>(BlendState)); So, what do you think? What else should I look at here?
  12. RonHiler

    Logging system Output

    Oh, definitely. I do want that functionality before the engine goes out and people other than me are using it. Otherwise I'm going to be lost when it comes to dealing with incoming bug reports. But for now, while the engine is in production, and the only one using it is me, I don't really need that, so it can wait. As long as I have a console output and an output to file (with independent verbosity levels), that's all I really need for the production phase.
  13. RonHiler

    Logging system Output

    Okay, thank for the advice everyone. I think, based on what you guys have said, and upon giving it some further thought, that I will (at least for now) stick with a simple .txt file. One of the reasons I was thinking html was to have the ability to spit out some useful information on the hardware, version numbers, DirectX versions, and so forth, in addition to the sequential event logging, and have it nicely formatted for use with bug reports. And I'd still like to do that at some point. However, for the moment, I can forgo that. As Gekko says, right now the only real reason I'll go into the logs is to figure out why something blows up. So it really doesn't need to be all that pretty.
  14. Hey guys, So I'm working on the logging system for my engine. I already (more or less) have output to console done, so I just want to create an output to file. I already have a file class that can create files, append to files, and so forth. And my string class can handle streaming in of text and numbers, so in terms of sending stuff to files, I'm golden. That's done. So I have turned my attention to what sort of output format I want. I could just create a .txt or a .log file and keep appending new log entries to the end and call it done. But I kind of want something a little more sophisticated than that. I was thinking something that could be opened in a browser, so an .html (or .xls or even .php?) file. The problem with that is the footers (.e. html closing tags and what have you). Since I'm logging events in chronological order, I have to keep adding stuff to the end of the file, but then I need those footers at the end. Plus, at any given time, I would like to always have a valid file (so that if the engine should crash, we at least have logs up to that point). Which means I can't just write the footers when the engine shuts down, they have to be there always. So you see my problem. I can't just append text to the end of the file, because then it would be after the closing tags. I suppose I could find where the closing tags start in the file, and start writing my new lines there, and rewrite the closing tags with each new entry. But that seems a bit inelegant. I was thinking perhaps I could actually write two files per log, one with all the standard html stuff but no actual data, and then a second file with just the data in it that could be written to sequentially. Then the first file would load the second into the proper place. The downside to that of course being that now there are two files per log, but perhaps I don't really care so much about that. Anyway, do you guys have any advice on the subject?
  15. RonHiler

    Color blending shader

    Hmm, that last equation doesn't work at all. I haven't gone through the math to figure out why, but I suspect there is a typo in there. I'll go through it in a bit. Anyway, with the code I posted, I get this: The two opacity values are the input alphas for the text and background, respectively. Everything is working as expected, except the last line looks light brown to me rather than grey. This was the code for that line: UIMgr.AddStaticText(Device, &TestString, &FontName, 0.3f, 0.55f, ColorRGBA(0, 0, 0, 0.5f), ColorRGBA(0.5f,0.5f,0.5f,1.0f)); As you can see, it should be partially transparent black on a medium grey with no transparency. But damned if it doesn't look brown, right? However, when I run it through Pix, it insists it is the right color (Final framebuffer value Alpha: 1.000, Red: 0.498, Green: 0.498, Blue: 0.498 for a pixel that looks brown). Photoshop agrees (RGB 127, 127, 127). If I run the same scene on a white background rather than blue, the offending line's background looks much more grey. Yet both Pix and Photoshop insist that it is the same exact color as before. So I guess I just chalk that up to it being an optical illusion because I'm looking at it on a blue background? BTW: I added one more line to the shader, just before returning the output: Output.a = max(pIn.BackgroundColor.a, Output.a); I did that because (without that correction) if the letter alpha is less than the background alpha, the screen background color will bleed through into the letter color pixels, which is not what I want. The minimum alpha value should always be the background alpha, it should never be less than that, and that's not what I was getting. There may be a better way to lerp it, I'll have to think about it. But this seems to work.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!