|
Daniel Turini wrote:
And why transfering a XML over a socket should be different from tranfering a "Hello, World" ?
good point
|
|
|
|
|
Hi folks,
I hope this is an appropriate place to pose this question as I'm looking for a C++ (maybe COM if needed) solution.
The situation is that I have a system running with a mirror disk set under Win2k Server. The server does not have a keyboard, mouse or monitor. It is not usually accessed remotely except via a web server. A dynamically generated page from the web server can tell be of problems with the system if I know the problem is there to add information about the fault.
I want to be able to detect when a mirror disk set is not working.
From what I understand, if there is an error while the OS is running related to the fault tollerance system then an event will be added to the system event log. This I can access using OpenEventLog(), etc. No problems there.
If the system fails while the OS is not running (i.e. the ribbon or power cable drops out of a drive while the hardware is being moved) then no event log entry is raised to show this when the OS starts up. This is a problem.
I've done some tests with a keybaord/monitor connected to the system and see that when the mirror set fails when the power is off the OS (or at least the administrators Disk Management utility) knows that the mirror set has failed because it shows the status of the volume and the status of the partitions making up the mirror set as being "Failed Redundancy".
So bottom line. My question really is how can I determine that the status of a mirror set programatically? I want to know if the status is "OK", "Failed Redundancy", "Regenerating", etc.
Again, I'm sorry is this is the wrong board. I considered putting it on the OS/Admin one but thought it too programing related for that.
---
Lee
|
|
|
|
|
I've found that Win2k Service Pack 2 helps me alittle. It now raises an event at startup when the mirror set has failed while the machine is powered down.
I'd still like to know how to access the state of the mirror set via some means other than the event log entries as there are no entries to show the set has been recovered.
---
Lee
|
|
|
|
|
Why can't I use static member variables inside member functions even using the scope resolution operator...???
I have the following and it won't work and i'm confused as to why not:
class myClass{
void MyFunc(){ myClass::m_myStatic = NULL; }
UINT m_myStatic;
};
UINT myClass::m_myStatic = NULL;
The above does work...but I get an unresolved external error when I try the extact same thing inside a member function...
Why can't I use static members inside non-static member functions...? I thought this is what the scope operator was for...???
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
1.) Add the static word to your static member!
static UINT m_myStatic;
2.) You don't need to write myClass::m_myStatic in your member function, just write m_myStatic .
void MyFunc(){ m_myStatic = NULL; }
class myClass
{
void MyFunc(){ m_myStatic = NULL; }
static UINT m_myStatic;
};
UINT myClass::m_myStatic = NULL;
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Sorry that was a typo I had the static keyword there I just missed while typing...
Anyways, I still get the unresolved error:
class myClass{
public:
static WNDPROC m_wndProc;
protected:
void SubclassMyWindow();
};
void myClass::SubclassMyWindow()
{
m_wndProc = NULL;
}
Even if I use the scope operator...whats going on...?
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
You don't have to clarify your variable with the scope operator because you're already inside your class scope:
class myClass
{
static UINT m_myStatic;
void MyFunc(void) { m_myStatic = NULL; }
};
You have to declare the member variable as static in your class definition before it's really static.
The implementation file is correct to initialze m_myStatic at runtime, but NULL is usually used for pointers, not integers, did you mean to use 0 (zero) instead?
-- ian
http://www.ian-space.com/
|
|
|
|
|
I think the problem is that you have to initialize your static variables like you have shown:
<br />
UINT myClass::m_myStatic = NULL;<br />
You can also assign them in member functions with no problems. You don't even need to scope it. But they have to be declared like the above, or else the compiler whines.
Does that make sense?
Even a broken clock is right twice a day.
|
|
|
|
|
Hi Navin thanks for the reply...
I got it working, thanx again!!!
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
1.
Please tell me what’s wrong with my program?
// IDD_DIALOG1 is ID OF Dialog
GetDlgItem(IDD_DIALOG1)->SetWindowText(_T(“The Dialog Caption”);
…..
2.
How can I get the dialog windows pointer?
|
|
|
|
|
Charlady wrote:
GetDlgItem(IDD_DIALOG1)->SetWindowText(_T(“The Dialog Caption”);
Forgive me it this turns out to be wrong as I am just hashing my through dialogs as of late but
Charlady wrote:
GetDlgItem(IDD_DIALOG1)->SetWindowText(_T(“The Dialog Caption”);
return the HANDLE in question. If you wanted it as a pointer I should think you would have no prolem assigned the HANDLE to a pointer. I do hope this helps, as I said... I'm just getting around to learning the nitty gritties of dialogs myself.
-Mel
---------------------------------------------
The greenest grass is NOT on the other side of the fence, its the grass you take care of. Have you watered your lawn lately?
|
|
|
|
|
Are you trying to do this within a method the dialog itself? If so, all you have to do is:
SetWindowText(_T("The Dialog Caption"));
If you're trying to do this from somewhere else in your UI, say, modifying a modeless dialog, you've probably got a pointer to the dialog instance, so just call the method on the pointer:
m_pMyDialog->SetWindowText(_T("New Caption"));
Or, if you own it as a class member and not a pointer, use the . (dot) member accessor instead of the pointer one ( -> ).
GetDlgItem() is used to get child item windows of the dialog.
-- ian
http://www.ian-space.com/
|
|
|
|
|
|
GetDlgItem() function uses to get the handle of the controls lying on a dialog. So in this way it can't be used.
You can get the dialog handle by the m_hWnd member variable of the dialog. In the following way
" this->m_hWwn"
C.R.Naik
|
|
|
|
|
Any suggestion for a better piece of code to move the focus to the next control in a dialog box? I am not using rich edits, and I tried some other things without the desired results. Somehow though, I suspect this is not the best way to go about it:
[Edit] I have this edit restricted to six characters but when I try to use the DDV max chars value to contol I get what appears an indexing problem as it moves the focus on the 7th char but that char isn't placed into the next edit which hampers continuity of the user's typing.
<br />
void CRHTC100Dlg::OnChangeId()
{<br />
CString str;<br />
GetDlgItemText(IDC_ID,str);<br />
if ( str.GetLength() == 6)<br />
NextDlgCtrl(); <br />
}
This just seems cumbersome to me and I'm just hoping to find some input that saves me from spending to much time researching as it does work this way.
-Mel
---------------------------------------------
The greenest grass is NOT on the other side of the fence, its the grass you take care of. Have you watered your lawn lately?
|
|
|
|
|
What the heck am I doing wrong...?
The control isn't drawing properly when I use the following:
BOOL CEditorDlg::OnInitDialog()
{
CDialog::OnInitDialog();
SetIcon(m_hIcon, TRUE);
SetIcon(m_hIcon, FALSE);
CFont myFont;
myFont.CreateFont(14, 0, 0, 0, FW_NORMAL,
0, 0, 0, ANSI_CHARSET,
OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY,
DEFAULT_PITCH | FF_DONTCARE,
"Courier New");
CEdit* pControl = (CEdit*)GetDlgItem(IDC_EDIT1);
ASSERT(pControl);
pControl->SetFont(&myFont);
return TRUE;
}
Can you even change a CEdit's font....? Or are you suppose to even...? I need a fixed width font...
I know this is possible cuz notepad lets you do this...and they use the same friggen class...what am I doing wrong...?
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
You have to make the CFont object myFont global.
Remove the declaration of myFont in the OnInitDialog function and add it to the dialog header file. The first lines in your dialog header file should read:
class CEditorDlg : public CDialog
{
public:
CEditorDlg(CWnd* pParent = NULL);
CFont myFont;
Try it, it works
-Dominik
|
|
|
|
|
Thanx for the reply...
I figured this out shortly after my post, however i'm not entirely certain why it has to be this way...
I'm assuming it has to do with each time WM_PAINT is called and it refers to some DC object like a font and crashes when the object is destroyed by being locally scoped...??
However this doesn't make sense either cuz I thought all objects were cached inside the DC as one big structure...?
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hi, I'm building an ATL component, and using CodeSleuth, its reporting memory leaks for the following construct.
CProcess
{
bstrEXEPath = SysAllocString(NULL);
}
~CProcess
{
SysFreeString(bstrEXEPath);
}
STDMETHODIMP CProcess::get_EXEPath(BSTR *pVal)
{
CComBSTR tmp = bstrEXEPath;
*pVal = tmp.Detach();
return S_OK;
}
STDMETHODIMP CProcess::put_EXEPath(BSTR newVal)
{
SysFreeString(bstrEXEPath);
bstrEXEPath = newVal;
//SysAllocString(newVal);
return S_OK;
}
WHat is the proper approach I should be using
|
|
|
|
|
If you don't need to even bother with SysAlloc/FreeString . I'm a big fan of STL, so...
#include <string>
using namespace std;
typedef basic_string<TCHAR> tstring;
class CProcess
{
private:
tstring m_strEXEPath;
public:
LPCTSTR path(void) { return m_strEXEPath.c_str(); }
};
STDMETHODIMP CProcess::put_EXEPath(BSTR newVal)
{
USES_CONVERSION;
<br>
m_strEXEPath = BSTR2T(newVal);
<br>
return S_OK;
}
STDMETHODIMP CProcess::get_EXEPath(BSTR* pVal)
{
if (NULL == pVal) return E_POINTER;
*pVal = CComBSTR(m_strEXEPath.c_str()).Detach();
return S_OK;
}
Hope that helps.
-- ian
http://www.ian-space.com/
|
|
|
|
|
Thanks again to those of you who offered thier help with my first image post. Had I not been so tired I would of understood the responses quicker (no worries though, slept on it and was no problem this morning).
I am wondering if anyone knows if there is a way to use the logo that I currently have displayed as an image in the upper right coner of the dialog as a water mark covering the entire dialog area? By that, I was thinking it would look better if all the controls where on top of the company's logo. Basically, can I set the background to an image? Sorry if this sounds like a silly question but the few websites I've helped out with have all used water marks and I think they look a little better and I thought asking here could save me a fair amount of time with my nose poking into the books.
-Mel
---------------------------------------------
The greenest grass is NOT on the other side of the fence, its the grass you take care of. Have you watered your lawn lately?
|
|
|
|
|
If I understand you correctly, you could simply create a static control with the bitmap that spreads across the entire dialog, then place your user controls on top of that. You will just need to make sure that the Z-order is in an order that will make your bitmap on the bottom of all of the controls.
You other solution is to load a bitmap into memory, and override the WM_ERASEBKGND message for the dialog. Instead of painting the normal window color, you would blt your bitmap to the background of the dialog.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Okay, I'll be toying around with that tomorrow (in about 8 hours that is) so I'll drop a line if I get stuck (if you don't mind).
-Mel
---------------------------------------------
The greenest grass is NOT on the other side of the fence, its the grass you take care of. Have you watered your lawn lately?
|
|
|
|
|
I recently converted to MFC from Win32 programming. I need help. In Win32, you load a text file by getting a handle for it, getting it's size, and loading it's text into a text buffer. It doesn't work in MFC, and I would like to avoid CDocument. I am simply trying to keep preferences and other application startup data in text files. Windows says the program wants several Gigabytes of RAM. What is that? It's really strange. Is there a way to avoid CDocument?
-- Steve
|
|
|
|
|
SteveBob wrote:
Is there a way to avoid CDocument?
Sure. Just avoid MFC's Document/View stuff. Or maybe you'd rather use it but implement your own serialization routines (fopen() / fclose() still works BTW...). Or, you could figure out what you're doing wrong (several GB?!?) and fix it... Feel free to post a concise overview of what you're doing when loading / saving, we'll help you out...
Shog9
------
So they took me down to the gallows
And this boy, he said to me:
"Why do you smile, when the rope's around your neck?"
I said, "I tell you boy, when i get back..."
|
|
|
|