mfc

Using MFC classes inside ATL Project

Hi, I have created an ATL Project with all default options using VC++ 2008. I have added Simple ATL object (interface IDemo) and some interface moethos inside the simple object. I want to use MFC classes (e.g. CDatabase, CRecordset and lots more) inside my ATL project. How can I achieve this? Thanks. ...

How to get size and location of a control placed on a dialog in MFC?

I've got the pointer to the control with function CWnd* CWnd::GetDlgItem(int ITEM_ID) so i've got CWnd* pointer which points to the control, but simply can't find any method within CWnd class that will retrieve the size and location of a given control. Any help? ...

createthread in WinCE

I have this code written in MFC as a win32 application: CZoneThread* pThread = new CZoneThread( sZoneInfo ); pThread->CreateThread(); Here, CZoneThread is another class. Will this code work correctly in WinCE as well? ...

Why am I seeing a crash when trying to call CDHtmlDialog::OnInitDialog()

I added a helpAbout menu item to my mfc app. I decided to make the ddlg derive from CDHTMLDialog. I override the OnInitDialog() method in my derived class and the first thing I do is call the parent's OnInitDialog() method. I then put in code that sets the title. On some machines this works fine, but on others it crashes in the cal...

How to create and add a custom made component to a Dialog based app (MFC)?

I want to make a custom made component (a line chart), that would be used in other applications. I don't know 2 things: Where should I use (within component class!) the methods for drawing, like FillRect or PolyLine? In OnPaint handler that I should define and map it in MESSAGE MAP? Will it (OnPaint handler) be called from OnPain...

IADsUser change user attribute

i connect to ACtiveDirectory as Administratotr . hr = pUser->Put(L"pwdLastSet",svar); hr = pUser->SetInfo(); why hr = E_ACCESSDENIED ...

How do I edit a "ell in an MFC Listbox?

I have CListBox control that has 2 columns and any number of rows. I want the user to be able to click(or maybe double-click) a "cell" and be able edit the text therein. See this screenshot (Can't post images yet, need +10). What I mean is that I want to be able to click and edit any of the places where it says "TEST" by clicking on ...

CAsyncSocket and ThreadPool problem

I have a server application with such structure: There is one object, call him Server, that in endless cycle listens and accepts connections. I have descendant class from CAsyncSocket, that has overriden event OnReceive, call him ProxySocket. Also I have a thread pool with early created threads. When connection is received by server obj...

How to free member (i.e BSTR, SAFEARRAY, VARIANT) of an IDL User Defined Structure which is encapsulated in a VARIANT?

Hi, I have a structure defined in IDL. This structure has following members: { BSTR m_sFirst; BSTR m_sSecond; VARIANT m_vChildStruct; //This member encapsulate a sub structure SAFEARRAY __RPC_FAR * m_saArray; }CustomINFO; I am allocating the memory for the structs using CoTaskMemAlloc and encapsulating it in Varian...

What are useful functions for drawing text (MFC)?

I'm creating a line chart control, and I need to write (or better say draw) the axis names and axis values. I found DrawText and TextOut functions, but the text they show is flickering and don't know how to set the font and text orientation (I will need vertical text orientation as well as horizontal). Are there any other functions you...

How to disable WinMain entry point for a MFC application?

I understand that is not possible to have applications with multiple entry points under Windows. I have a MFC application and I added code for making it running as a service (main() entry point and other required stuff) but it looks that Windows will always run the WinMain() from MFC instead of my main. The question is how can I disabl...

How to add a wrapper to the MFC WinMain?

I want to add a wrapper to the MFC WinMain in order to be able to make a MFC application be able run as GUI application or as a service. Can I add a wrapper to WinMail from MFC without modifying MFC source code? ...

MFC : How to check if a character input is unicode?

Hi All, I have an input text field which accepts a certain maximum number of characters. This number of characters should change though if the character inputs are unicode. Question: Is there a way I could check if the character input is unicode or not? ...

Using MPI under VC++ MFC project?

Does any body know how can I use MS_MPI in my VC++ MFC project? I already have a big MFC project and I only want to use parallel processing in a part of it with MPI. (I know how to use MPI in a separate code, but I don't know how to integrate it with my VC++ MFC project) ...

MFC SDI Application without a default "New Document" on Startup

My application is an SDI with multiple views. By default, it creates a new document when the application starts. I want to modify this behavior so that a new document is created only when user explicitly clicks on "New". Or at least mimic this behavior. Any ideas? I am using Visual Studio 2008 with MFC feature pack. I googled and found s...

MFC: what would be the regex to check if a character is unicode or not?

Hi All, I'm trying to use windows' API IsTextUnicode to check if a character input is unicode or not, but is sort of buggy. I figured, it might be better using a regex. However, I'm new to constructing regular expressions. What would be the regex to check if a character is unicode or not? Thanks... ...

when i run exe(MFC Dialog based application) in Win 2k3 it fails to run(MSJAVA.dll Missing error)

when i run exe(MFC Dialog based application) in Win 2k3 Fails to run(MSJAVA.dll Missing error).but the same exe runs successfully in WIN xp Edit: As per the solution by Goz ,I have downloaded the MSJAVA.dll and tried to run the exe,but am getting the below error, "The Side-by-Side configuration information for "f:\test\TESTCSDATACHANGE...

How do you extract data from a Date/Time widget from a C++ MFC dialog in VS2008

This is a fairly basic question, but I haven't been able to find any from->to guides from VS6->VS2008. I have a dialog box that contains controls of various types, I've discovered the way of auto-generating OnBnClickedMyFooBarButtonHere() methods via the Properties dialog on the dialog editor. I can also use CWnd::GetDlgItemText(int ,CS...

How to get the drive letter of pendrive

Hi, I want to get the drive letter of pendrive or external harddisk connected through USB. Is it possible to get the Drive letter. I am using VC++ ...

Windows 7 application taskbar icons, font size and shortcuts

We have come across some behaviour involving the taskbar icons that Windows 7 displays for different applications. I'm wondering whether anybody could shed some light on this: Windows 7 is set with font-size = 110%. Two MFC dialog applications A.exe and B.exe have exactly the same .ico resource embedded in them. A.exe has a shortcut as...