|
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
|
|
|
|
|
Chris Losinger wrote:
(otherwise, there's little point in having a way to set anything, cause you can't),
So if the dlg is modal (which it is) I can't do it? I'm trying to set the focus of the Edit control in OnInitDialog .
In the main form I have:
int nResponse = dlg.DoModal();
Then in OnInitDialog of dlg I read from the registry and depending on what I find there want to set focus to m_E.
Thanks for your help!
|
|
|
|
|
ok. i misunderstood. i thought you were trying to set this from outside the dialog class.
but if you're doing this from the OnInitDialog of the dialog itself, then yeah, just do m_E.SetFocus() (and then return FALSE from OnInitDialog).
-c
"Should you not have a ramekin of sea salt beside the stove, you don’t deserve oatmeal."
Dean Allen
|
|
|
|
|
Thanks. It was the returning FALSE that did it. Nice catch w/o even look at my code!
|
|
|
|
|
Where did it go in VC.NET. Damn, I can't find it.
I would like to catch a home made message, and I used to use PretranslateMessage to do that.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Never mind, i found it. God, do i miss the class wizard!
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Hello again,
Can anybody help me add Rebar to a CDialog. The SDK dlgbars and MSCIE samples, which many people quote on newsgroups as solutions, aren't enough.
The toolbar, which the Rebar is to contain, must inherit from a user-defined class based on CToolBar in order for for UpdateUI handlers to work, as shown in the dlgbars sample. However, when I try to add the new Toolbar to the Rebar, the icons are disabled.
Thanks.
john
|
|
|
|
|
Hello,
I have a MDI app that you can dock and float the tool bars.. is there a way that i can remove the little "x" from the top right corner when the tool bar is floating.. I dont want anyone to beable to close the toobar.
Thanks
|
|
|
|