Hi! How I can get the docking location (right, left, top or bottom) of a control bar?
Francis B
Posts
-
Get docking location of a control bar? -
Inserting DateTime valueHi! I have a problem when I try to insert DateTime value in an access database. I receive this exception: "Syntax error in INSERT INTO statement." I try two different ways to add Datetime and no one works!
newDataRow["Timestamp"] = DateTime.Now.ToString();
andnewDataRow["Timestamp"] = DateTime.Now;
But if I remove all DateTime stuff in my database and my code, I am able to insert data whitout any problem. Here my code:DataSet dataSet = new DataSet(); string dbGenConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="; string dbConn = dbGenConn + "fileName.mdb" + "; Persist Security Info=False;"; OleDbConnection conn = new OleDbConnection(dbConn); conn.Open(); OleDbDataAdapter adapter = new OleDbDataAdapter(new OleDbCommand("SELECT * FROM Data", conn)); OleDbCommandBuilder dataCmdBuilder = new OleDbCommandBuilder(adapter); adapter.Fill(dataSet, "Data"); for(int i = 0; i < items.Length; i++) { DataRow newDataRow = dataSet.Tables["Data"].NewRow(); newDataRow["DataID"] = i; newDataRow["Timestamp"] = DateTime.Now.ToString(); newDataRow["Quality"] = 192 dataSet.Tables["Data"].Rows.Add(newDataRow); } adapter.Update(dataSet, "Data"); conn.Close();
-
C# Excel Add-in QuestionHi! In one of my base classes, I have a function which receive a callback from another application. In this function, I would like to access Excel.Application object but I receive an exception: QueryInterface for interface Excel._Application failed. If my class were inherited from Windows.Forms, I could use BeginInvoke function. So I would like to know a way to access Excel.Application object in my callback function. Build with C# for Excel Object 9.0 (Excel 2000) Thanks in advance!
-
C# Excel COM Add-inHi! I created an excel C# COM Add-in with Visual Studio (Other Projets\Extensibility Projets\Shared Add-in). So, I would like to know how to add programmatically my add-in to COM Add-Ins dialog box (Tools\Add-In) of excel. I thought that the automatic registration, after building my add-in, adds it automatically to COM Add-ins dialog box but it doesn't seem.
-
Create a bitmap fileI'm trying to create a bitmap file from a memory device context but the only thing I create is a complete white bitmap. X| Here my code:
MyFunction()
{
CClientDC dc(this); //dc of dialog
CRect rectBF(0,0,450,450);
CBitmap bmp, *poldbmp;
CDC memdc;// Load the bitmap resource bmp.CreateCompatibleBitmap(&dc, 450, 450); // Create a compatible memory DC memdc.CreateCompatibleDC( &dc ); // Select the bitmap into the DC poldbmp = memdc.SelectObject( &bmp ); //CGraphWnd was created by Paul Barvinko - [A 2D data visualisation class](http://www.codeproject.com/miscctrl/graph2d.asp) m\_ctlGraphWnd.DrawGraphToDC(&memdc, rectBF); //Copy graph to DC memdc.SelectObject(poldbmp); CPalette palette; //Initialize palette if( dc.GetDeviceCaps(RASTERCAPS) & RC\_PALETTE ) { UINT nSize = sizeof(LOGPALETTE) + (sizeof(PALETTEENTRY) \* 256); LOGPALETTE \*pLP = (LOGPALETTE \*) new BYTE\[nSize\]; pLP->palVersion = 0x300; pLP->palNumEntries = GetSystemPaletteEntries( dc, 0, 255, pLP->palPalEntry ); // Create the palette palette.CreatePalette( pLP ); delete\[\] pLP; }
This code above works correctly. The graph was drawn in memdc.
//Function was created by Zafir Anjum - [Converting DDB to DIB](http://www.codeguru.com/bitmap/ddb_to_dib.shtml) HANDLE hDIB = DDBToDIB(bmp, BI\_RGB, &palette); if( hDIB == NULL ) return ; //Function was created by Zafir Anjum - [Writing a bitmap to a BMP file](http://www.codeguru.com/bitmap/bitmap_to_file.shtml) WriteDIB(\_T("graph.bmp"), hDIB); GlobalFree( hDIB );
}
I don't know why but operations done on memdc aren't reflected in CBitmap bmp. Thanks in advance!
-
Device Context and HwndHow to get Hwnd and DeviceContext of a splitter window ?
-
Send informations to a splitter windows (List View))I have a SDI application. My view is split into 2 parts. One of these windows is a List View. The user has the possibility of adding an item in the list view from a dialog. My problem is that I don't know how to get the information of the list view to call the function which to add items. I tried the code below but it doesn't seem to work. CMainFrame *pMainFrame=(CMainFrame*)AfxGetMainWnd(); CDocument * pDoc = ((CView *)pMainFrame->m_wndSplitter.GetPane(0,0))->GetDocument(); CBOFListView* prt = (CBOFListView*)pDoc->GetRuntimeClass(); prt->AddItemToList(Item); //AddItemToList is the function used to add items Thanks Regards!!
-
How to get Folder where the application is installedI would like to know, how to get the directory where the application is installed. I tried to use _getcmd but this doesn't works correctly. Thanks for your help!
-
Problem with Splitter WndI split the view of my application in two parts. My problem is that the status bar and toolbar disappear after the split and I don't know why!!! :confused: This is my code : int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { CCreateContext* pContext = (CCreateContext*)lpCreateStruct->lpCreateParams; int rc; CRect cr; if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } // TODO: Delete these three lines if you don't want the toolbar to // be dockable m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); DockControlBar(&m_wndToolBar); GetClientRect(&cr); CSize paneSize(cr.Width() / 2, cr.Height()); m_wndSplitter.CreateStatic(this, 1, 2); if(!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CBOFListView), paneSize, pContext)) { TRACE0("Failed to create Splitter Wnd\n"); return -1; // fail to create } if(!m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CBOFInfoView), paneSize, pContext)) { TRACE0("Failed to create Splitter Wnd\n"); return -1; // fail to create } return 0; } Best Regards!
-
Add ActiveX in a modeless windowsI want to add a Capture Video ActiveX in my program. When I add the ActiveX in my mainframe (CMyAppDlg) and that I use the associated functions with this activeX, I don`t have any problem. But I want to add this ActiveX in a modeless windows created by a item menu. The problem is when I include this ActiveX in my modeless windows and that I call the associated functions to the ActiveX, I have a Assertion Error: "Debug Assertion Failed!" in the file "Winocc.cpp" for each call of a function of this ActiveX. So, I don't know why the ActiveX work in my mainframe but doesn't work in the modeless Windows since I use the same code in the two manner? Thanks for your help! :) Francis B.