mfc

How to resize font on the GUI buttons in MFC

I have a GUI written in MFC for a Windows CE device. However I need to resize some of the buttons and their corresponding text. I can't figure out how to change font size. The following code fragments did not help: Trial 1: *CFont fnt2; fnt2.CreateFont(10, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLI...

MFC : IHTMLElement how to remove an html element...

Hi all, I have a dialog which has a web control... and with it I add elements using the put_innerHTML method of the class IHTMLElement. How do I delete elements though? I can't seem to find the method for it. Thanks... ...

How do I rebuild MFC project in x64?

I have project in MFC that works fine in x32. I used the configuration manager to change the project to x64, then I tried to rebuild the project. the result was "unresolved external symbol" for many MFC function. I guess that I miss something here in the Tools/Option toolbar with x64 platform but I don't know what. P.S. win32 consol...

how to use an input mask into a CMFCPropertyGridProperty

I need to display and read a MFC property in such way the input behaves as a percentage. Right now, it looks as this: http://imagebin.org/98392 But, instead of the 0.845 I would like to display as 84.5% What I need to do? ...

Positioning the dialog box in the centre of the screen

I have a dialog box developed in mfc for a Windows CE device and want it to occupy the entire screen. I used the following code to center my dialog box on the lcd screen of the device: CWnd* pWnd = GetDesktopWindow(); CenterWindow(pWnd); However, I still get a tiny sliver of space on the left side of the dialog box, resizing the dia...

MFC String Table Numeric options

In the String Table for an edit box for numeric entries I can do: 1E__C X(10): Alphanumeric 10 1N__C 000: Numeirc 3, with leading zeroes (cannot insert 0) 1N__C 999: Numeric 3 ( cannot insert 0) 1N__C NNN: Numeric 3, 0 can be inserted (just ONE 0) Is there an entry to the String Table so that the following entry can be inserted to ...

Win32 select/poll/eof/ANYTHING!?!?!

Using the standard Win32 file I/O API's (CreateFile/ReadFile/etc), I'm trying to wait for a file to become readable, or for an exception to occur on the file. If Windows had any decent POSIX support, I could just do: select(file_count, files_waiting_for_read, NULL, files_waiting_for_excpt, NULL, NULL); And select will return when the...

Can I draw Qt objects directly to Win32 DC (Device Context)?

I can draw Qt objects to an QImage and then draw the image to HDC or CDC. This may hurt our application's performance. It would be great if I can draw Qt objects directly to Win32 HDC or MFC CDC. I expect that there is a class, say QWin32Image for clear, then I can use it in this way: QWin32Image image(hdc, 100, 100, Format_ARGB32_Premu...

CArray doesn't call copy constructors on memory reallocations, now what?

Suppose I have a class that requires copy constructor to be called to make a correct copy of: struct CWeird { CWeird() { number = 47; target = &number; } CWeird(const CWeird &other) : number(other.number), target(&number) { } const CWeird& operator=(const CWeird &w) { number = w.number; return *this; } void output() ...

capture delete key in CListCtrl and do soem processing

Hi, I have a class which inherits from CListCtrl class, say class list. I have another class dlg, which inherits from CDialog. Class dlg contains an instance of class list. I have got a delete button in class dlg, on which I delete the selected item in listCtrl and do lots of other processing. I want the same functionality on delete k...

Can a CWinApp be placed in a DLL?

I'm updating some legacy apps to Visual Studio 10 and am in linker hell. All of these DLLs derive classes from CWinApp and use AfxGetApp() to get access to the object. When I link the DLLs I get unresolved externals that look like global static objects that would get pulled in by a normal app's main(): Shell.lib(SHELL.obj) : error LNK20...

Convert char array to UNICODE in MFC C++

I'm using the folowing code to read files from a folder in windows. However since this a MFC application I have to convert the char array to UNICODE. For example if I hard code the path as "C:\images3\test\" as shown below the code works. WIN32_FIND_DATA FindFileData; HANDLE hFind = INVALID_HANDLE_VALUE; hFind = FindFirstFile(_T(...

Doing extra initialisations on a MFC Dialog in Visual Studio C++ 2008 Pro

How do I make extra initializations on a modal dialog before calling DoModal(); ? The whole application is created using VS wizards. I have a main Dialog (the one that is created automatically when I select new MFC Application in Visual Studio 2008 Professional). When I click a button on this dialog I want to open another dialog and set...

specify parent window in Windows Resource Script file(*.rc)

Hi, I'm looking for a method to specify parent window in *.rc file. In *.rc file, it contains the layout and controls of a dialog. Any new control added into it, will automatically become a child window of Dialog itself. But I want to add a custom draw window into dialog, and some other controls which has that "custom draw window" as ...

listen for events in c++

Hi I got a CWnd like thie CWnd * pWnd = pDC->GetWindow(); Is there away I can be notified when the windows is closing? ...

How does the LPtoDP function work?

I have a book about programming under Windows, and the author uses a function called LPtoDP (MSDN). But I can't see the difference between code that uses this function and code that doesn't. I use this function in this way, which seems to me to be a proper way. POINT po; po.x = -50; po.y = 100; pDC->LPtoDP(&po); pDC->LineTo(po); P...

MFC component defocus event handler

Hello, Is there a standard way to handle MFC Edit box defocus event? I mean if I click on the box enter something and then move on on the other component handling event gets fired? Thank you for any help! ...

Memory leak while using emoticons on CRichEditCtrl

I'm developing a text editor class (for a chat application) based on CRichEditCtrl (MFC) with emoticon support. After i load the emoticon's bitmap, I use the function OleCreateStaticFromData to insert it into CRichEditCtrl. After that i just delete the bitmap object allocated by myself. I can verify (using a GDIView utility) that all r...

Trying to convert openGL to MFC coordinates and having Problems with "gluProject"

To clarify things, what i am trying to do is to get the openGL coordinates and manipulate them in my mfc code. not to get an openGL object. i'm using the mfc to control the position of the objects in the openGL. Hi, i'm trying to find the naswer on the web and can't find a full solution that i can use and that will work... I'm develop...

Code coverage in Win32 app

We are just about to start a new project. The Proof of Concept (PoC) for this project was done simply using Win32. The plan is/was to flesh out the PoC, tidy the uglier parts and meet the requirements set by the project owners. One of the requirements for the actual project is 100% code coverage but I can see problems ahead: How can I ...