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
M

Mr Simple

@Mr Simple
About
Posts
21
Topics
6
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • GET_LENGTH_INFORMATION undefined.
    M Mr Simple

    Thanks!

    C / C++ / MFC help question

  • GET_LENGTH_INFORMATION undefined.
    M Mr Simple

    Hi, I am trying to use DeviceIoControl() to get a drive length into the GET_LENGTH_INFORMATION structure. When I compile, I get an error stating "GET_LENGTH_INFORMATION: undeclared identifier" I have included 'WinIOCtl.h' as specified in the MSDN docs. I am also running XP. The code used is simply; GET_LENGTH_INFORMATION len; Does anyone know why I should be getting these errors?? Thanks

    C / C++ / MFC help question

  • Clear text from a device context.
    M Mr Simple

    The entire text gets left behind (in the image below I have used 'rTextRect.OffsetRect(0, 20);' to space them out a bit to show this). http://i19.tinypic.com/8a4gh2w.jpg Thanks MS.

    C / C++ / MFC question

  • Clear text from a device context.
    M Mr Simple

    Mark Salsbery wrote:

    Your code works for me.

    Really??? :wtf: I have tried both but I still get the smudge either way (I have only tested on XP).

    C / C++ / MFC question

  • Clear text from a device context.
    M Mr Simple

    Hi, Everything in normal windows can be done in CE, sometimes you just need to go about it a bit differently. I have cut out everything from my project and managed to write a non-working class if you are interested. I wont have access to CE again until monday so wont be able to test the dialog thing yet. Below is the code, it is very simple as you can probably see. Just call the .CreateTransparent(this); and you should get a nice streak down the form. Once again, thanks for your help! MS. The .H; class CNotWorking : public CWnd { public: CNotWorking(void); ~CNotWorking(void); void CreateTransparent(CWnd *pParent); DECLARE_MESSAGE_MAP() afx_msg void OnPaint(); afx_msg void OnTimer(UINT nIDEvent); private: CRect rTextRect; UINT tTicker; }; ////////// And the .CPP; BEGIN_MESSAGE_MAP(CNotWorking, CWnd) ON_WM_PAINT() ON_WM_TIMER() END_MESSAGE_MAP() CNotWorking::CNotWorking(void) { rTextRect.SetRect(0, 0, 40, 20); tTicker = 0; } CNotWorking::~CNotWorking(void) { } void CNotWorking::CreateTransparent(CWnd *pParent) { // Create & flag as existing. CWnd::CreateEx(NULL, NULL, _T("Transparent"), WS_CHILD, 20, 20, 500, 500, pParent->GetSafeHwnd(), NULL); tTicker = ::SetTimer(*this, (UINT_PTR)12345, 20, NULL); ShowWindow(SW_SHOW); } void CNotWorking::OnPaint() { CPaintDC dc(this); // device context for painting dc.SetBkMode(TRANSPARENT); CString textStr = "test"; dc.DrawText(textStr, &rTextRect, DT_LEFT | DT_TOP); } void CNotWorking::OnTimer(UINT nIDEvent) { InvalidateRect(rTextRect); rTextRect.OffsetRect(0, 2); UpdateWindow(); CWnd::OnTimer(nIDEvent); }

    C / C++ / MFC question

  • Clear text from a device context.
    M Mr Simple

    Hello, The only major difference is that I am not using CImage, as I need to be able to TransparentBlt which I have been told there are problems with on WinCE. I converted your code closer to my existing (using CBitmap, transparency, removing erase bkground) and it worked great. Then I made my existing code practically idential, and it still didn't work :-( The only thing I can find different is the way I create the window. I have a method in the class called "CreateFloaterWnd" (parent as parameter) which loads the bitmap, gets it's size, then calls CWnd::CreateEx, positioning itself relative to the parent's X/Y location. I will try to convert it to use a dialog and see what happens. I still dont understand how this could be the problem though. Thank you very much for your effort!! MS.

    C / C++ / MFC question

  • Clear text from a device context.
    M Mr Simple

    Hi, I am using CreateCompatibleDC; CPaintDC dc(this); // device context for painting CDC *floatCDC = new CDC; floatCDC->CreateCompatibleDC(&dc); I have removed the region code, and can report having it there made no difference to my application. I had read about it in a 'funky shaped window' article and assumed I needed it, obviously I was wrong :-) I am not handling WM_ERASEBKGND. What I want to see is text moving on a transparent background. I have manged this to a degree, however when the text is moved, the old text remains underneath the new text. I think part of the problem is that I am drawing over the old text with a transparent image, so the old text is still visible. Any other ideas? Thank you for your time! MS

    C / C++ / MFC question

  • Clear text from a device context.
    M Mr Simple

    Hi, Unfortunately I could not get this to work either. Do you have any other ideas? This is being run on Win CE by the way. I didn't put the transparency stuff in the last post, but it comes just before the text is printed. A global region is made in the constructor with bits missing (missing bits are therefore transparent). The images are loaded into a CBitmap array. In OnPaint; To display the BMP; Create CDC from DC CDC select object (global/main region) CDC select object (bitmap) TransparentBlt to DC; TransparentBlt(dc.GetSafeHdc(), 0, 0, floatingBMP.bmWidth, floatingBMP.bmHeight, myCDC->GetSafeHdc(), 0, 0, floatingBMP.bmWidth, floatingBMP.bmHeight, 0x00ff00);// Transparency = lime green, altho this doesnt matter as the region has already been created to take this into account; After this is the DrawText code which has already been show. Any ideas? Thanks MS.

    C / C++ / MFC question

  • Clear text from a device context.
    M Mr Simple

    Hi, I am not (knowingly/intentionally) preserving the DC. I am able to get this to work over sections of the DC are not transparent (the redrawn image covers the old text) but I am unable to draw over the transparent old text because I dont know what lies underneath. CPallini - I hope I am not coming across as stupid, but I still cannot get your suggestion to work. Please correct my thinking if it is wrong (see below); Thank you for your time. MS. // // A gloabal rectangle. CRect rTextMain; // // In my timer; CRect rMoveTo; InvalidateRect(&rTextMain); // Your steps said to do this after, I tried both. InvalidateRect(&rMoveTo); rMoveTo.top = val1; rMoveTo.left....... rTextMain = rMoveTo; UpdateWindow(); // // In OnPaint; CFont newFont; newFont.CreateFont(15, 0, 0, 0, 400, 0, 0, 0, 0, 0, 0, 0, 0, _T("MS Sans Serif")); CFont *oldFont = dc.SelectObject(&newFont); CString sWords = "test"; dc.DrawText(sWords, &rTextMain, DT_TOP | DT_LEFT)

    C / C++ / MFC question

  • Clear text from a device context.
    M Mr Simple

    How do you suggest I set the text from outside the paint method? Another reason I chose to use OnPaint is that I dont know how to do it without having the DC variable to use the .DrawText with! @Nelek, I have tried both Invalidate (entire), InvalidateRect (text in rectangles), and InvalidateRgn (dc region) all to no avail! Thank you for your time. MS

    C / C++ / MFC question

  • Clear text from a device context.
    M Mr Simple

    Well, by 'move' i mean more 'repostitioned'. The location of the text is based upon a number of variables, the window itself is a large mishaped window. How do you think I should be drawing the text?

    C / C++ / MFC question

  • Clear text from a device context.
    M Mr Simple

    Hi, I have written text to a device context using "dc.DrawText()" onto a transparent background. The text needs to move, but it leaves the old text on the DC, which just causes a long black smudge. As I mentioned, the background is transparent, so I cant just blit the background again. I have noticed that calling ShowWindow(SW_HIDE); then re-showing it clears the text, however I make the text move from within the OnPaint method, which obviously causes problems if I hide/show it constantly. Does anyone have any ideas as to how I can remove the text? Thanks. MS.

    C / C++ / MFC question

  • Clone a bootable drive. [modified]
    M Mr Simple

    Hello, I want to clone a bootable hard drive to a number of other drives using C++/Windows(MFC) As far as the hard drive is concerned, would I be able to just open the physical device (\\.\PHYSICALDRIVE0) and copy the original disk sector by sector onto the new drives? Or is there more to it than this? Also, would it be possible to do this just by editing the volume (\\.\D: ) rather than physical disk?? Thank you.

    Hardware & Devices c++ question

  • DoModal not returning.
    M Mr Simple

    Thanks folks. Using "new CPleaseWait(NULL);" didn't fix the problem, oh, and I was using dlg->DoModal (as opposed to .DoModdal) it was a typo as the machine I am coding on isnt networked :-) I ended up using the modeless after disabling the main form, as suggested. I have another question, not too important anymore, but would be handy to know. Inside the InitDialog() I had a new thread which alters the contents of a label to show the search hasnt crashed. It has worked before in the old application (I have just realised that the old problem didnt exist then as it was being used as a splash screen when the app was started, hence no parent). Now, the 'SetWindowText()' to update the label runs once, then doesnt return the second time. I cant look any further into it as no code is available for debugging (other than assembly) meaning it is quicker for me to delete that bit :-) Like i say, its not important now, but any ideas? Thanks for the help everyone, I had been staring at those lines of code for hours!

    C / C++ / MFC help c++ question

  • DoModal not returning.
    M Mr Simple

    Hi, I have created a 'please wait' dialog which is loaded when a user clicks on a button. A new thread is launched to load the button so the main thread can continue what it is doing. The button code; CPleaseWait *dlgWait = new CPleaseWait(this); AfxBeginThread(PleaseWaitThread, dlgWait); Then in the new thread; CPleaseWait dlg = (CPleaseWait*)lpParam; dlg.DoModal(); return 0; It is very simple code, which I have had working before. The problem is that when called, DoModal never returns, so the dialog doesnt get displayed (it doesnt get as far as InitDialog). The main thread continues running however. If I place a 'return;' directly after the AfxBeginThread() then the dialog DOES display. If I place 'while(1) Sleep(100);' (or any other code) after the AfxBeginThread() then it does not return. I have narrowed the problem down to a particular line (510) within 'dlgcore.cpp' // disable parent (before creating dialog) HWND hWndParent = PreModal(); AfxUnhookWindowCreate(); BOOL bEnableParent = FALSE; if (hWndParent && hWndParent != ::GetDesktopWindow() && ::IsWindowEnabled(hWndParent)) { ::EnableWindow(hWndParent, FALSE); /////// <--- THIS HANGS FOREVER bEnableParent = TRUE; } Creating a modeless dialog does not fix the problem - Create() does not reurn instead. Does anyone have any ideas as to what the problem could be? Please advise. Thank you!

    C / C++ / MFC help c++ question

  • SetWindowPos & GetWindowRect
    M Mr Simple

    Hi, I am trying to resize 2 CButtons at runtime, but am having a really hard time getting them to appear in the correct place. GetWindowRect gives me values that are offset to the dialog. To demonstrate, the code i am using is something like the following; CRect btnRect; btn1.GetWindowRect(btnRect); ::SetWindowPos(btn1.m_hwnd, btnRect.left, btnRect.top, btnRect.Width(), btnRect.Height(), SWP_SHOWWINDOW); This results in the button moving diagonally across the screen, it doesnt stay still, which is what I would have expected. I find that if i take away (rectDialog.left + 3) and (rectDialog.top + 29) from btnRect.left and .top it will work (stay still). I assume the '3' is the width of the boarder, and '29' the height of the title bar. Is this correct? If so, how can I find it programatically? Thank you very much for your help.

    C / C++ / MFC question help

  • Malloc & Page File
    M Mr Simple

    Hi. The system is currently using RAID stiping across 2 IDE disks. The idea is for a batch system so data is only going to be written to start with, reading will come after the job has finished (initially, depending on performance obtained). I will be trying to get faster hard drives for the project, I'm not sure how fund are at the moment. I am having a hard time obtaining sustained drive datarates, where should I be looking? Thank you.

    Design and Architecture performance question

  • Malloc & Page File
    M Mr Simple

    Thank you, this gave me quite a few ideas to think about. A previous attempt by someone else 2 years ago managed a run time of about 20 seconds with half as much data, I need to increase by at least 200% and double the datarate. The system will be the same to start with but I am going to try to get it upgraded. Thank you once again.

    Design and Architecture performance question

  • Malloc & Page File
    M Mr Simple

    The actual reading & writing is easy. The data is of fixed length, so no problems coding the buffer itself, I just really really cant afford any lost time due to paging or hard drive accesses. The data will be stored in 13 byte blocks, with data being added at about 53mb per second. This data will simultaneously be read & written to hard disk, the aim is to go as long as possible before the buffer fills up & data/stream integrity is lost. Thank you.

    Design and Architecture performance question

  • Malloc & Page File
    M Mr Simple

    For the record I am using VC++ (native). Also it looks as though I may have posted in the wrong category, sorry.

    Design and Architecture performance question
  • Login

  • Don't have an account? Register

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