|
Happy Birthday!
|
|
|
|
|
I thing the problem was MFC arranged the dx stuff alphabetically!
|
|
|
|
|
Interesting.
Which version of MFC or Visual C++ are you using by the way? (Just out of curiousity)
|
|
|
|
|
Look up CRecordset::m_nFields in MSDN.
It describes the column alignment requirements
|
|
|
|
|
Using VC++ 6.0 and I think the MFC is still 4.0.
Yes, I did run into this few years back.
Today I'll build a test app with just single table and one field ( if there is such a thing!) and do some testing.
In theory it should work with just one variable.
On a side note - since I am no SQL expert - why does CRecordset rejects
"SELECT ALL FROM table" but it likes "SELECT * FROM table"?
Apparently terms "column", "field" and this darn descriptor index are blood relatives.
Vaclav
|
|
|
|
|
Vaclav_Sal wrote: why does CRecordset rejects
"SELECT ALL FROM table"
Quite honestly, I've never seen or used "SELECT ALL" before so I'm not going to be much help on that.
Wish I knew more about SQL but I've only ever known the bare minimum to get by.
|
|
|
|
|
I have to quit for a while, but the bad news is that CRecordset does not like to have more than one table and its variables "bound".
Also the SELECT must select all of the columns in a single table - that makes some sense.
The key is the m_nFields counter in the constructor.
I think that is our unfriendly descriptor index !
I have also discovered if you add another table / variables the returning recordset is read only no matter what the Open options are.
I guess that is mixing the records and somewhat makes sense too.
Cheers Vaclav
|
|
|
|
|
HERE IS MY FINAL ANSWER!!!
MFC CRecordset wizard builds (MS calls it binds )
DoFieldExchange(CFieldExchange* pFX) and puts the calls to
RFX_... functions
example
RFX_Long(pFX, _T("[ContactID]"), m_ContactID);
IN ALPHABETICAL ORDER !!!!!
Logically, it has no other ordering choice anyway.
The SQL SELECT * reads the fields/columns in ascending NUMERICAL order.
This must be the mysterious descriptor index!
So, when CRecordset does Update the data does into database fields in ALPHABETICAL order and you get all kinds of error messages – including the Invalid Descriptor Index - and no update at all.
If the CRecordset has variables (build by wizard) from more than one data table – just forget it and go fishing!
Actually - IMHO using wizard to derive class from CRecordset is the buggiest code in MFC. It never works on first try.
Cheers Vaclav
|
|
|
|
|
Hi,
I came across an article about setting windows Environment variables from within a program.
http://www.codeproject.com/KB/system/EnvMan.aspx[^]
However it uses .net library's Environment class to do it.
Is there some way to do it using win32/mfc native code?
I tried the _putenv() and getenv() functions but it seems they affect the process which makes these calls only. The changed values do not get reflected on the system level.
Is there any other way to achieve this?
only dead fish swim with the stream
modified on Sunday, May 25, 2008 8:38 AM
|
|
|
|
|
|
thanks Jijo raj.
this seems to be exactly what i was looking for.
only dead fish swim with the stream
|
|
|
|
|
Hi,
i'm working now for some days with the ultimate toolbox.
The small examples were no problem, but now i'm in the advanced folder at the Fileexplorer example.
This is the contol i need and the reason for me to start with the UT because later on i wlii try to implement such a treevew and its listview in a projekt of mine.
But because of the total lack of tuts dealing with the UT i've now a problem.
I copied the FileExplorer sample out of the sample folder in another folder and then i added the headerfiles OXShellFolderTree.h, OXShellNamespaceNavigator.h und OXShellObjectList.h to the project, it works !
But know i want to build up this FileExplorer example on my own, because of training reasons.
I opend a new mfc project (Windows Explorer Style) and added the headerfiles.
What have i to do now?
There is a folder in the orig. sample "UTBSource", have i to add it to my project too?
Have i to change something in the project settings in the studio?
Oh i think it is quiet important, i'm usin Vc++ 6.0 !!!
Thanks a lot for your help!
Best regards
Crocodile Buck
P.S.: Do you know some step by step tuts dealing with the UT.
|
|
|
|
|
...really nobody?
best regards
Croc
|
|
|
|
|
Hi all,
In a fashion similar to that of the existing windows start/task bar, I would like to create an additional bar/panel at the upper extremity of the desktop area. As this would involve a reduction of the existing desktop area in order to ensure that application windows do not encroach upon this area, I'm at a loss as to how this may be achieved.
Any ideas/advice would be gratefully received.
Best regards, Lee.
|
|
|
|
|
i want to convert source from c++ to c.
if you know site that i can request small source to convert or delevope who can use c++ and c
Total number of line is 500.
please tell me~
hi
|
|
|
|
|
Search on internet, you will get lot of options , ofcourse, if they understand what you are trying to do.
Prasad
MS MVP - VC++
|
|
|
|
|
sunerbun wrote: i want to convert source from c++ to c.
Make it yourself: it's a quite enjoyable experience, good luck.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Just some add on informations. May be helpful during your quest.
Cfront - the first C++ compiler made by Stroustrup works the same way as you wish. It converts C++ programs to C and compiles. But it failed to implement C++ exception handling and came to RIP . See wiki for more info - http://en.wikipedia.org/wiki/Cfront[^]
You can download the CFront from http://www.softwarepreservation.org/projects/c_plus_plus/cfront[^]. But not sure whether you can generate the intermediate C files. Anyway just have a look.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
If it can be done or not, depends entirely on the code.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I think you must doing yourself.
|
|
|
|
|
Hamid. wrote: I think you must doing yourself.
or get it for free at www.cpallini.freeproducts.com[^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
But I cant connect to your web site(do you know why) when I want to connect it asks do you know Pallini I said yeah then I got "you cant use of this site" again I said No and it told me this site designed for Pallini!
|
|
|
|
|
I am reading the value of the size from the properties file...
e.g.
file_size=500.
I have to check for the file size limit. The max limit is set as done above. During runtime the following function checks for the file size with the above by using the following function to get the current file size.
int get_file_size()
{
long file_size;
ifstream myfile;
myfile.open(path.c_str());
myfile.seekg(0, ios::end);
file_size = myfile.tellg();
myfile.close();
return file_size;
}
But if I do this I get the file size in bytes. I want to do everything in kb's. Any suggestion please.
THANKS.
|
|
|
|
|
How about:
return file_size/1024; ?
|
|
|
|
|
No, that would be a Kibibyte.
|
|
|
|