|
You could use your connection object as the ActiveConnection argument in the RecordSet Open method.
|
|
|
|
|
Thanks - I thought so, but when I tried this it did not work. I am enough of a rank beginner with ADO that I needed a sanity check to make sure I was headed in the right direction. Now I know I was, I'll have another look & see what I was doing wrong.
Christian
Secrets of a happy marriage #27:
Never go to bed if you are mad at each other. It's more fun to stay up and fight.
|
|
|
|
|
In my view I've placed a grid control. The view is derived from CFormView. When I run the application I get an small border around the grid control even that I've dragged the grid control till the edges of the form when I created it.
|
|
|
|
|
How do I add full DDX support to a class I have created based on an existing MFC class?
I have a class that is derived from CButton. I have overridden the PreSubClass.. function to ensure that it is owner drawn, which in turn enables the subclassing through DDX_Control. However, with it being a button the user could add a member variable through ClassWizard, such as a boolean for a checkbox. How do I enable the support for DDX_Check and DDX_Radio?
Derek Lakin.
Salamander Software Ltd.
|
|
|
|
|
|
I did have a look at that one, but hoped there was another way round. Am I right in thinking that to do it this way I'd have to define new DDX_ routines (in my subclass?) and then provide users with the necessary changes to make to DDX.CLW?
I was hoping that I could override some function or handle a message in my subclass
Derek Lakin.
Salamander Software Ltd.
|
|
|
|
|
Do you want to use ClassWizard/DDX for creating data members (BOOL, int, CString) or controls (CYourBtn, COtherWnd)?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I want the users of the class (which is nearly finished!) to be able to use the ClassWizard to add member variables in the usual way when they have a button of mine.
So if it's actually a checkbox and they want a boolean member variable in a dialog, for example, they can use ClassWizard to add a boolean member variable, and hey presto it works
The process of using DDX_Control to subclass the button to be one of mine is already in place. But it will use DDX_Radio or DDX_Check (or whatever it is) for member variables, which obviously then doesn't work
Derek Lakin.
Salamander Software Ltd.
|
|
|
|
|
I can't understand where's the problem. If you want to use an instance of CYourBtn with DDX_Control, just do it. ClassWizard is smart enough to include CYourBtn in the list of available classes - you'll see CButton and CYourBtn. You don't even have to play tricks with custom DDX. If you can't see CYourBtn on the list, delete and rebuild .clw file.
But it will use DDX_Radio or DDX_Check (or whatever it is) for member variables, which obviously then doesn't work
DDX_Control doesn't use DDX_Check or DDX_Radio. Who told you this?
DDX_Radio and DDX_Check are used for "value" (non-control) members: look at their prototypes - there's no CWnd parameter.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Sorry, I'm not being particularly clear.
Agree with you totally re: DDX_Control. No problem there.
However, if I have a dialog with a CMyButton on it that is a check box and I want to have a boolean member variable associated with it then Classwizard uses DDX_Check . However, I have noticed in my own testing that this doesn't work for CMyButton
So I guess the question really is what do DDX_Check and DDX_Radio use for performing DDX, is it, for example, GetCheck ?
Derek Lakin.
Salamander Software Ltd.
|
|
|
|
|
So I guess the question really is what do DDX_Check and DDX_Radio use for performing DDX, is it, for example, GetCheck?
This question is an easy one DDX_Radio and DDX_Check use Win32 API directly - ::SendMessage, BM_GETCHECK and BM_SETCHECK. They have to do this b/c sometimes (very often) there's no MFC object associated with given Windows control. This functionality is the lowest common denominator.
Have you overriden GetCheck in your class? This will not work.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Sorry for not replaying sooner, I've been really busy.
So will it work properly if I don't override GetCheck ?
Derek Lakin.
Salamander Software Ltd.
|
|
|
|
|
It doesn't really matter if GetCheck is overriden or not - it's non-virtual and only programs dealing explicitly with CYourBtn will be able to call your method.
CButton::GetCheck is a very simple wrapper over BM_GETCHECK; if you want to play tricks with button state (and override default Windows behavior), you'll have to handle this message. This will solve the DDX_Radio/DDX_Check problem as well - they send BM_GETCHECK to your button when bSaveAndValidate is TRUE.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
So presumably the same applies for BM_SETCHECK when bSaveAndValidate is FALSE ?
Thanks for your help on this one. Look out for the article
Derek Lakin.
Salamander Software Ltd.
|
|
|
|
|
Dears,
I want to build a printer driver. Any one have any idea?
Regards
Tarek Eslim
|
|
|
|
|
Hello,
I have to determine the version of the currently installed Internet Explorer via the COM interfaces of IE using Visual C++ 6.0. Is there any way?
ThanX in advance...
Greetz, HendriK
|
|
|
|
|
Hi there,
I am trying to create my own version CStringArray and I am testing this in my own little Win32 Application.
My header is something like this:
#include <tchar.h>
#include <afxcoll.h>
class CSuperStringArray : public CStringArray
{
public:
CSuperStringArray(int = 10);
CSuperStringArray(const CSuperStringArray &);
~CSuperStringArray();
const CSuperStringArray &operator=(const CSuperStringArray &); // assign arrays
};
My cpp is like this:
#include "CStringArrayOperator.h"
CSuperStringArray::CSuperStringArray(int nLength)
{
}
CSuperStringArray::CSuperStringArray(const CSuperStringArray &)
{
}
CSuperStringArray::~CSuperStringArray()
{
}
const CSuperStringArray & CSuperStringArray::operator =(const CSuperStringArray &)
{
return *this;
}
and then I got a winmain that tries to use this a little bit...
When compiling with "Not Using MFC" option, I get the following errors:
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
Debug/CStringArrayOperator.exe : fatal error LNK1120: 2 unresolved externals
But when I compile statically or dynamically, it all works out.
Is there anyway that I can compile this code without the MFC DLLs?
|
|
|
|
|
You're deriving your class from CStringArray. This is one of the MFC classes, you need to link with MFC.
BTW: you should return non-const reference to CSuperStringArray in operator=.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I have recently installed both SP5 and the Processor Pack to visual C++ 6 and I am having the following problem. When an exception occurs inside a try catch block inside a function that calls ado methods the function crashes (in the debug build) on return. The following code runs fine when compiled with an earlier service pack and no processor pack, but with SP5 + Processor Pack it crashes during the return from the test function. Also if I compile it on a pc with an eariler sp, it will debug and run fine on a machine with the latest sp (as long as you don't try to compile!).
The following code has been reduced to the smallest part that I could get it to crash. I compiled it as a Win32 console application and did not change any of the default values. In SP5 + processor pack an access violation occurs when test() returns. This was tested on win2k. I compiled and tested it in debug build only.
#include "stdafx.h"
// You must change this to match your path
#import "D:\program files\common files\system\ado\msado15.dll" \
no_namespace \
rename( "EOF", "adoEOF" )
void test()
{
_RecordsetPtr pRst = NULL;
try
{
throw "a";
pRst->Open(_variant_t(), _variant_t(),adOpenStatic ,
adLockReadOnly, adCmdText);
}
catch (...)
{
}
}
int main(int argc, char* argv[])
{
test();
return 0;
}
My question is 1) Has anyone seen this problem? 2) am I doing something wrong?
|
|
|
|
|
Anybody know how to process an image same as Microsoft Word. Please help me
Ngo Khai Hoa
|
|
|
|
|
Do you mean how to access the specific COM object that handles the drawing, or how to write a vector based drawing package ?
Christian
Secrets of a happy marriage #27:
Never go to bed if you are mad at each other. It's more fun to stay up and fight.
|
|
|
|
|
Yes, write a vector based drawing package.
My mean that we can compile between Bightness and Contrast each other.
I have a class called CDib, I can get DibBits and I process an Image (Contrast, Brightness) on that DibBits separately. I don't know how to compile between Bightness and Contrast to get a perfect result looks like what Word processes.
Tran Hoang Chuong
|
|
|
|
|
Ah - so you don't want the vector based stuff, you want Brightness/Contrast ? Probably you need to look at your brightness/contrast algorithms, and typically apply brightness before contrast.
There is also a COM interface for image processing, I've never used it, but I'm sure it would do brightness/contrast the same as Word does.
Christian
Secrets of a happy marriage #27:
Never go to bed if you are mad at each other. It's more fun to stay up and fight.
|
|
|
|
|
I am looking for information on using a USB port as a substitute for the RS232 comm port. Do Win98 and Win2000 already support that or will a device driver have to written? If so where is a good place to get info?
Happy programming!!
|
|
|
|
|
I've never programmed for NT/2000 before, and I kinda don't have an NT/2000 box at my immediate disposal. Can someone tell me if FindWindow works the same on both 98 and NT/2000? My app is giving me grief when i try to run on win2k.
Thanx,
Stephen Caldwell
|
|
|
|