|
Thank you Tomasz, I found the 1998 Q&A article. It is very helpful. Too bad the grayout feature is not implemented. I think what I'm gonna do is just have a pop-up window notifying the user noting the tab features are not activated and do a YES/NO/CANCEL to ask if he/she would like to activate it at this time.
sigh, so much for wanting to make the program nice and neat
Thanks Tomasz, thanks Carlos and Mike!
Jerry
|
|
|
|
|
Too bad the grayout feature is not implemented.
"Not implemented?" What do you mean? The article presents the code that grays out and disables the tabs.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
And why don't remove the page?
I don't Know if you can to prohibit the click in any tab. Try disabling the Dialog, that is part of the PropertySheet.
Best Regards!!!
Carlos Antollini.
|
|
|
|
|
It is not desirable to remove the page. I would like to let the user know that the features exists, but are only activated when the user checks a checkbox. I do not want the user to fiddle with the features inside the tab while having the checkbox unchecked and wondering why no action is happening.
What is the function call to disable the dialog? I tried ShowWindow(FALSE) w/o success.
|
|
|
|
|
The command is EnableWindow();
Cheers!!!
Did you try with the article that said Tomasz???
Carlos Antollini.
|
|
|
|
|
Unfortunately VC++ doesn't like EnableWindow(FALSE) either. I just tried it in my CPropertySheet::OnInitDialog() and it gave me an run time assertion error. Apparently it is not a window and stops at
<br />
BOOL CWnd::EnableWindow(BOOL bEnable)<br />
{<br />
ASSERT(::IsWindow(m_hWnd));<br />
...<br />
}<br />
where this == 0x01251ca0
and m_hWnd == 0x0
I will look into the article Tomasz mentioned.
|
|
|
|
|
Try it before or after OnInitDialog. It's not a window because at this point it hasn't been fully created yet.
|
|
|
|
|
I'm not sure if you can do it with EnableWindow or not. You can use RemovePage and AddPage but that probably isn't what you want.
I hadn't thought about it but now I'm trying to find an example of a disabled property page.
|
|
|
|
|
I'm attempting to set my XML document's encoding at the start of the file with SAX's IMXWriter interface.
I'm using
pWriter->put_encoding(CComBSTR("UTF-8"));
pWriter->put_standalone(VARIANT_TRUE);
where pWriter is a CComPtr with interface IMXWriter.
The put_standalone command works, but the put_encoding is ignored and stays at UTF-16. What's wrong? I'm getting an HRESULT of 0 from both commands, so apparently no problems there.
CodeGuy
The WTL newsgroup: 910 members and growing ... http://groups.yahoo.com/group/wtl
|
|
|
|
|
how to convert parameter 2 from 'struct HWND__ *' to 'struct HWND__ ** '?
|
|
|
|
|
¶m2
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
I have noticed that many people use (rand() % X) to get an integer between 0 and X. I suspected that this actually would return some numbers more often than others. I ran some checks and I found out it worked as I suspected. For example...
const largeNumber = 10000000;
int count[30000];
for (int i = 0; i < RAND_MAX; i++)
{
count[i] = 0;
}
int number = 0;
for (i = 0; i < largeNumber; i++)
{
number = rand() % 30000;
count[number]++;
}
float avgLow = float(count[0]);
for (i = 1; i < RAND_MAX - 30000; i++)
{
avgLow = (avgLow + count[i]) / 2;
}
float avgHigh = float(count[++i]);
for (i++; i < 30000; i++)
{
avgHigh = (avgHigh + count[i]) / 2;
}
cout << "Avg: 0 - 2767: " << avgLow << endl;
cout << "Avg: 2768 - 30000: " << avgHigh << endl;
As you can see, all the numbers under (RAND_MAX - 30000) has been returned twice as often by (rand() % 30000). I wonder if there is a better (and fast) way go get a random integer between 0 and X?
|
|
|
|
|
Mersenne Twister
http://www.math.keio.ac.jp/~matumoto/emt.html
CodeGuy
The WTL newsgroup: 910 members and growing ... http://groups.yahoo.com/group/wtl
|
|
|
|
|
I am cross posting this because the need is urgent.
The code below, takes a parameterized object name, looks for a specific interface
and trys to call its methods.
It finds the interface with no difficulty but gets the error 0x8007806ba
(The RPC server is unavailable. ).
The same calls work from a VB test script. I'm running this on a Windows 2k server
with SP 2. I've checked all the security parameters (DCOMCNFG) all are set to
default, the same as for the other objects that work fine...
This code used to work, I've modified the object, transfered it to a new program
and now it fails. I did change the name of the interface (I seperated the methods
out from another interface). So I tried the old object, everything works fine. (difference shown as commente line (//OLD.)
It would appear there is something wrong with my new object. I would think the
problem must be in the new object, except that I wrote a VB test app, and it works fine. This makes me think the problem is NOT in the object.
Please Help!!
I'd include the code for the object, but its large, and I'm not sure which parts would be useful...
Thanks, Bill
*******************************************************************************************
This VB code works fine
Dim apminfo As New APMOBJECTLib.MessageInfo
Private Sub Command1_Click()
Dim t As String
t = apminfo.GetFunction("sfddsfsdlfksdflk")
End Sub
*****************************************************************************************
This code locates and connects to the interface (MessageInfo). Every thing here succeeds...
CErrorInfo CServiceMessage::UnpackMessage(VARIANT vBody)
{
CErrorInfo err;
CoInitialize(NULL);
VARIANT vResult;
_bstr_t bstrValue;
m_strBody = GetMessageAsString(vBody);
try
{
// Get Function handler object
CLSID ID;
m_pBroker=NULL;
//OLD CString strObjName = "APMObj.CFunction"; // This works fine when activated
CString strObjName = "APMObject.MessageInfo"; // New object.
// The following line of code succeeds
HRESULT hr = CLSIDFromProgID( strObjName.AllocSysString(), &ID);
if (hr != S_OK)
{
LPTSTR lpMsgBuf;
CString strError;
if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, hr,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf, 0, NULL ) == 0 ) // Couldn't find error code
{
lpMsgBuf = "Unknown Error";
}
strError.Format("%s: %s %s Error %d: %s.","CConfigServices::Load()",
"Attempting to find object ", m_pParent->m_strObjectName,
hr, lpMsgBuf);
err.SetError(ERR_SEVERITY_MAJOR, CONFIGERROR + CString(strError));
LocalFree(lpMsgBuf);
return err;
}
hr = CoCreateInstance(ID, NULL, CLSCTX_LOCAL_SERVER,
IID_IDispatch, (void **)&(m_pBroker));
if (hr != S_OK)
{
// error handling
}
vResult = GetValue(vBody,CString("GetPriority"),VT_I4);
*******************************************************************************
This code fails
VARIANT CServiceMessage::GetValue(VARIANT vBody, CString strField, int iType)
{
DISPID dispID;
HRESULT hr;
CErrorInfo err;
LPOLESTR olestr;
VARIANT vResult;
try
{
// Unpack function name
olestr = strField.AllocSysString();
TRACEX("Get ID of " + strField);
// the following line of code fails if the new object and interface is used. It works if
// the old object name and interface is used.
hr = m_pBroker->GetIDsOfNames(IID_NULL, &olestr, 1, LOCALE_USER_DEFAULT,
&dispID);
if (hr != S_OK)
// hr is = 0x800706ba (RPC Server Not Found)
Thanks for the help,
Bill
|
|
|
|
|
Is there any way to create Controls or declare variables in MFC?
for exapmle:
int i;
i = rand() % 10;
Static[i].ShowWindow(SW_HIDE);
please help! or is there any other way to do what I want?
|
|
|
|
|
Yes you can create a array of Control, and create the control using the Create Function.
Cheers
Carlos Antollini.
|
|
|
|
|
Can you give me a little example how to do that?
|
|
|
|
|
The Sample
CButton* pbtn = new CButton[2];
RECT rc = {0, 0, 100, 40};
pbtn[0].Create("Button 1", WS_VISIBLE | WS_CHILD, rc, this, 100);
rc.top += rc.bottom;
rc.bottom += rc.bottom;
pbtn[1].Create("Button 2", WS_VISIBLE | WS_CHILD, rc, this, 101);
Cheers!!!
Carlos Antollini.
|
|
|
|
|
CStatic * pStatic = new CStatic[10];
You could also create pointers and push them into a vector.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I am working with V C++ Help Workshop. I've created the .rtf file (several times) and recompiled (several times), deleted the .hlp file and recompiled (several times), and I still see pages/topics that are NOT in the .rtf file. Almost as though Help Workshop is not recompiling.
All help appreciated
Richard
|
|
|
|
|
Hi,
The Operating System is Window 2000 and I have support for Arabic and English. Now I want to write an application in VC++ whose interface is in arabic.
eg I want that in "Edit Box" the value should displayed
in Arabic format.
and the Caption of buttons is in arabic too.
I am new commer in this "multi-language" development so if some-one knows any thing in this regards. Kindly response me.
Have a nice wishes for my helper.
|
|
|
|
|
I have a lot of experience in Cyrillics Idioms.
I worked in Hebrew and Arabic, and in English, Spanish, Portugesse, Russian, France, etc.
What do you Need?
Cheers!!!
Carlos Antollini.
|
|
|
|
|
Which variable is for the Parent-Window in MFC? (CWnd)
Here is the problem: Parameter 5
Test.Create("Static","Test",WS_VISIBLE | WS_CHILD, rect, Parent, IDC_X, NULL);
or how can I create a Control manually in MFC?
|
|
|
|
|
try
m_hWnd
or
GetParent()
|
|
|
|
|
m_hWnd does not work...
and GetParent causes an Error
|
|
|
|