Hello. Does anyone have experience in inserting an image as background in an editbox? I've tried, but the final solution took up a lot of cpu. I just want the editbox to look like those in Msn messenger. If it isn't possible to do ownerdraw with an editcontrol, which control must I then use? -Anders.
pie
Posts
-
"Ownerdraw" in an editbox -
SetScrollInfoOkay.. I just talked to a guy, who told me that I shouldn't be using CScrollView, because it behaves differently from other views. And true enough. When I switched to a standard CView, SetScrollPos didn't scroll my window anymore. I think that's werid.
-
SetScrollInfoBecause I'm writing an application that behaves like mspaint, and I use SetViewportOrg for scrolling.. Do you have a better suggestion?
-
SetScrollInfoHello! It seems to me that setscrollinfo both updates the position of the thumb and scrolls the window. this annoys me very much because I want to scroll the window, and setscrollpos just ruins everything.. Is there a function that only sets the position of the thumb? I'm using mfc.
-
Disabling the OnOK in CDialogI tried to override OnOK, and yes, the dialog doesn't close, but if I then add an OnKeyDown-handler to my dialog, it never receives any VK_RETURN-notifications.. Is this beacuse MFC "grabs" the VK_RETURN, and sends it to OnOK, or just beacuse I'm doing something wrong?
-
Disabling the OnOK in CDialogHello. Is it somehow possible to disable the linking between VK_RETURN and CDialog::OnOK? Whenever I press ENTER in my dialog, it calls the OnOK, and I would like to avoid this.. Is it possible?
-
Using fprintf in socketsHello. I once saw a piece of code, which used fprintf instead of send(), to send data via winsock. How can I "convert" my socket-handle into a file-handle, usable in the fprintf-function ? Thank you.
-
CMenu ownerdrawHello. I would like to create an owner-drawn CMenu class, and therefore i override DrawItem and MeasureItem, like this:
class MyMenu : public CMenu { public: virtual void DrawItem(LPDRAWITEMSTRUCT lpDis); virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMis); }; void MyMenu::DrawItem(LPDRAWITEMSTRUCT lpDis) { } void MyMenu::MeasureItem(LPMEASUREITEMSTRUCT lpMis) { }
And then I add a menu to my app's CMainFrame://MainFrm.h MyMenu TopMenu; //Mainfrm.cpp TopMenu.LoadMenu(IDR_MAINFRAME); for(int i = 0; i<3; ++i) TopMenu.ModifyMenu(ID_DAWS_HEJ+i, MF_OWNERDRAW, ID_DAWS_HEJ+i); SetMenu(&TopMenu);
But the problem is that DrawItem and MeasureItem are never called! I do receive WM_DRAWITEM and WM_MEASUREITEM, but they are just not handled by my class. What do I do? -
Add Message Handler in VC7.0Aah, thank you.. Exactly what I was looking for!
-
Add Message Handler in VC7.0But it's not. My book tells me to "Right-click CMainFrame in the ClassView window, select Add Windows Message Handler, double-click WM_CREATE, and click Edit Existing. You'll find yourself in the empty message handler body, poised to type in the finished code. ClassWizard has already done everything else, including adding an ON_WM_CREATE entry to the message map." But there's no "add windows message handler" in VC 7.0(at least I can't spot it)
-
Add Message Handler in VC7.0Yes, but I was getting tierd of writing code like that and wanted the wizard to do it for me. I just can't seem to find the "Add Message Handler"-wizard in VC 7.0.
-
Add Message Handler in VC7.0Hello.. I'm reading a book that describes how I can use build in wizards in Visual Studio 6.0 to add message handlers. It tells me to right click the class, and click add windows message handler.. But i'm using VC7.0.. Where can I find this functionallity? Specifically I want to add an OnCreate handler.
-
MFC classes in my classThank you, Paul, that was a good answer.
-
MFC classes in my classYeah, that seems to work.. Thank you(and Navin) :)
-
MFC classes in my classBut i'm not looking for speed-improvements. I just want to know why the code i posted doesn't work. MUST I use pointers to make it work ?
-
MFC classes in my classI have: #include #include using namespace std;
-
MFC classes in my classWhy did you want to use a pointer in the first place? What is the advantage?
-
MFC classes in my classHow smart is it to store a pointer if the object you added to the vector goes out of scope? I know that isn't the case right here, but generally speaking...
-
MFC classes in my classHello. When I write something like: --- class test{ public: CBrush f; }; int main() { test t; vector hej; hej.push_back(t); } --- I get an error in : ...\include\vector(575): error C2440: 'initializing' : cannot convert from 'const test' to 'test' But if I replace CBrush with one of my own classes, i everything works fine! What is it with those MFC classes?
-
operator= understanding problemRatio r1, r2; r1 = r2; is equal to: r1.operator=(r2); I guess what the author means is that r1 "owns" the .operator=()-call. But how do you return the r1-object? This is where you need the this-pointer, which points to r1. "this" is defined as "a pointer that points to the object for which the member function is called". I hope that helps, just ask if I didn't explain it good enough.