|
Can anyone tell me how to enable/disable the ok button on a property sheet? I want to have the button disabled until the user enter all the required information, then enable it.
-ken
Ken Goguen
|
|
|
|
|
You can get hold of a CWnd * to the OK button with GetDlgItem(IDOK) (if inside a method of the property sheet) or GetParent()->GetDlgItem(IDOK) (from a method of a child property page). Then you can call CWnd::EnableWindow for that pointer.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
I have an automation interface which own a UDT array. The UDT is define as
struct NoteDesc {
float base;
float pitch;
float medium;
};
In my interface, I have set the get and put properties. put works really great but after I return from get, I have memory crash in the kernel.
Here my interface def:
[
object,
uuid(60C22F90-D3BB-4BA0-ABCC-837E4CA2AEF2),
dual,
helpstring("IScoreDesc Interface"),
pointer_default(unique)
]
interface IScoreDesc : IDispatch
{
[propget, id(1)] HRESULT NumberOfNote([out, retval] long *pVal);
[propput, id(1)] HRESULT NumberOfNote([in] long newVal);
[propget, id(2)] HRESULT Notes([out, retval] SAFEARRAY(NoteDesc) *pVal);
[propput, id(2)] HRESULT Notes([in] SAFEARRAY(NoteDesc) newVal);
};
and the class compil well, the call to get is effective. The problem occur when I return of the function get define like that in my h file:
STDMETHOD(get_Notes)(SAFEARRAY* *pVal);
Do you have any idea?
|
|
|
|
|
It'd be most helpful if you could post the actual implementation of your get_Notes function. Anything else seems to be OK.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
The source code of my function: (my comment are in french, don't take care of them)
STDMETHODIMP CScoreDesc::get_Notes(SAFEARRAY **pVal)
{
// Remplis une structure d'information pour pouvoir créer le tableau
IRecordInfo* pRecordInfo = NULL;
HRESULT hr = GetRecordInfoFromGuids(LIBID_MUSICSEARCHSYSTEM, 1, 0, GetUserDefaultLCID(), IID_NodeDesc, &pRecordInfo);
// Détruit le tableau si il existait déjà
if (*pVal != NULL)
{
SafeArrayDestroy(*pVal);
*pVal = NULL;
}
// Crée un tableau pour le transport
*pVal = SafeArrayCreateVectorEx(VT_RECORD, 0, m_NumberOfNote, pRecordInfo);
pRecordInfo->Release();
if (*pVal == NULL)
{
hr = Error(_T("Cannot create the Notes decription array"));
return hr;
}
// Rempli le tableau avec le contenu du tableau interne
NoteDesc* pNoteArray;
hr = SafeArrayAccessData(*pVal, (void**) &pNoteArray);
if FAILED(hr) return hr;
memcpy(pNoteArray, m_Notes, sizeof(NoteDesc)*m_NumberOfNote);
SafeArrayUnaccessData(*pVal);
return S_OK;
}
The IID_NoteDesc is defined at the top of this cpp file.
I have try to follow an article I found on this site write by Ioannis Stamatopoulos.
Thanks,
Bruno
|
|
|
|
|
The only thing I can guess about your code is that maybe sizeof(NoteDesc) is not equal to the value provided by pRecordInfo->GetSize() due to alignment considerations. Could you check that out?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
The error message:
HEAP[musicserver.exe]: Invalid Address specified to RtlFreeHeap( 130000, 1e0690 )
The size return pRecordInfo->GetSize and sizeof(NoteDesc) are identical (value is 12 - 3 32bits floats)
I don't know where it found to have to destroy this huge part of memory.
My test array contains only 10 elements, that's 120 bytes. Not 722576 if I have understand correctly the trace from the HEAP.
Thanks,
Bruno
|
|
|
|
|
Well, this is wild guessing, but anyway... What client technology are you using? If it's ASP or other VB-based stuff, seems like VBSCRIPT does not handle SAFEARRAY s of objects other than VARIANT s (read MSDN article PRB: Script Error Occurs When Referencing Non-variant Array (Q165967)). Also, if your client is written in C#, I've read several posts on the Usenet about an alleged bug of the .NET platform that shows when dealing with SAFEARRAY s created via SafeArrayCreateVector (Ex ) --this is far from confirmed, though.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Client are currently in C++ (Console test app and ActiveX)
I will give a try with SafeArrayCreateEx instead of SafeArrayCreateVectorEx. Perhaps, they have a bug with that last function.
Many thanks Joaquin for your help,
Thanks,
Bruno
|
|
|
|
|
Sorry I haven't been more helpful. Bonne chance!
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín M López Muñoz wrote:
Sorry I haven't been more helpful. Bonne chance!
Don't be sorry. You have find the solution.
I replace the SafeArrayCreateVectorEx by a SafeArrayCreateEx and it works perfectly.
Gracias y buenas tardes,
Bruno
|
|
|
|
|
!!
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Try to declare the get property like this:
[propget, id(2)] HRESULT Notes([in,out] SAFEARRAY(NoteDesc) *pVal);
Define your UDT like this:
Describing UDT in the IDL file
library ScoreDesc
{
typedef [uuid(C1D3A8C0-A4AA-11D0-819C-00A0C90FFFC3)] struct_NoteDesc{
float base;
float pitch;
float medium
} NoteDesc;
or Take a look Passing UDT at MSDN
- God bless the World
|
|
|
|
|
A general disk exception was detected when open a new file. It is caused by a bad disk sector. How to skip the bad sector so that fileopen and fwrite can be continued?
The software is developed with VC 6.0 on Win2k
Thanks a lot.
|
|
|
|
|
I am not sure how easy that would be to do in code, but I would just suggest running ChkDsk, and letting it map around the bad sector.
Peace!
-=- James.
|
|
|
|
|
Hi There,
I'm developing a dialog based application. As Application starts it shows some data in editbox. I wanted to create one more dialogbox from here which display selected substring in the EditBox from my main dialogbox. An example of this is when you press Ctrl+F in wordpad and you have some selected string in opened document then Find-box display that string as it shown up
Thanks for taking time to write in.
-- Sumit
Please make a CC to me sumit@elitecore.com.
|
|
|
|
|
If it is retrieving the selected text what you're having difficulties with, take a look at CEdit:GetSel .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi,
I´m testing my application in several platforms, I report mode I use Word in a view and with automation I create my reports...
The problem that I have is that I´m trying to use that with XP ( and office 2002), and when I close the word window, then the whole application is closed, do you now if something has been change and makes it not work right with the good old MFC...
Thanks, Bye !
Braulio
|
|
|
|
|
Hello everybody!
I have the object CRectTracker m_tracker in my Modal Dialog and I need set the cursor for him.
But this code not work (cursor is invisible). Why?
BOOL CMyDialog::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
if (pWnd == this && m_tracker.SetCursor(this, nHitTest))
return TRUE;
return CDialog::OnSetCursor(pWnd, nHitTest, message);
}
Best regrads,
Eugene Pustovoyt
Sonork ID 100.10002:Yaumen
|
|
|
|
|
Hi Eugene, maybe your CRectTracker is not being able to load the cursors, as it seems to be the case under some circumstances when you statically link to MFC: try selecting the shared DLL version of MFC --if I'm right then the cursors should now show.
If this is indeed the problem, take a look at MSDN article BUG: BLOCKS32 Sample Fails to Show Cursors when Linked to MFC (Q208856) which describes a program having the same problem and a way to solve it.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Many thanks for the help!
All and was, as you have written.
Has already corrected also all has earned!!!
Best regards,
Eugene Pustovoyt
Sonork ID 100.10002:Yaumen
|
|
|
|
|
Hello all,
I was just wondering about the typical difference in usage between type BOOL and bool. Within the Windows environment, the BOOL is an unsigned integer. When using data-structures you find the bool used iso BOOL, which is put inside a kind of bit-array by the compiler. This is of course logical due memory usage, since the BOOL takes in Win32 4 bytes.
Is there any reason to use the BOOL over the bool type definition?
Thanks in advance,
EiSl
|
|
|
|
|
bool is a C++ keyword (which BOOL is not) and refers to a built-in C++ type (does not exist in C) for boolean values. In the particular MS implementation, bool is 1 byte wide, which could matter if memory efficiency is highly valued. Nevertheless, the main reason to prefer bool over BOOL is type efficiency: you cannot do any funky integer arithmetic with bool s, like adding or multiplying them, which is good. To sum it up, I'd use bool if:- I'm programming in C++ (does not work in C)
- I'm not dealing with a previous piece of code that uses
BOOL s (like the API definitions in <windows.h> ), and use BOOL in the remaining cases.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
another question:
why should i use
if (pointer == NULL)
and not
if (pointer == 0)
is there any difference between those two ?
is this historically?
does NULL has got any advantages?
thanks in advance
bernhard
Sometimes I think the surest sign for intelligent life elsewhere in
the universe is that none of them ever tried to contact us.
|
|
|
|