|
Enable Auto HScroll.
/Per
|
|
|
|
|
Enable Auto HScroll.
/Per
|
|
|
|
|
I want to save in file the system time in format of:
____________
DWORD year
DWORD month
DWORD day
DWORD hour
DWORD minute
DWORD second
______________
Which func would give me this or how can I to extract only this data from the func: GetSystemTime() ??????????
|
|
|
|
|
Have you tried it yourself yet? GetSystemTime() will give you WORDs. If you're stuck, post your code so we can see what you've tried.
--Mike--
http://home.inreach.com/mdunn/
"Make sure that if you are using a blow torch that you don't set anything on fire."
-- Chris Maunder
|
|
|
|
|
|
What is the difficulty?
Just copy the values you need and convert them to DWORDs.
I would have understand it if GetSystemTime gave you 6 WORDs and you wanted 8.
|
|
|
|
|
OK, I have made an app that parses a bunch of files and I have all the data
stored into various arrays.
I would like to be able to store this information into an Access database.
I have no clue where to start on accessing Access and writing information to
a database though. If anyone could help me out and point me in the right
direction I'd be greatful!
Adam
cabadam@houston.rr.com
|
|
|
|
|
If you use MFC, CDaoDatabase and CDaoRecordset may help you. With the class wizard add a new CMyDaoRecordset and map the database fields into class members. You find examples on MSDN.
|
|
|
|
|
OK, but it gives me 'unrecognized database format' when creating the class and selecting which database I want to use... I am using Access 2000. Will that not work?
Adam
cabadam@houston.rr.com
|
|
|
|
|
If you use Access 2000 you have to add an instruction in the CYourApp::Initinstance()
The instruction is:
AfxGetModuleState()->m_dwVersion = 0x0601;
This work if you are linking with the MFC DLL.
You can take a look at the Q236991 on MSDN for further details.
|
|
|
|
|
Your right, ClassWizard doesn't support Jet 4.0 formatted files. Either create the file in Access 97 or you will have to create the record sets and bind them manually.
There is another way to do this and use the generic recordset that is posted in the Database section. That is the way I go because I don't like all the recordset files that are required for each table within the file, source code can get quite large.
|
|
|
|
|
[snip]
There is another way to do this and use the generic recordset that is posted in the Database section.
[/snip]
What do you mean?
This is my first venture into doing anythign with databases (at least programatically, I HAVE used Access before )
I tried to look into the Enroll MFC sample, but it requires some database that you can't download from online (and I can't find my VStudio stuff right now...)
Adam
cabadam@houston.rr.com
|
|
|
|
|
In the Code Project's General section - Database area, there is an artical called "The CGeneric Database class".
What this does is allow you to use the CGeneric recordset without binding the columns the way Class Wizard does. You can either set/get the column data via the calls like GetBool( "Column Name" ); or GetBool( column number );
This is a Dynamic way to use DAO vs the static way that Class Wizard does it. Also if you add new fields to the table, you don't have to rework the code, just add the new Get/Set routines.
|
|
|
|
|
Visual Studio 6.0 Wizard don't support Access 2000. You must convert to Access 97 or use ODBC instead (Use CRecordset instead of CDaoRecordset)
|
|
|
|
|
How do I "paint" text/CString in an ActiveX window? A sample code will be helpful...Thanks!
|
|
|
|
|
Could somebody who's got the most recent Platform SDK please send me a couple of small files? I can't justify downlaoding the whole damned thing (or even a specific category) just for two files! Especially not from the UK on a 56k (~4kbs) connection I still havent' been able to order the CD, so this is my only option.
The files are:
DBGHELP.LIB
DBGHELP.DLL
.. and the header (if there is one).
Please post here if you can send them to me after sending them to stop me getting a mail box full of them.
Thanks in advance,
David Wulff
dwulff@battleaxesoftware.com
|
|
|
|
|
David, they’re on their way.
-Ben
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
I've finally figured out how to create a DAO Database, add the tables and add the fields to the tables, but I can't figure out how to add an index to a field.
Can someone give me a tumbnail sketch of how to attach an index to a field in a new database?
Thanks!
Richard
|
|
|
|
|
You do not add an Index to a field, but rather add the index to the CDaoTableDef using the field information. Use CDaoIndexInfo, CDaoIndexFieldInfo to define the index and then use CDaoTableDef::CreateIndex() to create the index in the table definition.
|
|
|
|
|
I'm having a heck of a time with this one guys so any points in the right direction or helpful tips will be greatly appreciated. I have used this 3rd party control a ton of times in Visual Basic (no flames ), it is written using VC++ and ATL. It compiles and builds fine, however, I get this error in occsite.cpp when running the application in debug mode "Unhandled Exception", and it breaks here:
DWORD COleControlSite::ConnectSink(REFIID iid, LPUNKNOWN punkSink)
{
ASSERT(m_pObject != NULL);
LPCONNECTIONPOINTCONTAINER pConnPtCont;
if ((m_pObject != NULL) &&
>>BREAK<< -> SUCCEEDED(m_pObject->QueryInterface(IID_IConnectionPointContainer,
(LPVOID*)&pConnPtCont)))
{
ASSERT(pConnPtCont != NULL);
LPCONNECTIONPOINT pConnPt = NULL;
DWORD dwCookie = 0;
if (SUCCEEDED(pConnPtCont->FindConnectionPoint(iid, &pConnPt)))
{
ASSERT(pConnPt != NULL);
pConnPt->Advise(punkSink, &dwCookie);
pConnPt->Release();
}
pConnPtCont->Release();
return dwCookie;
}
Here are the steps I have taken to get to this point. Added the control to a Dialog based application. Clicked on project->Add to project->Components and control. I click on the control in the Registered ActiveX controls (Oh, I used MFC and classwizard with dynamic link to MFC, and ActiveX support checked, and tried it with Automation support) select the control. Use the toolbox drag the control to a dialog, then use class wizard to assign it to a variable of type Control -> Class Name.
VC generated 4 wrapper classes, and then I build the app, no errors no problems, but when I hit F5 I get the error message above.
My assumption that all ActiveX controls, built on the COM architecture, are supposed to be interchangeable between enviornments. Is it possible this is not the case? Please post any help you can here, or feel free to email me, but I'm stumped on this one. I may have to use the C++ wrapper for the control, but shouldn't this step work?!?!
Thanks in Advance for any help!
Sam C
----
Systems Manager
Hospitality Marketing Associates
|
|
|
|
|
The above shouldn't say break, should of said ASSERTION in big bold letters
If anyone even has a guess to why this is happening or can explain to me why ActiveX controls aren't universal please do. Thanks.
Sam C
----
Systems Manager
Hospitality Marketing Associates
|
|
|
|
|
I need access to a CListBox variable which is in View.h, m_ctrlMyListBox, from various of my other classes. How can I get that?
|
|
|
|
|
You can access your view from anywhere like this:
CFrameWnd *pFrameWnd = (CFrameWnd *)AfxGetMainWnd();
ASSERT (pFrameWnd != NULL && pFrameWnd->IsKindOf(RUNTIME_CLASS(CMDIFrameWnd)));
pFrameWnd = ((CMDIFrameWnd *)pFrameWnd)->GetActiveFrame();
CMyView * pView = (CMyView*)pFrameWnd->GetActiveView();
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
Hi,
I have a dialog box, I've placed a tree control in it.
How can I populate that tree?I need to place items from a .dat file into that tree? I just don't know the basic syntax of doing it...
How do you add items?
Thanks!
P.S.
I'm new at this. Tried to use a sample from msdn, but the only thing that it does is gives me a tree with only "united states" in it.
Thanks again
// Gain a pointer to our tree control
CTreeCtrl* pCtrl = (CTreeCtrl*) GetDlgItem(IDC_TREE1);
ASSERT(pCtrl != NULL);
// Insert a root item using the structure. We must
// initialize a TVINSERTSTRUCT structure and pass its
// address to the call.
TVINSERTSTRUCT tvInsert;
tvInsert.hParent = NULL;
tvInsert.hInsertAfter = NULL;
tvInsert.item.mask = TVIF_TEXT;
tvInsert.item.pszText = _T("United States");
HTREEITEM hCountry = pCtrl->InsertItem(&tvInsert);
// Insert subitems of that root. Pennsylvania is
// a state in the United States, so its item will be a child
// of the United States item. We won't set any image or states,
// so we supply only the TVIF_TEXT mask flag. This
// override provides nearly complete control over the
// insertion operation without the tedium of initializing
// a structure. If you're going to add lots of items
// to a tree, you might prefer the structure override
// as it affords you a performance win by allowing you
// to initialize some fields of the structure only once,
// outside of your insertion loop.
HTREEITEM hPA = pCtrl->InsertItem(TVIF_TEXT,
_T("Pennsylvania"), 0, 0, 0, 0, 0, hCountry, NULL);
// Insert the "Washington" item and assure that it is
// inserted after the "Pennsylvania" item. This override is
// more appropriate for conveniently inserting items with
// images.
HTREEITEM hWA = pCtrl->InsertItem(_T("Washington"),
0, 0, hCountry, hPA);
// We'll add some cities under each of the states.
// The override used here is most appropriate
// for inserting text-only items.
pCtrl->InsertItem(_T("Pittsburgh"), hPA, TVI_SORT);
pCtrl->InsertItem(_T("Harrisburg"), hPA, TVI_SORT);
pCtrl->InsertItem(_T("Altoona"), hPA, TVI_SORT);
pCtrl->InsertItem(_T("Seattle"), hWA, TVI_SORT);
pCtrl->InsertItem(_T("Kalaloch"), hWA, TVI_SORT);
pCtrl->InsertItem(_T("Yakima"), hWA, TVI_SORT);
|
|
|
|
|
Ah, the basic problem of the parent doesn't know that it has any children attached. Change your tvInsert.mask to include TVIF_CHILDREN and set the tvInsert.cChildren either true or false depending on if the parent has any children.
Another way is to create parents with no children, then when you add children to a parent, tell the parent that it now has children. When you add a child to a parent, call a function like UpdateParentItem( HTREEITEM hParent );
void UpdateParentItem( HTREEITEM hParent )
{
// Can't use ItemHasChildren() because it will always return
// the value of the item.cChildren variable.
// Need to get the first child and update the parent as needed.
// Getting the first child of a parent will always return either
// NULL if no children exist or the handle to the first child
// regardless of the item.cChildren variable.
HTREEITEM hChild = m_pTree->GetChildItem( hParent );
// Set up the item structure
TV_ITEM item;
ZeroMemory( &item, sizeof(TV_ITEM) );
item.hItem = hParent;
item.mask = TVIF_CHILDREN;
item.cChildren = hChild != NULL;
// Update the parent node to reflect the children state.
m_pTree->SetItem( &item );
}
Also make sure that when the tree control is created you set the TVS_HASBUTTONS or you will not see the plus/minus button on the parent. You would have to double click the parent to see if there is any children.
|
|
|
|