|
Mike,A big hello.
sorry I missed that part. DOSDATE and DOSTIME structs looks like:
typedef struct DOSDATE<br />
{<br />
WORD day;<br />
WORD month;<br />
WORD year;<br />
}DOSDATE;<br />
<br />
typedef struct DOSTIME<br />
{<br />
WORD hour;<br />
WORD min;<br />
WORD sec;<br />
}DOSTIME;<br />
But I cann't seem to get it right.
Hush,hush...
thought I heard you call my name now.
Kula Shaker.
Amit Dey
Latest articles at CP - Writing Word addins
Office addin
|
|
|
|
|
Well, casting a DOSDATE to a WORD won't do you any good, since a DOSDATE is not a WORD , nor is it packed into a WORD as described in the docs for DosDateTimeToFileTime() . You'll need to pack them yourself, or do some trickery with the structs, maybe this (note: untested):
typedef struct DOSDATE
{
unsigned day : 5;
unsigned month : 4;
unsigned year : 7;
} DOSDATE;
typedef struct DOSTIME
{
unsigned hour : 5;
unsigned min : 6;
unsigned sec : 5;
} DOSTIME;
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
If my rhyme was a drug, I'd sell it by the gram.
|
|
|
|
|
I'm attempting a first for me - connecting to and using a SQL Server DB using VC++6. I've been studying the Enroll samples, and find them clear enough, but I'd like to find a step-by-step tutorial that walks me through the process using VS6. For once Google isn't being helpful, and the articles on MSDN are less than perfectly clear to someone new to DB programming. Any recommendations?
"Your village called - They're missing their idiot."
|
|
|
|
|
|
I managed to find my way around using the IDE - my first stab was to create a database project using the wizard, but that clearly doesn't do what it sounds like it should. But a second try using the MFC App Wizard seems to have done the trick; I've never asked the wizard to include database support before, and it made it amazingly easy, since I'd already created the datasource on SQL Server. What I'm trying to do is quickly gain some experience with ODBC in C++ in preparation for a hoped for interview in a few weeks, coming from a history of doing only dialog and console apps. I found out in the first interview that they're using MFC to access SQL Server and a database on a remote AS400 system, so I suspect ODBC is the best choice for me to tackle first. Having done it once on my own will help me to avoid sounding like a complete idiot if I'm selected for the final interview.
You're right about the ADO stuff here - it's been invaluable to me for web db access! We've got some really great authors on this site, but none have covered what I'm looking for right now. Perhaps I should document the steps as I go and do an article later for other tyros...
"Your village called - They're missing their idiot."
|
|
|
|
|
Roger Wright wrote:
What I'm trying to do is quickly gain some experience with ODBC in C++ in preparation for a hoped for interview in a few weeks, coming from a history of doing only dialog and console apps. I found out in the first interview that they're using MFC to access SQL Server and a database on a remote AS400 system, so I suspect ODBC is the best choice for me to tackle first.
A lot depends on the age of their code and the experience of their current developers. I haven't used MFC built in CRecordset/CDatabase stuff since about '98.
If you've used ADO with VB/ASP, then using it in C++ is pretty much the same, apart from having to do a bit more typing.
The #import "C:\Program Files\Common Files\System\ADO\msado15.dll" generates a nice ADO COM wrapper which will let you do most database calls just like you would with ASP. There are some good classes here on CP which go into further detail.
I haven't looked at the MFC classes in quiet a while, but as they are quiet old MSDN has plenty of topics on the subject.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_Database_Topics_.28.General.29.asp[^]
might be a good starting point (if you haven't already seen it)
Michael
Blue canary in the outlet by the light switch
Who watches over you
Make a little birdhouse in your soul - They Might Be Giants
|
|
|
|
|
Michael P Butler wrote:
A lot depends on the age of their code and the experience of their current developers
Considering that the IS Manager I interviewed with this week proudly displays a framed MFC Certificate on his wall, I think I'm fairly safe in assuming that MFC is the way to go for now. He also informed me that they use VS6 exclusively and have no near-term plans to move to .Net. I don't know about the experience level there, but the boss is an accountant who taught himself programming and one of the staff I met teaches at the college (VS5). I know I have a lot to learn, but it shouldn't be hard to manage; besides, it's so much easier to learn quickly when you have access to coworkers with more detailed knowledge. The code is old, but they're staffing up for a complete rewrite of the casino player management system, and I want to play!
Thanks for the link! I've been there before, but I'll be spending a lot of time with it.
"Your village called - They're missing their idiot."
|
|
|
|
|
If you really want to shine, you could always use OLE DB. Sure, it's a bit more low level than ADO, but if you're not dealing with data bound controls, then ADO doesn't really offer anything but tedious _bstr_t s and _variant_t s.
OLE DB consumers (client code) are quite easy to get going with as this article[^] shows. <plug>And if you'd like nice versions of CCommand and CDynamicAccessor, then you can always try out my stuff[^]. It probably won't compile with VC6, but I don't think it would take too long to get it to work with VC6.</plug>
But using static accessors (used in the first article I mention), you'll get perfomance ADO won't ever come close
--
He is the painkiller. This is the painkiller!
|
|
|
|
|
Hi
I am not using mfc or any kind of complex thing
I just work with windows forms using c++.
My question is how can I have a have the following.
by clicking the fist Button. user starsts a while loop. In the loop a series of events take place, and then we ask the user to input something to textBox. user enters the data and,clicks the 2nd Button. the program gets the data and goes back to the loop continueing its job.
what i have so far is :
private: System::Void 1stbtn_Click(System::Object * sender, System::EventArgs * e)
{
while (mycondition is true)
{
...do the job
wait for 2ndbtn to be pressed;
...do the job
}
}
private: System::Void 2ndbtn_Click(System::Object * sender, System::EventArgs * e)
{
lol = textBox->Text;
}
what is the sytax and what libreries should be used?
|
|
|
|
|
You're thinking sequentially, which is not how windows forms (or any windows based program) works. The wait for the 2nd and further button is done by .NET itself.
Thus, when the first button is clicked, you do some stuff inside it's handler. When the second button is clicked, you do some stuff inside it's handler and so on.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I want to write a function that will have a different return type depending on the state of the class. i.e. - something like this for my header file:
if(this->SomeProperty & CHECK_PROP)
CFoo& operator()(const CClass&);
else
CBar& operator()(const CClass&);
I'm thinking templates, but when I tried this:
template <typename T> T& operator()(const CClass&)
{
if(this->SomeProperty & CHECK_PROP)
return m_foo;
else
return m_bar;
}
I would do: (knowing CHECK_PROP is set)
foo = testClass(m_class);
and that would generate:
<br />
error C2783: 'T &CTestClass::operator ()(const CClass&)' : could not deduce template argument for 'T'<br />
Any ideas how I could accomplish this without writing two seperate functions.
(which I tried, but you cannot have functions with the same signature that differ only by return type )
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
This cannot be done. How did you expect to know the type the function would return when assigning the return value to a variable?
What I suggest you do is derive the two types that your functions would return from a common class, have it return that and then do a dynamic downcast to determine which type was returned.
Ivor S. Sargoytchev
Dundas Software
|
|
|
|
|
Hello all,
I just wanted to ask if any of you know how to hook the Startbar for just the following messages - I'm new to this hooking stuff, and a lot of it doesn't make sense to me so if you could be gentle, that would be great:
WM_ACTIVATE
WM_MOUSEMOVE
WM_MOUSELEAVE (by using TrackMouseEvent on the Startbar)
I want to try and not use a global hook since I'm just hooking 1 window, but if that is what I need to do, I guess I'll do it. Any suggestions?
Sean Payne
|
|
|
|
|
Hello there
I was wondering if there is anybody who could help me out, or point me in the right direction on the following issue:
I would like to implement a toolbar that changes dynamically between a compact and an extended mode, depending on where the user decides to dock the toolbar.
In my app I the user can choose a number of different objects to draw in a window, to delete the selected one, and to delete them all.
This toolbar is currently implemented with an initial dropdown menu toolbutton that contains all the objects (with a default when just the button is clicked), and the two toolbar buttons for delete selected, and delete all. This is exactly the functionality that I am looking for when the toolbar is horizontally docked (i.e. top or bottom). (This compact mode would in my case contain three buttons.)
What I am (unsuccessfully) trying to implement, is for this compact toolbar to dynamically change to an extended toolbar, if the user chooses to dock it vertically. This extended toolbar would - instead of the dropdown menu - contain all the different objects on individual buttons (ideally with separators where the menu has separators), with the two delete buttons at the end (i.e. bottom). (This extended mode would in my case contain nObjectCount + 2 buttons.)
(Have I made my problem clear enough???)
Does anybody know how to detect that the toolbar docking state is changing and how to dynamically add, delete or hide buttons?
/jnks
|
|
|
|
|
I can help out with one side of it. You can change the buttons on the toolbar by just calling LoadToolbar(ID) on it again. If you have 2 versions of your toolbar resource available for horizontal and vertical dock, you just need to call the LoadToolbar() with the correct ID on your toolbar object.
As for detecting the docking.... I will do a quick bit of research.
Roger Allen - Sonork 100.10016
If your dead and reading this, then you have no life!
|
|
|
|
|
If you override CFrameWnd::RecalcLayout in your CMainFrame clas, you should get a call here everytime the window is resized or the docking layout changes.
To see whether the toolbar is horizontal or vertically docked, my best suggestion is to get the rectangles of the 1st and 2nd items in the toolbar and see whether it is to the right (horizontal) or below (vertcal) to work out the docking state. Then if its different call LoadToolbar() with the correct resource ID to get the version of the toolbar you will need.
You will need at least the same 2 buttons in both toolbar resources for this to work.
Roger Allen - Sonork 100.10016
If your dead and reading this, then you have no life!
|
|
|
|
|
Thanx. I'm trying it now.
Do you know if there is any way to ask the toolbar the ID of it's loaded resource?
|
|
|
|
|
Hello again
Never mind my previous question. I just ask the toolbar for the index of the dropdown button that is only present in the compact version.
Almost everything works great, the only problem is that I need for the toolbar to recalculate its size when it becomes floating after it has been vertically docked. But I think I can figure this one out.
/jnks
|
|
|
|
|
I have a dialog window with a Tab Control. When I run the program the Tab Control is covering the text that should be a part of the Tab. If I call UpdateData(FALSE) two of the text controls are shown but not all of them. I'm can't find a way to send the Tab Control to the back of the frame or don't know if this is the problem. Any suggestions would be helpful.
Steve
|
|
|
|
|
Is it possible to buy a dvd or cd with all the CP MFC/c++ articles/demos/srcs?
Thanks,
ns
|
|
|
|
|
Ooohhh! Wouln't that be sweet!
Chris? Any plans?
I Dream of Absolute Zero
|
|
|
|
|
But then you'd never visit!
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Not true!!!
Its just that I have this awful thought that someday I'll try to come to the site and it will have vanished!!! I know I know --- its ridiculous...but there it is. The CD would just give me some peace of mind ya know! And we could buy new ones every 3-4 months with the updated and new articles....
I use CP articles etc all the time! I'd say 90% of what I've learned in programmming so far has been thanks to this site....
|
|
|
|
|
What happend to the TabCtrl?
I've tried to add a XP-style vertical TabCtrl in a litle application and was all amazed to get rubbish instead of a cool gui. Off course I added a mainfest and called InitComm... (you know what to do). But the tabs are drawn like horizontal tabs, though nicely placed and sized. No text on the tabs at all. The mouse interface still works fine, you even get hottracking, but of what use is that.
Than I sayed: I'l draw it myself! Bu Oh oh. After a troublesome time, scanning the 'Visual styles' documentation in the MSDN (which is by the way deep below MSDN standards in size and quality):
There are only style-definitions for vertical tab controls. Am I right or am I blind?
Someone must have seen this before. Please help!
( PS: I've just tried TCS_BOTTOM style -> )
|
|
|
|
|
XP Themes don't support vertical style tabs. Sorry.
--
Joel Lucsy
|
|
|
|