Thanx for the info. But i didnt know that the THREAD func needs to be static.Thanx anyway laiju
laiju
Posts
-
Creating a thread -
Creating a threadFollowing is a funciton where I am calling a thread void CMyView::OnInitialUpdate() { ... AfxBeginThread(Thread_ScanConnectionState, m_sComPort, THREAD_PRIORITY_NORMAL, NULL, NULL, NULL); ... } //Foll is the thread definition UINT CMyView::Thread_ScanConnectionState(LPVOID pParam) { CString sComPort; sComPort = static_cast (pParam); return 1; } The declaration of the thread in the class header of CMyView is as below. UINT Thread_ScanConnectionState( LPVOID pParam ); I get the compilation error as given below error C2665: 'AfxBeginThread' : none of the 2 overloads can convert parameter 1 from type 'UINT (LPVOID)' c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxwin.h(4105): could be 'CWinThread *AfxBeginThread(AFX_THREADPROC,LPVOID,int,UINT,DWORD,LPSECURITY_ATTRIBUTES)' c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxwin.h(4108): or 'CWinThread *AfxBeginThread(CRuntimeClass *,int,UINT,DWORD,LPSECURITY_ATTRIBUTES)' while trying to match the argument list '(overloaded-function, CString)' Please let me know the error. laiju
-
CRichEditCtrl stringsUsing CRichEditCtrl, I can display western languages such as German French etc. But when I set the string of a CRichEditCtrl as list box entry it reverts to the equivalent English string. What is the problem. laiju
-
Renaming Tree NodesI have used PreTranslate message to capture the renaming of Tree Nodes. I am capturing the VK_RETURN key to complete the renaming of tree nodes. But the tree control can also complete the rename operation by clicking the mouse anywhere on the tree control after typing the new string for the folder. I dont want the rename to take place by mouse click. I know how to revert the old string of the tree node .But I dont know what event completed the rename operation .Like if i can differentiate the end of rename operation by mouse or by keyboard i can block the mouse rename operation. I tried to do the following filter . void CTreeCtrlBar::OnTvnEndlabeleditTree1(NMHDR *pNMHDR, LRESULT *pResult) { NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR; if (pNMTreeView->action == TVC_BYKEYBOARD) AfxMessageBox("End by ENTER Key"); else if (pNMTreeView->action == TVC_BYMOUSE) AfxMessageBox("End by mouse click"); ************************************************************************** But always the condition pNMTreeView->action == TVC_BYMOUSE gets satisfied even when I pressed ENTER key to complete the rename operation. Any suggestions please. laiju
-
Activating Single instancei tried using the variable theApp.m_pMainWnd to post a message ,but i think this doesnt have a valid pointer which crashes the application. BOOL CKolOSDBuilderApp::InitInstance() { // InitCommonControls() is required on Windows XP if an application // manifest specifies use of ComCtl32.dll version 6 or later to enable // visual styles. Otherwise, any window creation will fail. if (g_SingleInstanceObj.IsAnotherInstanceRunning()) { theApp.m_pMainWnd->SendMessage(WM_CLOSE_PROJECT,0,0); return FALSE; } laiju
-
Activating Single instanceI had tried that option but the application crashes when I do that. Given below is the implementation.. CLimitSingleInstance g_SingleInstanceObj(TEXT("{A79AAE6A-62E1-4c0e-B678-72F127AD4B03}")); BOOL CKolOSDBuilderApp::InitInstance() { // InitCommonControls() is required on Windows XP if an application // manifest specifies use of ComCtl32.dll version 6 or later to enable // visual styles. Otherwise, any window creation will fail. if (g_SingleInstanceObj.IsAnotherInstanceRunning()) { AfxMessageBox("An instance is already running"); return FALSE; } laiju
-
Activating Single instanceUsing the class CLimitSingleInstance I have managed to enusure that only one instance of my application is active. I would like to do one more enhancement. Whenever there is an attempt to run multiple instance the current running instance should be restored to full view. I think it has to be done in the InitInstance() of my appln. Can anyone suggest the procedure. laiju
-
API for available getting available COM PortIs there any Win32 or MFC API to retrieve the Available COM ports in a PC. Thank you laiju
-
Why is a CButton disabled on CDialogBarI am unable to activate the CButton control that I put on a CDialogBar. I remember reading somewhere that on a Dialog bar the CButton is disabled. Can i enable it ? Thanx in advance laiju
-
Disable the horizontal scroll bar in listHow can i disable the horizontal scroll bar at run time. laiju
-
display window in full screen formatthanx..how do i restore this window into its previous state on mouse click or keyboard hit. laiju
-
display window in full screen formatthanx..how do i restore this window into its previous state on mouse click or keyboard hit. laiju
-
display window in full screen formatI am using MDI Doc- View architecture. I want to display a new window( Not an MDI Child Window) in full screen format so that i can display GDI information on this window.This new window should close/destroy on mouse click or keyboard hit. Can anyone give me some laiju
-
using CMapI have declared the following in my application. "CMap < CString,LPCSTR,CWnd*,CWnd* > m_map" I have a windows explorer like setup. When i click a node in the tree i need to display an MDI Window. So i have mapped the node item's text (LPCSTR) to that of the window pointer .So when i click a node i use CMap to get the window pointer and display the window. Now when i alternatively click the windows i get the window pointer and i want to correspondingly shift the focus on the tree items. So my question is how do i look up the key ( i.e LPCSTR) when i have the value (i.e.. CWnd*). . laiju
-
using CMapI have declared the following in my application. CMap m_map; I have a windows explorer like setup. When i click a node in the tree i need to display an MDI Window. So i have mapped the node item's text (LPCSTR) to that of the window pointer .So when i click a node i use CMap to get the window pointer and display the window. Now when i alternatively click the windows i get the window pointer and i want to correspondingly shift the focus on the tree items. So my question is how do i look up the key ( i.e LPCSTR) when i have the value (i.e.. CWnd*). laiju
-
Toolbar handler not invokedI have double checked this. The command ID_VIEW_DRAWTOOLBAR is not used anywhere in the project except for calling the handler OnDrawToolBar and update handler OnUpdateDrawToolBar in the mainframe laiju
-
Toolbar handler not invokedhave addded a toolbar in the OnCreate method of CMainFrame as below if (!m_UICtrlsBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_RIGHT | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_UICtrlsBar.LoadToolBar(IDR_TOOLBAR_DRAW)) { TRACE0("Failed to OSD Controls ToolBar\n"); return -1; } IF I close the child windows the handler works.The handler wont work if the child window is minimized or restored either. laiju
-
Toolbar handler not invokedI have addded a toolbar in the OnCreate method of CMainFrame as below if (!m_UICtrlsBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_RIGHT | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_UICtrlsBar.LoadToolBar(IDR_TOOLBAR_DRAW)) { TRACE0("Failed to OSD Controls ToolBar\n"); return -1; } But the handlers for this toolbar wont work when child windows are restored or maximized. In other words - in the presence of child view windows the message handler for the toolbar is not invoked. IF I minimize/close the child windows the handler works.I have posted this several times.I am still unable to figure out the actual problem. Please let me know if my problem is not clear. laiju
-
Function/handler not workingI have the handlers and message maps as below. Whenever a child window is visible the following hanldler and its update function is not invoked. When the Child window is closed they are invoked.. Can anyone explain this behaviour. ON_COMMAND(ID_VIEW_DRAWTOOLBAR, OnDrawToolBar) ON_UPDATE_COMMAND_UI(ID_VIEW_DRAWTOOLBAR, OnUpdateDrawToolBar) void CMainFrame::OnDrawToolBar() { if (m_bUICtrlBar) { m_bUICtrlBar = false; ShowControlBar(&m_UICtrlsBar, m_bUICtrlBar, false ); } else { m_bUICtrlBar = true; ShowControlBar(&m_UICtrlsBar, m_bUICtrlBar, false ); } } void CMainFrame::OnUpdateDrawToolBar(CCmdUI *pCmdUI) { if (m_UICtrlsBar.IsVisible()) m_bUICtrlBar = TRUE; else m_bUICtrlBar = FALSE; if (m_bUICtrlBar) { pCmdUI->SetCheck(TRUE); //AfxMessageBox("visible so check"); } else { pCmdUI->SetCheck(FALSE); //AfxMessageBox("Invisible so Uncheck"); } } laiju
-
StretchBlt for IconsStretchBlt can be done for Bitmaps. How do I do the same for ICONS. I need to zoom an icon. Any suggestions plz. laiju