|
A NT Service may well have a GUI, but this comes with some drawbacks.
Only services running in the "local system" user account can have the priviledge "interact with desktop", which is needed to have a visual GUI.
The "local system" user account is restricted in some access rights, for instance, it isn't allowed to open the client side of named pipes.
Another drawback is that every user who logs on to the machine the service runs on is abled to see and interact with the service's GUI.
This is not feasible for secure operation.
I would recommend using a separate GUI application for interaction with the service. Simple commands could be sent from GUI to service using user-defined codes for the ControlService() function.
Data could be sent using named pipes or shared memory (who'd want to do it that way?!) or sockets.
|
|
|
|
|
Why not creating a service with the ATL wizard and use the COM mechanism to interact between your service and your GUI application ? It's easier to use then named pipes or shared memory. After creating a service with the ATL wizard, you can adapt the CServiceModule::Run to do whatever you like (running code, adding COM objects, ...). There's a book about NT services that covers all of this (even how to optimize ATL created services for performance).
-Nick-
|
|
|
|
|
I am trying to populate a ListBox in a dialog.
My error is in this line:
m_MyDialog.m_ctlMyListBox.AddString("Hello");
I can populate the list box AFTER I open the dialog, but if I try to place anything in the ListBox BEFORE I open the dialog, I get a assertion error. I can, however, set other variables in the dialog prior to opening it.
Where have I failed?
Richard
|
|
|
|
|
CListBox::AddString is just a thin MFC wrapper over Win32 message LB_ADDSTRING. The function will work only if your CListBox variable is properly initialized (mapped to some HWND). The initialization usually occurs in DoDataExchange called from CDialog::OnInitDialog - DDX_Control does this.
You can't initialize CListBox before dialog is created - there's no listbox window to be associated with C++ member variable of type CListBox.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hello, the codegurus around the world.
If you have no idea of that ListBox is acutally created or not,
we can check this by GetSafeHwnd() or GetDlgItem();
if (m_MyDialog.m_ctlMyListBox.GetSafeHwnd())
or
if (m_MyDialog.GetDlgItem(IDC_MYLISTBOX))
These values isn't NULL,
we can add the string to the list box.
Otherwise, we must change the location which the code tries
to add the strings to the listbox.
Have a nice day.
-Masaaki Onishi-
|
|
|
|
|
Populating a list box with it's initial contents is usually done in OnInitDialog(). You could always have a list of items in a collection which the OnInitDialog functions puts in the listbox at runtime if you needed to set your items up before the dialog is created.
> Andrew.
|
|
|
|
|
I'm new in VC++ programming, and i have to create a dlgbox which have a button which have to catch value in a access database. i don't know how to do that, so if someone could help by showing the correct syntax for this application.
thanks
gerald
|
|
|
|
|
do you mean that when they click a button a value must be read from the database and displayed on a dialog control?
if so, open a connection to the database (cdatabase and crecordset) and code the button click handler to read the reqd value from the reqd table (defined in crecordset) ... then display it on the reqd control
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
you see what i mean but could you be more explicit about the implementation, i never do this kind of work before?
|
|
|
|
|
In my propertyPages I need to use member variable of their propertySheet object But it is unidentified .
How can I call this variable ???
|
|
|
|
|
Use code like this in your poperty pages:
(CMyPropSheet*) pSheet = (CMyPropSheet*)GetParent();
Paolo.
|
|
|
|
|
I've been programming for a while now and created a vector drawing app and all, but one thing still bugs me...
I can't figure out what handles are
I mean for example the hWnd and hInstance?! My guess is that they are some kind of pointers?
The documentation of c++ doesn't tell me anything interesting. And I couldn't find anything on the internet. Please help me and tell me what they are for
Thanks,
WAVK
|
|
|
|
|
Handles are used for identifying OS objects (files, device contexts, windows, pens, etc). They may be pointers, array indices, map keys or something entirely else - the point is that the value of the handle is understood only by system. Your app is expected to use the handle via API functions - there's no need to 'interpret' their values other than checking for NULL or INVALID_HANDLE_VALUE.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
the type HANDLE is actually defined as void *
|
|
|
|
|
It doesn't matter. It's just a 32-bit value. On my W2K box calling CreateFile just returned HANDLE == 0x54, which is not a valid pointer, but perfectly valid file handle.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
No wonder I didn't understand them. This must be the most abstract thing of c
WAVK
|
|
|
|
|
Handles are a feature of Windows API, not the C++ language. That's why they aren't mentioned in C/C++ books.
|
|
|
|
|
Hi,
I need to be able to find out whether there is a process called OUTLOOK.EXE running. How do I do this?
Also, once i've found the process, I'll be displaying a message to the user to close it... but i suppose a neater way would be to close it for them. is this possible?
Thanks
|
|
|
|
|
Searching for process is possible, but you need to use different techniques on Win9x/Me and NT/2000. It will be easier to use FindWindow or FindWindowEx to find a window with given class name and/or caption. You can check the class name of the main Outlook window using Spy++.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Look at:
MSDN article "HOWTO: Attach to a Running Instance of an Office Application
Q238975"
|
|
|
|
|
Hi ^o^:
I have a problem:How to convert between LPBYTE and CString??
Thanks for all the help.
|
|
|
|
|
Convert to LPTSTR and then CString
example
LPBYTE lpData;
LPTSTR lpText;
CString szText;
lpText = (LPTSTR)lpData;
szText = lpText;
or
LPBYTE lpData;
CString szText;
szText = (LPTSTR)lpData;
|
|
|
|
|
Thanks.
and How to convert CString to LPBYTE??
|
|
|
|
|
CString strTest;
LPBYTE pBuffer;
pBuffer = (LPBYTE) strTest.LockBuffer();
maXallion "Look for bugs, I hate bugs!" - Warden, The Mummy www.maxallion.de - coded evil & more
|
|
|
|
|
Hi,
Can you help me ?
How can do programm which receive messages when user move with mouse out of window.
LB
|
|
|
|