Hello TEOlivier, Try this code, CParams *m_pParams; m_pParams = new CParams(this); m_pParams->Create(CParams::IDD); m_pParams->ShowWindow(SW_SHOW); I assumed that CParams is the name of your dialog's class. Regards
wicked_guy
Posts
-
Modeless dialog error -
How to extract integer value from CStringTry this Ravi: CString str = "-123"; int i = atoi((LPCSTR)str); If it didn't work, simply remove '(LPCSTR)'
-
Can't identify pixel color over a live imageHello Programmers, I am having a program that aquires live video signals and displays them on a picture holder. I am trying to identify the pixel color as the user clicks on the video screen. The program gave me an RGB number but obviously not correct. The following is the program on an MFC dialog based application. void CIdsSimpleLiveDlg::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default CString hi; int ali; CWnd *pDesktop = GetDlgItem(IDC_DISPLAY); CDC *pDC = pDesktop->GetWindowDC(); COLORREF clr = pDC->GetPixel(point.x,point.y); ali = (GetRValue(clr)+GetGValue(clr)+GetBValue(clr))/3; hi.Format("%d",ali); AfxMessageBox(hi); pDesktop->ReleaseDC(pDC); CDialog::OnLButtonDown(nFlags, point); } Note that the notation 'IDC_DISPLAY' represents the ID of the picture holder. Thanks in advance
-
How can I change focus between child windows within an MDI applicationHello everyone, I am having trouble changing focus from child window to another. Of course, I want to be able to do that without using the mouse or keyboard, but the code itself. The application is used in an automated video grabbing. This is the code I have written: class CMyAppDoc : public CDocument { public: CView *pOldActiveView; .. .. CMyAppDoc::OnButton1() { CMDIFrameWnd* pMainWnd = (CMDIFrameWnd*)AfxGetMainWnd(); // Get the active MDI child window. CMDIChildWnd* pChild = (CMDIChildWnd*)pMainWnd->MDIGetActive(); // Get the active view attached to the active MDI child window. pOldActiveView = pChild->GetActiveView(); } After clicking Button1 I manually change the focus by the mouse and then click Button2, which includes the following code: CMyAppDoc::Button2() { pOldActiveView->SetActiveWindow(); } Summarizing the code, clicking the Button1 should assign the pointer pOldActiveView the address of the active child window during the time it is pressed. Then After manually chainging the focus to another child window the active child window will change but the pointer is still pointing to our old active child window. So then by clicking Button2 should set the focus on the old child window, but unfortunately nothing changes. I have also tried "pOldActiveView->SetFocus()" instead but didn't change anything as well. Any help will be highly appreciated.
-
Trouble in updating source in ADOHi everone, I am having trouble in updating the source database. I am using a dialog based application with a datagrid. I managed to add a number (01065017) to the first coloumn succesfully but could not update the source after the addition of this number. Any Idea why. The following is the code: m_pConn.CreateInstance(__uuidof(Connection)); m_pConn->Open("Provider=Microsoft.Jet.OLEDB.4.0;" "Data Source=ADOTestDB.MDB", _bstr_t (""), _bstr_t (""), adModeUnknown ); m_pComm.CreateInstance(__uuidof(Command)); m_pComm->ActiveConnection = m_pConn; m_pComm->CommandText = "Select * From Student"; m_pReco.CreateInstance(__uuidof(Recordset)); m_pReco->CursorLocation = adUseClient; m_pReco->Open ( (IDispatch *) m_pComm, vtMissing, adOpenStatic, adLockBatchOptimistic, adCmdUnknown); m_DataCtrl.SetCaption("Students"); m_DataCtrl.SetRefDataSource(NULL); m_DataCtrl.SetRefDataSource((LPUNKNOWN) m_pReco); m_DataCtrl.Refresh(); m_pReco->AddNew(); FieldsPtr pFields = m_pReco->Fields; FieldPtr pStudentNo = pFields->GetItem("StudentNo"); ASSERT(NULL != pStudentNo); CString ali = (char*)(_bstr_t) pStudentNo->Value; ali.Format("01065017"); _variant_t vColumn, vValue; vColumn.SetString("StudentNo"); vValue.SetString(ali); m_pReco->Update(vColumn, vValue); m_pReco->Update(); Thanx in advance
-
How to Set the controls to be infront of an ImageHello everyone, I am using an MFC dialog based application where a gif is loaded into the dialog. Now, the problem is that some of the controls within the dialog become hidden by the image. What I want to do is to place the controls infront of the image as a background. Can anyone guide me. Thanx in advance
-
Problems with the accessing the parallel port using winioHi Everone, I am trying to access my parallel port using the library winio.dll. I managed to do so using an administrative account but that wasn't possible using a non-administrative accuont. I have used this function to do so, but unfortunately I couldn't succeed: InstallWinIoDriver("C:\MyApp\Debug\WinIo.sys",FALSE); can anyone halp plz thanx in advance
-
Multiple Parallel PortsThanx for the reply Christian. Could that be done with MFC as well or just Win32 Applications.
-
Multiple Parallel PortsHi Everyone, Could anyone please give me details about controlling more than one parallel from the same CPU unit. Thanx in advance
-
Using the timerAhhaaa.. Ok then, but these are useful functions as well, Thanx Ant.;)
-
Using the timerAre these actually counters or are they functions that retrieve the frequeny and index of a counter? Check out this link plz. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/timers/timerreference/timerfunctions/queryperformancefrequency.asp
-
Using the timerHi I am controlling an electrical circuit using the computer through the computer ports. I am trying to capture a fast changing analog signal using sampling. So I am just enquiring about the maximum frequency that we could set the timer to using the following function: SetTimer(1, 2000, 0); I actually want the timer to interrupt every ten micro seconds (10uS). Is it possible with this type of timers. If not, can anyone guide me to a timer that is capable of doing so. Thanx in advance