|
Did you mean setting the Class property of the custom control to IDD_VCR (where IDD_VCR is the id of the dialog I want to embed)?
I tried that and whenever I call DoModal on the dialog (the dialog I added the custom control to) it returns instantly, before it reaches InitDialog().
|
|
|
|
|
no, the class should be the constant for all dialog boxes... "#32770" that is the exact value... the only problem is that i dont know how to associate a CDialog with the custom control
- Roman -
|
|
|
|
|
I can't do that, coz I also want to use the dialog as a standard dialog.
I need two types of dialog derived from the same resource, one a regular dialog, one a child
|
|
|
|
|
see http://www.codeproject.com/property/saprefs.asp for a working example of embedding one dialog in another.
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
I think that SAPrefs works by using 'sub dialogs' which are declared as type Child. The problem is that I can't set the resource as a child, because I also need a dialog that works as a regular dialog, based on the same resource.
I need a way to programmatically set the dialog as a child or popup and CWnd::ModifyStyle() doesn't seem to work
|
|
|
|
|
are you sure you are removing the proper styles from the dialog when you are using modifystyle to add the child style. You have to remove the options that make it a popup window that contain the title bar and such.
Joseph Dempsey
jdempsey@cox.rr.com
Joseph.Dempsey@thermobio.com
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."
--anonymous
|
|
|
|
|
I've just been playing around with that.
I modified the resource so that it worked great as an embedded control, and noted what GetStyle() returned. I then restored it to how it was originally.
Then I did the following. It is strange:
...
...
DWORD style = m_pVCR->GetStyle();
TRACE( "DEmbeddedVCR PRE style = %x\n", style );
m_pVCR->ModifyStyle( 0xffffffff, 0x40000844 );
style = m_pVCR->GetStyle();
TRACE( "DEmbeddedVCR POST style = %x\n", style );
...
...
note that the ModifyStyle call doesn't work.
I'm not sure what's going on here...
|
|
|
|
|
looks like it works to me - you've cleared everything and set x40000844
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
yeah, but subsequent calls to GetStyle() return 44000844
|
|
|
|
|
maybe i'm misunderstanding.. but... they should.
ModifyStyle(0xffffffff, X) will set the style bits to "X"
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
I'm calling ModifyStyle(0xffffffff, 0x40000844)
and subsequent GetStyle calls return 0x44000844.
Note that the 2nd 0 is now a 4.
|
|
|
|
|
ah.
any idea what the extra '4' represents?
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
WS_CLIPSIBLINGS (WINUSER.h)
A strange style to be misbehaving
I have a feeling that this bug-hunt is academic now anyway, as I modified the resource to have ClipSiblings set, and it still does not work.
So even if I could get that ModifyStyle() call to do the job, it would not solve my problem.
Intriguing though....
Thanks,
Pete
|
|
|
|
|
So, for those who are interested, here is how I did it (finally):
ModifyStyle() can't be used, possibly because of the way dialogs are loaded from resources.
But it is possible to programmatically modify the resource, as follows:
CString strIDD;
strIDD.Format( "#%u", IDD_VCR );
DLGTEMPLATEEX* pDlgTemplate = (DLGTEMPLATEEX*)::LockResource( ::LoadResource( NULL, ::FindResource( NULL, strIDD, RT_DIALOG ) ) );
pDlgTemplate->Style = 0x40000844;
m_pVCR = new DEmbeddedVCR();
m_pVCR->CreateIndirect( pDlgTemplate, this );
This should all really be put in DEmbeddedVCR::Create(), rather than called 'client-side' as it were.
Hope that helps out someone at some point...
Pete
|
|
|
|
|
I am doing a simple select distince:
if(pAdoDb.Open((LPCTSTR)strConnection))
{
CString strCommandText;
CString strQry = _T("");
int numRecords;
strQry.Format(_T("SELECT DISTINCT (Color) From tblTest"));
CADOCommand pCommand(&pAdoDb, strCommandText = _T(""),CADOCommand::typeCmdText);
pCommand.SetText(strQry);
CADORecordset pRs(&pAdoDb);
if(!pRs.Execute(&pCommand))
AfxMessageBox("failed");
This snippet worked with "select * from tblTest".
With the distinct command above I am getting a runtime error:
CADORecordSet error
code = 80040e10
code meaning = IDispatch error #3088
Source = Microsoft JET database engine
Description = No value given for one or more required parameters
What am I doing wrong? Please help!
Thanks,
ns
|
|
|
|
|
Are the parentheses around "Color" extraneous?
(Caveat: I know nothing about SQL.)
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
The parentheses dont seem to matter. I just realized this is not the forum for this stuff, but the ADO forum is really dead....d'you think I can post here or is that not nice?
|
|
|
|
|
ns wrote:
The parentheses dont seem to matter.
Ugh, sorry. I got that from Google.
It's probably better to post in the ADO forum, but I think the lack of replies isn't due to the forum location, rather that most readers may not know the answer. I wish I could help, but I'm database clueless.
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I am not so sure about ADO but right off the bat, the number of columns you are returning has changed. Have you bound columns?
|
|
|
|
|
Firstly, I think the parentheses are not really needed. Secondly, make sure you're using the right combination of uppercase and lowercase letters.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I blush to mention this but I had two copies of the database and I had added columns to one, which I was querying on, but I hadnt pointed my connection to the right version... Anyways I found out what SQL does when it doesnt find a column with the name you specify. Ulp!
|
|
|
|
|
Hi,
I have two interfaces, say IOne and ITwo:
__interface IOne;
__interface ITwo;
[
attribute stuff
]
__interface IOne
{
HRESULT Two(ITwo *pTwo);
};
[
more stuff
]
__interface ITwo
{
HRESULT One(IOne *pOne);
};
The C++ code compiles, but the MIDL fails saying the ITwo parameter in the IOne interface is unresolved. I have tried alsorts of attributes and hacks to get it working and it has me stumped. I have looked through MSDN and found nothing.
Any ideas?
Thanks.
|
|
|
|
|
The code seems just fine. I'm almost sure this won't remedy the problem, but please try replacing __interface with interface . Also, the forward declaration of IOne is not needed, maybe you can try deleting it to rule out the (remote) possibility that the compiler is getting confused by it.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
The IOne/ITwo were just a simplification, it's an object model for an offline physics simulator so there's quite MIDL forward declarations to worry about.
changine __interface to interface causes the code to not compile at all. I have changed the forward declarations to everything I can think of. I have even tried dumping a list of my objects in a separate .IDL file and inserting/including it using an embedded IDL statement. Nothing's working.
I would have thought that Microsoft, with 7.0's attributes, which are designed for simpler and speedier COM/ATL/.net programming, wouldn't require forward declaration when it gets to the post-C++ compilation stage.
|
|
|
|
|
I have an ATL DialogBox class with a ListView Control. I'd like to set the sizes of the columns dynamically. However, when I try to pass the width, I get an "Invalid Property Value" error:
CComPtr<MSCOMCTL::IListView> piAnsList;
HRESULT hr = GetDlgControl(IDC_ANSWERS,__uuidof(MSCOMCTL::IListView),
reinterpret_cast<void**>(&piAnsList));
CComQIPtr<MSCOMCTL::IColumnHeaders> piColHdrs;
CComQIPtr<MSCOMCTL::IColumnHeader> piNewHdr;
piColHdrs = piAnsList->ColumnHeaders;
_variant_t vColKey(L"ColOne");
_variant_t vColName(L"First");
_variant_t vWidth((double)100.0);
_variant_t vAlign((long)MSCOMCTL::lvwColumnLeft);
piNewHdr = piColHdrs->Add(&vtMissing, &vColKey, &vColName,
&vWidth, &vAlign);
If I replace vWidth with vtMissing, everything is fine, so it must be the width. I got a similar error using the IColumnHeader->PutWidth method. Any suggestions greatly appreciated. Thanks.
Russ Rogers
GraniteLeaf Systems
|
|
|
|