|
Once you have created the array, it is quite user friendly.
For example, if you are looping through the array, you can use array.GetAt(index) or just use array[index] since the [] is overloaded.
I am finding this to be a great solution for filling a listbox.
Has anyone found a better solution?
|
|
|
|
|
How do I get an apps X and Y size?
|
|
|
|
|
I assume what you want is GetWindowRect()
-Jack
To an optimist the glass is half full.
To a pessimist the glass is half empty.
To a programmer the glass is twice as big as it needs to be.
|
|
|
|
|
How to calculate the download rate when sending file over the the socket!?
Rickard Andersson@Suza Computing
ICQ#: 50302279 (Add me!)
E-mail: nikado@pc.nu
I'm from the winter country SWEDEN!
|
|
|
|
|
Rate is just (data transfered / time)
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
You can use this class to help you compute elapsed and remaining times (the latter only if you know the final size of the data being received/sent).
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I'm trying to run a VB app as a service in windows 2000. Since VB is very limited, this is not really possible. Does anyone know if I could write something in C++ that I could run as a service that would execute a VB app every 5 minutes? Or does anyone have any thoughts on how I could do this???
Thanks alot!
Phil
|
|
|
|
|
If I properly understood your question, you do not have to use service to run VB (or any other) application every 5 minutes.
Instead, you can just use win2k task scheduler.
-Gile
|
|
|
|
|
|
You could make a COM Object in VB, and create a service using C++ that starts the COM Object. I have done that a couple of times...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
I'd second what A.M said. One more similar option for you(instead of creating a full fledged service in C++) is to build a winlogon notification package(that's just what I did. I coded it as a component)and then run your vb.exe file on winlogon events.
Matter of fact this is just what I did to make my VB program work as a service.
|
|
|
|
|
Hi,
I have created a Standard Dialog Application
Added CButton m_button to the class
and have the following OnInitDialog
BOOL CTestChekBoxDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_button.Create("Hello", WS_CHILD|WS_VISIBLE|WS_TABSTOP|BS_AUTOCHECKBOX,
CRect(10,10,100,30), this, 10000);
// m_button.SetFocus();
GotoDlgCtrl(&m_button);
return FALSE; // return TRUE unless you set the focus to a control
}
What I need is to programatically selct the checkbox so that it shows the focus rect around it i.e.
...........
O :Some Text:
...........
You get this effect if you Tab to the control
Thanks in advance
Andy
|
|
|
|
|
Set the tab order so that the control you want to have focus (upon initial display of the dialog) is first.
Regards, Larry Antram
Stardust Software
"I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones."
-- Albert Einstein
|
|
|
|
|
Sorry this does not display the focus rect around the text.
The only way I know how to get this is by Tabbing around the controls.
But I need to set it programatically
Andy
|
|
|
|
|
The problem seems to be Win2000 and a soloution was provided by Jeff Partch [MVP]
Hi, Andy!
May not be relevant, but under what OS are you running? On Win2k and up, the focus rect is hidden by
default until you do things like: 1) Tabbing with the keyboard, 2) Hit the ALT key, or 3) Invoke the
dialog with the keyboard in the first place. The WM_UPDATEUISTATE may explain it better than I do,
but if I add a PostMessage of it to your OnInitDialog...
BOOL CTestChekBoxDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_button.Create(
_T("Hello"),
WS_CHILD|WS_VISIBLE|WS_TABSTOP|BS_AUTOCHECKBOX,
CRect(10,10,100,30),
this,
10000
);
GotoDlgCtrl(&m_button);
PostMessage(
WM_UPDATEUISTATE,
MAKEWPARAM(UIS_CLEAR, UISF_HIDEFOCUS)
);
return FALSE;
}
...it'll circumvent the expected behavior (which may not be a good thing, but that's your call). It
does do for me anyway. To get these 'UISTATE' defines you need to have the latest (or later than
that which ships with VC6) PSDK installed, and 2) You need to have defined (_WIN32_WINNT >= 0x0500)
way early in the build process. Personally, I think this conditional around a Window's message and
its parameter values is an error in judgement. Anyway, both these can be a real pain, so FWIW...
#ifndef WM_UPDATEUISTATE
#define WM_UPDATEUISTATE 0x0128
#endif
#ifndef UISF_HIDEFOCUS
#define UISF_HIDEFOCUS 0x1
#endif
#ifndef UIS_CLEAR
#define UIS_CLEAR 2
#endif
And in the not that you asked department: the way you've posted it, you dynamic creation of the
button looks like the hard way to go about it.
--
Jeff Partch [MVP]
|
|
|
|
|
How do I add items to a combo list generated by the MVC Wizard? The Wizard generates an ID under a DIALOG block in the .rc file. Using CCombo.AddString() works when you instantiates the object, but not, of course, on ID variables. I need somehow to link the ID to a CCombo object and go from there. Any suggestions? Thx.
ralf.riedel@usm.edu
|
|
|
|
|
CComboBox *pBox = (CComboBox *)GetDlgItem(ID);
(be sure to test for NULL...)
-c
"Should you not have a ramekin of sea salt beside the stove, you don’t deserve oatmeal."
Dean Allen
|
|
|
|
|
You need to generate the variable as control with the ClassWizzard...
The you will can use m_cbo.AddString("Your String");
Regards
Carlos Antollini.
www.wanakostudios.com
Sonork ID 100.10529 cantollini
|
|
|
|
|
Thanks for the reply. I did add the variable as control with the ClassWizzard, as you suggested.
Now, however, when I issue the m_cbo.AddString("Your String") command from anywhere within the program, I get an assertion failure (file afxwin2.inl, line 735). Even if I do this: CComboBox c; c.AddString("dd"); it will bomb. Any idea?
ralf.riedel@usm.edu
|
|
|
|
|
You are adding the string before your combo box window (control) is created.
-Jack
To an optimist the glass is half full.
To a pessimist the glass is half empty.
To a programmer the glass is twice as big as it needs to be.
|
|
|
|
|
I am adding it upon construction. But even if I add strings well after construction, the code will bomb. Also, as I mentioned in another message, if I run AddString() on a CListBox object (which has no connection with the dialog), the program will throw an assertion too. Does the Wizard somehow require a special way to initialize CObject derived objects? Thx.
ralf.riedel@usm.edu
|
|
|
|
|
|
It was created with DoModal(). What puzzles me is that I can't even initiate a CListBox object. If I create a CListBox object from anywhere in the program and run CListBox::AddString(), it'll throw an assertion error. Thx.
ralf.riedel@usm.edu
|
|
|
|
|
Hi,
I have two MFC questions (I've looked around but can't find the answers; hoping you guys can help.)
1) I want to set the focus to a certian CEdit control. I'm sure I need to use m_E.SetFocus(?) but how do I get the handle to the dlg that the control is on?
2) I have a dropdown list box that I don't want to let the user type in. Is there a style that I can choose in the dialog editor? setting the "Disable" style grays it out; thats not what i want.
Thanks
|
|
|
|
|
1. assuming your dialog is modeless (otherwise, there's little point in having a way to set anything, cause you can't), you will probably have a pointer to an instance of the dialog somewhere. so, you can do m_dlgPtr->m_E.SetFocus();
2. use a real listbox, not a "drop-list" combo.
-c
"Should you not have a ramekin of sea salt beside the stove, you don’t deserve oatmeal."
Dean Allen
|
|
|
|