Search Results

Search found 584 results on 24 pages for 'mfc'.

Page 15/24 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • Method of getting text on a windows form ( unmanaged C++ project )

    - by Donovan
    I'm in the process of learning C++. I've created a boilerplate Win32 app within VC++ 2008. I've studied through the code and am ready do do a bit of experimenting. I thought it would be cool to print all the windows messages received in the message loop to the form created via the boilerplate code. I for the life of me, can't figure out the method of getting text onto that form. I can't seem to identify and named object that I can use to reference that damn form. The best I can figure is I need to use the handle to reference the form somehow. Still, even if I did know how to reference the form, I'm not sure I know how I would create a label to display the text. Anyway, if someone could just point out what methodology I need to learn to make this happen it would be much appreciated. Thanks, Donovan

    Read the article

  • SetWindowPos has not effect on tooltip

    - by YoungPony
    Hello, I am trying to give my ComboBox an in place tooltip for long strings. However when I call SetWindowPos on the tooltip, the position is never changed. Called when TTN_SHOW is received: ::SetWindowPos(textTooltip, NULL, TipRect.left, TipRect.top, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER); If I remove the SWP_NOSIZE flag and pop in some values into the width/height, then the combo box changes size to these values but the position remains the same. SetWindowPos always returns TRUE. The tip is initialised like so: textTooltip = CreateWindowEx(WS_EX_TRANSPARENT, TOOLTIPS_CLASS, NULL, TTS_NOPREFIX, 0, 0, 0, 0, this->GetSafeHwnd(), NULL, NULL, NULL); if(!textTooltip) return; ZeroMemory(&ToolInfo, sizeof(TOOLINFO)); ToolInfo.cbSize = sizeof(TOOLINFO); ToolInfo.uFlags = TTF_TRANSPARENT | TTF_SUBCLASS; ToolInfo.hwnd = this->GetSafeHwnd(); ToolInfo.lpszText = "place holder"; //set in OnSelectChangeOk ToolInfo.uId = 0; ToolInfo.rect = TipRect; //rect is re-set in OnSelectChangeOk ::SendMessage(textTooltip, TTM_ADDTOOL, 0, (LPARAM)&ToolInfo); Am I missing something?

    Read the article

  • Storing string in CStatic

    - by Shark
    I have to create dynamically allocated array of CStatic (CStatic* array;), which then displayed on the dialog. It must be allocated and filled like this: array = new CStatic[list_box.GetCount()]; for (int i = 0; i < list_box.GetCount(); i++) { CString str; list_box.GetText(i, str); array[i].Create(str, WS_CHILD, CRect(), GetParent()); } But str is destroyed after the dialog is closed, because list_box destroyes too, and all pointers inside CStatics points nowhere (I assume it is not working because of this). What can I do to fix this? Any help would be appreciated. P.S. I know, that this is awful way and this is all wrong and I know how to do this right, but unfortunately, I can't change tasks, they give us in the university :)

    Read the article

  • Double null-terminated string

    - by wengseng
    I need to format a string to be double null-terminated string in order to use SHFileOperation. Interesting part is i found one of the following working, but not both: // Example 1 CString szDir(_T("D:\\Test")); szDir = szDir + _T('\0') + _T('\0'); // Example 2 CString szDir(_T("D:\\Test")); szDir = szDir + _T("\0\0"); //Delete folder SHFILEOPSTRUCT fileop; fileop.hwnd = NULL; // no status display fileop.wFunc = FO_DELETE; // delete operation fileop.pFrom = szDir; // source file name as double null terminated string fileop.pTo = NULL; // no destination needed fileop.fFlags = FOF_NOCONFIRMATION|FOF_SILENT; // do not prompt the user fileop.fAnyOperationsAborted = FALSE; fileop.lpszProgressTitle = NULL; fileop.hNameMappings = NULL; int ret = SHFileOperation(&fileop); Does anyone has idea on this? Is there other way to append double-terminated string?

    Read the article

  • How to disable dragging from a Rich Edit Control

    - by John
    I use a subclass of CRichEditCtrl to provide a CEdit+ type control. One thing I want is to disable drag-drop functionality, which the base class provided by default. Disabling dropping is easy: ::RevokeDragDrop(m_hWnd); But I can't see a simple way to disable the control being a drag-source. Is there an easy way?

    Read the article

  • Problems encountered in changing a CRichEditCtrl selection color.

    - by dev ray
    I have written the following code after creating the CRichEditCtrl // 06112010 : The following code was added to highlight the textselection in black color instead of the default blue color of CRichEditCtrl. - 1311 { m_EditControl.SetSel(0,100); CHARFORMAT2 cf1; cf1.cbSize = sizeof(CHARFORMAT2); m_EditControl.GetSelectionCharFormat(cf1); cf1.dwMask = CFM_BACKCOLOR ; cf1.dwEffects &= ~CFE_AUTOBACKCOLOR; cf1.crBackColor = RGB(0,0,0); m_EditControl.SetSelectionCharFormat(cf1); m_EditControl.Invalidate(); } After this I am adding text, but the selection still comes in blue color instead of Black. Could someone please tell me what I am doing wrong?? Thanks, DeV

    Read the article

  • Override OnClose()

    - by CruelIO
    I got this class class CWebBrowser2 : public CWnd And i want to override OnClose What i have done so far is in the header file I added void OnClose(); and in the .cpp file i added void CWebBrowser2::OnClose () { int i=0; i++; } But the OnClose is never called. Then I tried to to modify the header file to afx_msg void OnClose(); DECLARE_MESSAGE_MAP() And added this to the .cpp file BEGIN_MESSAGE_MAP(CWebBrowser2, CWnd) //{{AFX_MSG_MAP(CBrowserDlg) ON_WM_CLOSE() //}}AFX_MSG_MAP END_MESSAGE_MAP() But still OnClose is never called. I have tried to Change to OnClose to OnDestroy but that isnt called either. any ideas on what Im doing wrong?

    Read the article

  • Handling Complex Rules in in GUI applciations (C++ or C#)

    - by Canacourse
    Im working on a dialog box in which several rules must be satisfied before the OK button is enabled. Currently any action on the page such as entering data or selecting an item from a drop down list (amongst other things) calls a single function called ProcessEvent() - this function handles all logic and either enables or disables the OK button. My problem is I finding it difficult making the rules concise and understandable. Some of the rules can be negated by another action on the dialog and I have now ended up with if else statements all over the place or which are difficult to read and follow & extend. The code below is a simplification of the problem but demonstrates it well. How do I handle this problem better (If its Possible) bool CWorkstation::ProcessEvent(void) { UpdateData(); CharCount = GetDlgItemInt(IDC_CharCount, NULL, FALSE); //get latest if ( IsDlgButtonChecked(IDC_USEDBNAME)) { if (!IsDlgButtonChecked(IDC_MAXDBNAME)) { EnableNext(TRUE); } } if (IsDlgButtonChecked(IDC_MAXDBNAME) && CharCount) { if (IsDlgButtonChecked(IDC_USEXMLNAME)) { if ( PrefixName.IsEmpty() ) { EnableNext(FALSE); } else { EnableNext(TRUE); } } } if (IsDlgButtonChecked(IDC_USEXMLNAME) && PrefixName.GetLength() > 1) { EnableNext(TRUE); } if ( IsDlgButtonChecked(IDC_WSAUTONAME) || IsDlgButtonChecked(IDC_RENAMEIFDUP)) { // TRACE("IDC_WSAUTONAME is Checked\n"); if ( IsDlgButtonChecked(IDC_USEXMLNAME) && PrefixName.GetLength() > 1 ) { if ( IsDlgButtonChecked(IDC_IDC_USESHORTNAME) ) { EnableNext(TRUE); } else if ( IsDlgButtonChecked(IDC_USELONGNAME) ) { EnableNext(TRUE); } else { EnableNext(FALSE); } } if ( !IsDlgButtonChecked(IDC_USEPREFIX) ) { if ( IsDlgButtonChecked(IDC_IDC_USESHORTNAME) || IsDlgButtonChecked(IDC_USELONGNAME) ) { EnableNext(TRUE); } } return false; } }

    Read the article

  • Write data into .txt file created by CFileDialog, in C++

    - by younevertell
    I wanna Write data into .txt file created by CFileDialog, in C++. The problem I am facing is that below codes doesn't work, although there is no build error. The .txt file created by CFileDialog can not be found for some reason. What's wrong the code? what's the efficient way to Write data into .txt file created by CFileDialog, in C++? Thanks CFileDialog dlg(FALSE, NULL, NULL, OFN_OVERWRITEPROMPT, _T("My Data File (*.txt)|*.txt||")); if(dlg.DoModal() != IDOK) return; CString filename = dlg.GetPathName(); ofstream outfile (filename); int mydata = 10; outfile << "my data:" << mydata << endl; outfile.close();

    Read the article

  • RC2135 file not found error

    - by user333422
    Hi, I manually added code fro a new dialog box in my .rc file and I have started getting this error. error RC2135: file not found: 0 I don't understand this error as it is not specifying any filename. Any help is appreciated. Thanks, SG

    Read the article

  • Is there any need for me to use wstring in the following case

    - by Yan Cheng CHEOK
    Currently, I am developing an app for a China customer. China customer are mostly switch to GB2312 language in their OS encoding. I need to write a text file, which will be encoded using GB2312. I use std::ofstream file I compile my application under MBCS mode, not unicode. I use the following code, to convert CString to std::string, and write it to file using ofstream std::string Utils::ToString(CString& cString) { /* Will not work correctly, if we are compiled under unicode mode. */ return (LPCTSTR)cString; } To my surprise. It just works. I thought I need to at least make use of wstring. I try to do some investigation. Here is the MBCS.txt generated. I try to print a single character named ? (its value is 0xBDC5) When I use CString to carry this character, its length is 2. When I use Utils::ToString to perform conversion to std::string, the returned string length is 2. I write to file using std::ofstream My question is : When I exam MBCS.txt using a hex editor, the value is displayed as BD (LSB) and C5 (MSB). But I am using little endian machine. Isn't hex editor should show me C5 (LSB) and BD (MSB)? I check from wikipedia. GB2312 seems doesn't specific endianness. It seems that using std::string + CString just work fine for my case. May I know in what case, the above methodology will not work? and when I should start to use wstring?

    Read the article

  • DTPicker: how to open up an control expanded (by default)?

    - by Olli
    Hi all, in my windows form (Visual C++ 6.0) I'm using an Active x control called "CDTPicker" (CDTPicker : public CWnd). My control is opened up by the click event of another button. like this (works fine): void CProducerDlg::OnSelect() { ... m_wndDatePicker.SetValue(varVariant); // hide date combo box if first entry has been chosen m_wndDate.ShowWindow(SW_HIDE); // show date picker if first entry is chosen m_wndDatePicker.ShowWindow(SW_SHOW); // open up calendar view [tbd] ... } What I need is the calendar view to open up expanded (showing the complete month). I don't find any method to do this... Who can help me? Thanks in advance Olli

    Read the article

  • CSplitterWnd flip between horizonal and vertical splitter?

    - by buttercup
    Hi, Suppose I have a splitter with 2 rows. -------- |        | -------- |        | -------- How do I make it to this --------- |    |    | |    |    | |    |    | --------- switch from horizontal split to vertical split without having to re-create the whole splitter? Code is: if (!m_wndSplitter.CreateStatic(this, 1, 2, WS_CHILD|WS_VISIBLE)) { TRACE0("Failed to create splitter window\n"); return FALSE; } if (!m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CWnd), CSize(200, 100), NULL)) { TRACE0("Failed to create CView1\n"); return FALSE; } if (!m_wndSplitter.CreateView(0, 2, RUNTIME_CLASS(CWnd), CSize(500, 100), NULL)) { TRACE0("Failed to create CView2\n"); return FALSE; }

    Read the article

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

    - by welemon
    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 parent window, not dialog itself. I know I can use ::CreateWindow(...) API to dynamic create a window in code, and specify the custom draw window as parent HWND. But we already has child controls layout in *.rc file, I just want to reuse them, without create HWND again. Thanks, William L.

    Read the article

  • CDateTimeCtrl - preventing 'focus' change when setting date

    - by WalderFrey
    I'd like to use a CDateTimeCtrl to allow the user to select a non-weekend date. So, if the user increments the day (via a keypress) - and the resulting day is found to fall on a weekend - then the control should skip forward to the following Monday (don't let issues about month changes distract you, it's not relevant). Usually it's not a problem: when I handle the DTN_DATETIMECHANGE notification I can check the new date/time and if it's found to be a weekend then I can call SetTime on the control to update the date. However, if I set the style to DTS_SHOWNONE, this call to SetTime causes the control to shift the input 'focus' (term used loosely) to the 'none' checkbox, e.g. away from the day field. This prevents the user from using keyboard input to continue incrementing the date unless they subsequently use the right arrow key to reset the 'focus', which is just nasty. I would dearly like to prevent this focus shift from occurring. Is it even possible?

    Read the article

  • How to get the window position and update to other windows?

    - by Rakesh
    Hi all..I have 2 dialog boxes in which I will display 1 dialogbox at a time..If I click NEXT in the first dialog box,I will hide the first dialog box and display the second dialog and vice versa...Now say If I move the dialog box after clicking NEXT in the first dialog..and when I click BACK(in the second dialog) ...it goes back to its previous position(to diaplay the first dialog box)..so I have decided to get the current window's position and update to the other window position so that it doesnt move even If I click next/back..I am not sure how to get the windows position and update to other..please help me if you guys know about this..

    Read the article

  • Please tell me what is wrong with my threading!!!

    - by kiddo
    I have a function where I will compress a bunch of files into a single compressed file..it is taking a long time(to compress),so I tried implementing threading in my application..Say if I have 20 files for compression,I separated that as 5*4=20,inorder to do that I have separate variables(which are used for compression) for all 4 threads in order to avoid locks and I will wait until the 4 thread finishes..Now..the threads are working but i see no improvement in their performance..normally it will take 1 min for 20 files(for example) after implementing threading ...there is only 5 or 3 sec difference., sometimes the same. here i will show the code for 1 thread(so it is for other3 threads) //main thread myClassObject->thread1 = AfxBeginThread((AFX_THREADPROC)MyThreadFunction1,myClassObject); .... HANDLE threadHandles[4]; threadHandles[0] = myClassObject->thread1->m_hThread; .... WaitForSingleObject(myClassObject->thread1->m_hThread,INFINITE); UINT MyThreadFunction(LPARAM lparam) { CMerger* myClassObject = (CMerger*)lparam; CString outputPath = myClassObject->compressedFilePath.GetAt(0);//contains the o/p path wchar_t* compressInputData[] = {myClassObject->thread1outPath, COMPRESS,(wchar_t*)(LPCTSTR)(outputPath)}; HINSTANCE loadmyDll; loadmydll = LoadLibrary(myClassObject->thread1outPath); fp_Decompress callCompressAction = NULL; int getCompressResult=0; myClassObject->MyCompressFunction(compressInputData,loadClient7zdll,callCompressAction,myClassObject->thread1outPath, getCompressResult,minIndex,myClassObject->firstThread,myClassObject); return 0; }

    Read the article

  • How to deal with accelerators for disabled controls?

    - by sharptooth
    I have a dialog created from a template. It has controls listed in the template in the following order: some irrelevant controls a label with an accelerator (let's pretend it's Alt-A) an edit box OK and Cancel buttons Normally when I hit Alt-A the keybord focus is transferred to the edit box - just as needed. However I sometimes need to disable to edit box. If I hit Alt-A when the edit box is disabled the effect is that the OK button is pressed and that is definitely not what I want. I would prefer to have no action taken in this case. What could I do to workaround this?

    Read the article

  • Handle CSliderCtl messages placed on a CDialogBar

    - by user173438
    VS2008, 32 Bit Win XP In a class derived from CFrameWnd, I have an object of CDialogBar that needs to have certain controls on it. Among these controls would be 2 sliders, whose event handling is to be done in CFrameWnd derived class. How shall I go about this? class CFrameWndCustom : public CFrameWnd { CDialogBar m_wndDialogBar; // the CDialogBar object. } In CFrameWnd derived class's OnCreateClient, I have created the DialogBar using the above object like: //Create the DialogBar if (!m_wndDialogBar.Create(this, IDD_DIALOGBAR_CONTROL, CBRS_BOTTOM, IDD_DIALOGBAR_CONTROL)) { TRACE("Warning: Couldn't create DialogBar Control!\n"); return FALSE; } Here, IDD_DIALOGBAR_CONTROL is a dialog resource with Style as Child. After this, I drag-dropped a CSliderCtrl on the IDD_DIALOGBAR_CONTROL in Resource View. Now, how/where should I handle the CSliderCtrl's events? There would be 2 such slider controls. I finally need the values of the sliders in CFrameWndCustom class. best regards, Divya

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >