mfc

Big problems with MFC/WinAPI

I need to create a SDI form with a formview that has two tabs, which encapsulate multiple dialogs as the tab content. But the form has to have a colored background. And things like these makes me hate programming. First, I tried CTabControl, via resource editor, tried different things, but the undocumented behavior and the quirks with ...

What techniques are suitable for a windows database application where the database is available via http

I'm starting a database application. The application should connect over http to a mysql database. The application should display the database records table-like. Some dialogs are necessary (reflects a database-record). I'm thinking of a dialog-based MFC application with some functions available via menu and which connects via SOAP to th...

Do I need to call DeleteObject on CFont

I was wondering, do I need to call DeleteObject in the following case? CFont* oldFont = label.GetFont(); LOGFONT oldLogFont; oldFont->GetLogFont(&oldLogFont); oldLogFont.lfWeight = FW_BOLD; CFont newFont; newFont.CreateFontIndirectW(&oldLogFont); label.SetFont(&newFont, true); // Do I need to call oldFont->DeleteObject() or newFont->Del...

MFC Treeview : How to check if Treeview already contain particular child node ?

Hi, In MFC Treeview control, how i can check condition if particular child node is already present in treeview? My requirement is like if particular child node is present in treeview dont add it again in that treeview... Any code snippet is welcome ........ Thanks. ...

how to make slew key in mfc

i have a dialog box in which a edit control and a button is presentfuncionality is that when i cliked on button edit control changes values from 0 to 30.for single click functionality is working fine but when i hold that button then it should quickly go on increasing 0 to 30 but its not going that way.it not taking left click down event....

CTaskDialog hyperlinks in vc++

Hi I am using CTaskDialog class in my MFC application. I am trying to customize it. In this if i want to add hyperlinks, as of now there is no specific provision for this. But to add the buttons we can use "AddCommandControl" and can handle the button. If I want to implement similar to this AddHyperlinkControl and want to handle can any ...

How to set input focus to an application which is not in foreground in Windows?

I want my application to capture input focus, whenever the mouse hovers over it. How do I do it in Windows? Basically I dont want users to explicitly click on the application, or the taskbar icon before entering any text, when the application is not in foreground. I tried the SetForegroundWindow API in the mouse hover notification, but...

MFC - How to display icon in Static Picture Control bigger than 32x32

I have a MFC dialog application with a picture control. I add an icon file with different size of images (32x32, 48x48, etc...) into the icon resource. Then I set the following picture control properties: Type - Icon Real Size Image - True I have the following code under OnInitDialog(): HICON hIcon = (HICON) LoadImage( AfxGetInstanceH...

MFC - Is there any way to load a png resource into picture control on a dialog box?

I tried the following code on OnInitDialog() but nothing was shown. m_staticLogo.SetBitmap(::LoadBitmap(NULL, MAKEINTRESOURCE(IDB_LOGO))); where m_staticLogo is the static picture control and IDB_LOGO is the resource ID of the png file. ...

changing font color of text in a disabled CEdit control

I want to change the font color of text in a disabled CEdit control which is currently system gray. As I use a gray background, I wish to change the font color of text ( currently set to rgb value of COLOR_GRAYTEXT) in order to make it easier to read. There is a solution by using SetSysColors() but that has an ill effect of changing ...

MFC Treeview : How to apply different images to different nodes in Treeview ?

hi , I want to apply different images to different nodes in my MFC Treeview ? Currently i have have applied one image to my treeview root node now i want to apply different image to subnodes and how to expand all nodes in treeview , once i expand one node other get collapsed.. Currently i am doing like this : CImageList *m_pNASIm...

Save file settings in ini instead of registry

I'm new to MFC, once I create my first app, in myApp::InitInstance() . I have SetRegistryKey(_T("Local AppWizard-Generated Applications")); Can I delete this and save settings to my own ini construct ? ...

Pointer in C++ - Need explanation how it works

http://www.codeproject.com/KB/IP/SocketFileTransfer.aspx?artkw=socket%20send%20a%20file I don't clearly understand this line : // get the file's size first cbLeftToReceive = sizeof( dataLength ); do { BYTE* bp = (BYTE*)(&dataLength) + sizeof(dataLength) - cbLeftToReceive; cbBytesRet = sockClient.Receive( bp, cbLeftToReceive );...

MFC time tool for stopwatch implementation

Hello guys, I would like to implement a stop watch as part of my system. i want it to have a simple feture that when pressing start the timer runs and when pressing stop it stops. how should i do such a thing(timer func + graphical presentation)? *when googling i came across many things that were not suitable. Tnx ...

MFC GUI in main frame and other DLLs that nedd also GUI

Hi all, I have a MFC application which has its GUI implemented as part of the executable code (view-doc architecture etc.) My application uses some DLLs I worte. Now I have to write another DLL which I know it has to have a GUI as well. My question/uncertainty is should I implement the GUI as part of the main application (main GUI) an...

Standard C++ and MFC wrapper

Firstly, I want to have a clearly overall look at MFC, Win32API . Is: Win32API: The first layer between hardware and software in prog [ except assembly ] MFC : A wrapper by Microsoft ? It helps us in design GUI and a lot of library for easier and faster programming. My problem is : I want an easy coding in GUI, no need to write every ...

What is the best method to compare two vectors of CString

Hi I am trying to find the most efficient, optimized and fastest way to compare to std vectors of CString. the strings in question are case-sensitive. I have tried using the == operator for the vector container but this sometimes return false positives. I mean for instance if one vector contains elements in the order (a,b,c) and the oth...

MFC: Convert CStringArray to float, converting just part of the value

I want to convert val.ElementAt(i) to float value : float *d = new float[NMAX]; char *buffer = new char[128]; CStringArray val; //adding some values to val buffer = (LPSTR)(LPCSTR)val.ElementAt(i).GetBuffer(); d[i] = atof(buffer); as the result in d[i] I have just part of the value(if it was 55 in d is - 5, 666 - 6 ...), help ...

CMFCPropertySheet Apply button disabled

I created a CMFCPropertySheet derived class and added 2 CMFCPropertyPage derived classes using AddPage(). In both added page classes i've overridden the OnApply() method. When the pages are created and their OnCreate() is called i call SetModified(TRUE). http://msdn.microsoft.com/en-us/library/aa299489(VS.60).aspx I hoped the Apply bu...

How to prevent copying a wild pointer string

My program is crash intermittently when it tries to copy a character array which is not ended by a NULL terminator('\0'). class CMenuButton { TCHAR m_szNode[32]; CMenuButton() { memset(m_szNode, '\0', sizeof(m_szNode)); } }; int main() { .... CString szTemp = ((CMenuButton*)pButton)->m_szNode; // sometime it crashes he...