|
Thanks to both of you! using strcpy instead of using a pointer and locking the buffer helped, plus I didn't need to delete m_pFileData I was just trying to NULL it but that was not needed..
Thanks again.
|
|
|
|
|
Hi I am trying to implement a simple Bulk Row Fetching mechanism using the DoBulkFieldExchange function.
My problem is that I get a "????????????? ODBC ????? ?????????" message box on a CRecordset.Open command. I have implemented a derived CRecordset class for a simple table in sybase that has two columns and three rows of data.
Below are my header and implementation files.
// BulkFetch.h
class CBulkFetch : public CRecordset
{
public:
CBulkFetch(CDatabase* pDatabase = NULL);
DECLARE_DYNAMIC(CBulkFetch)
// Field/Param Data
//{{AFX_FIELD(CBulkFetch, CRecordset)
LPSTR m_fname;
LPSTR m_lname;
//}}AFX_FIELD
long *m_fnameLength;
long *m_lnameLength;
CString parm;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CBulkFetch)
public:
virtual CString GetDefaultConnect(); // Default connection string
virtual CString GetDefaultSQL(); // Default SQL for Recordset
// virtual void DoFieldExchange(CFieldExchange* pFX); // RFX support
//}}AFX_VIRTUAL
virtual void DoBulkFieldExchange(CFieldExchange* pFX); // RFX support
// Implementation
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
};
// BulkfFetch.cpp
IMPLEMENT_DYNAMIC(CBulkFetch, CRecordset)
CBulkFetch::CBulkFetch(CDatabase* pdb)
: CRecordset(pdb)
{
////{{AFX_FIELD_INIT(CBulkFetch)
m_fname = NULL;
m_lname = NULL;
m_nFields = 2;
////}}AFX_FIELD_INIT
m_fnameLength = NULL;
m_lnameLength = NULL;
m_nDefaultType = snapshot;
m_nParams = 0;
}
CString CBulkFetch::GetDefaultConnect()
{
return _T("ODBC;DSN=ARBOR_CUST1_PROD");
}
CString CBulkFetch::GetDefaultSQL()
{
return _T("[guest].[ashish_test]");
}
void CBulkFetch::DoBulkFieldExchange(CFieldExchange* pFX)
{
////{{AFX_FIELD_MAP(CBulkFetch)
pFX->SetFieldType(CFieldExchange::outputColumn);
RFX_Text_Bulk(pFX, _T("[fname]"), &m_fname,&m_fnameLength,30);
RFX_Text_Bulk(pFX, _T("[lname]"), &m_lname,&m_lnameLength,30);
////}}AFX_FIELD_MAP
}
/////////////////////////////////////////////////////////////////////////////
// CBulkFetch diagnostics
#ifdef _DEBUG
void CBulkFetch::AssertValid() const
{
CRecordset::AssertValid();
}
void CBulkFetch::Dump(CDumpContext& dc) const
{
CRecordset::Dump(dc);
}
#endif //_DEBUG
Thanks a lot.
ashish
|
|
|
|
|
I want only one column, and not a blank one in addition to col 0 that appears by default. I am doing:
m_list1.InsertColumn(0,"Keywords",LVCFMT_LEFT,800);
m_list1.SetColumnWidth(0, LVSCW_AUTOSIZE_USEHEADER);
m_list2.SetExtendedStyle(LVS_EX_CHECKBOXES);
m_list2.InsertColumn(0,"Options",LVCFMT_LEFT,800);
m_list2.SetColumnWidth(0, LVSCW_AUTOSIZE_USEHEADER);
if(NULL != m_list1.GetSafeHwnd())
{
m_list1.MoveWindow(100,100,200,400);
m_list2.MoveWindow(450,100,200,400);
}
Inspite of the great width specified, a 200 wide list control shows up with the col 0, plus a little part of another column (a blank one) showing. If I make the col width 100, then theres only one visible column. However I needa width of 200. What is to be done in this case?
Thanks,
ns
|
|
|
|
|
I had to get rid of the autosizeheader line, which actually someone here at CP had suggested when my setting the width didnt work ,> however right now, setting the width to 800 is doing the job...
Thanks anyways!
ns
|
|
|
|
|
Does anyone know a better way to get a single column in a list control without just sizing it bigger than the dialog?
|
|
|
|
|
... another app exclusively?
I need to be able to open a file for "reading" that is already opened exclusively by another app, that is writting to that same file.
I've used tools that do this, but can't figure out how it is done.
Can someone point me in the right direction?
Thanks much!
craig knutson
dakotaknut@yahoo.com
craigk
|
|
|
|
|
Hello,
I will really appreciate any input on the following problems.
I am implementing the Database operations using MFC .. and using DAO. The problem is when the program goes to get the data, it just quits. THIS HAPPENS ONLY ON SOME COMPUTERS. It just simply quits! This was happening when I was implementing ODBC in the same program. The screen where it is supposed to display the data, when it goes to the screen .. it just disappears and terminates. My database is in .mdb format.
The other problem is that it says "Unrecognized database format" if I write my database in Access 2000.
I am wondering if there are some win registry entries that are not being updated or something.
Thank you very much for your time and help !
Sincerely,
Anjum.
|
|
|
|
|
a3gupta wrote:
The problem is when the program goes to get the data, it just quits. THIS HAPPENS ONLY ON SOME COMPUTERS.
Does your installation program for your application include installation of DAO runtime components?
a3gupta wrote:
My database is in .mdb format.
The other problem is that it says "Unrecognized database format" if I write my database in Access 2000.
What version of MFC do you use?
|
|
|
|
|
Thank you very much for your response.
I am installing following files in my installation program:
DAO350.DLL
DAO2535.TLB
MSJTER35.DLL
MSJINT35.DLL
MSVCRT40.DLL
MSJET35.DLL
MSRD2X35.DLL
MSJTER35.DLL
MSJINT35.DLL
VBAJET32.DLL
VBAR332.DLL
I am using Visual Studio 6. So .. Visual C++ 6. It works fine on my computer .. but doesn't work on somebody elses computer. They don't have Visual Studio installed .. But ... I run the installation program. I am making the setup program using Installshield for Visual C++ 6.
Thank! Hope this infomation will be useful.
Sincerley,
Anjum.
|
|
|
|
|
I am not sure, if this article Q236991 will solve the all your troubles, but at least second one should be rectified.
|
|
|
|
|
Hi,
I had the same problem with "Unrecognized database format" and
I solved it like this:
In InitInstance() of my App-Class I put the follwing line:
AfxGetModuleState()->m_dwVersion = 0x0601;
That was it.
For further Information see the follwing Article on MSDN:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmsj00/html/cpp0100.asp
I hope that helps you.
MS
|
|
|
|
|
Hi,
My application interacts with the device through RS232
Data sent/Received over the port should be displayed
while still programming is communicating with the device.
For this I created one modeless dialog class with edit member variable
Now Consider one packet tobe sent, contents of this packet should be assigned to the dialog class member variable and it should be updated but when I tried todo so
my application is crashing. But if I do with Modal Dialog
it is working fine.
can anyone please explain me
Thanks in advance
Uday
|
|
|
|
|
too many about communication.
does ur app crash from comm or modeless dialog box?
normally, modeless must be global or class member, can not be local as modal one because it returns at once then local modeless dialog box is destoyed.
hope hit ur point
includeh10
|
|
|
|
|
It is crashing at modeless, further I have not created this as local.
When communication is happening I wnat to show the data sent/received for which I am using the modeless.
If I assign the packet(CString type) to my edit variable(CString type of modeless dialog class), it is getting crashed.When I tried to assign it to the local variable it is not crashing
|
|
|
|
|
Hello everybody,
I am not sure how hard this is, but I want to add a new configuration based on some #define code. I am trying to follow Paul DiLascia's tutorial on building a File viewer.
So this is my question. He adds a code that turns his SDI bitmap loader into an MDI bitmap loader. I want to do this too. He adds a lot of #ifdef _MDI statements that convert the code to MDI. You have to add a new configuration to do this.
How do I add a configuration to get this #ifdef _MDI to work? I tried to add a new configuration, but it never runs the code in the #ifdef _MDI, but always goes to the #else statements. I added a AfxmessageBox to make sure, and the message box always says "SDI Compilation" and never "MDI Compilation."
How would I go about adding his configuration?
Thanks so much,
NickOne
|
|
|
|
|
If you already created a new configuration for MDI mode, go to the Project Settings for it and look for the preprocessor section. Add _MDI to the list of predefined macros.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thank you!
I appreciate the response. I actually had figured it out after some battling. I am not too familiar with the user interface, so I didn't know this option existed. But you are absolutely correct.
Thanks again for helping me out, I always appreciate it very much.
NickOne
|
|
|
|
|
can i dock CDialogBar as CToolBar to anywhere and resize it as needed?
if yes, what is key to do?
thanks
includeh10
|
|
|
|
|
|
before i study for hrs, hope u give me one more word: can i do it (should be yes, i guess)?
a duke dollar and a for u.
includeh10
|
|
|
|
|
before i study for hrs, hope u give me one more word: can i do it (should be yes, i guess)?
Should be yess. The code needed is nevertheless so little that you'll be better off pasting it into your app and seeing the results.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
i tested both c++ and java socket (under windows), got similar results:
i.e. max 45 sockets in a single machine (clients and server are in the same PC).
i think there is no different between c++ and java socket from efficent, speed or capibility view.
do u have different thinking or experieces?
includeh10
|
|
|
|
|
You are basically right, Java and C++ sockets are mapped to system sockets, so they behave pretty much the same.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Suppose, you have a wizard that has bitmap on top of every page. Then, you want to add a title to the bitmap of every page. You don't want to modify the bitmap itself, rather add a text using something like CStatic. How would you do it?
I have tried adding a transparent CStatic and it doesn't work. I have played with other options on CStatic and they don't seem to work either. Any ideas?
thanks
|
|
|
|
|
Transparent CStatic s aren't really that static. You can use (for instance) Norm Almond's CLabel to have true transparency.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|