|
What I meant was that the lpDesktop would NOT be NULL or EMPTY. It needs to be set to the name or handle of the desktop where the services are run. Any windows started on the desktop of the user are going to recieve all sorts of messages about termination when the user logs off.
It is best, if possible, to write services that have NO USER Interface whatsoever. Interact with them via TCP/IP, local RPC, DCOM, memory mapped files, service control commands, etc. Anything but windows!
|
|
|
|
|
Yes - I understood it correctly.
I was just saying that if you initialize STARTUPINFO.lpDesktop with NULL value desktop will be inherited (that's from MSDN).
So if the process which creates this child process is a service (that is my case), they should be on the same desktop, am I right?
My service has no user interface - it's plain process, which listens for the requests...
Thanks again,
Peter
|
|
|
|
|
I added a code, where I am quering the desktop of the current thread (running service wrapper) and retrieving its name. Then I used the retrieved desktop name for the new child process creation. It did not help. And the desktop name value retrieved in the code was "Default", which is weird I think...
code fragments:
HDESK hDesk = GetThreadDesktop(GetCurrentThreadId());
GetUserObjectInformation(hDesk, UOI_NAME, lpszDesktopName, ...);
...
si.lpDesktop = lpszDesktopName;
...
CreateProcess(..., &si, ...);
Thanks,
Peter
|
|
|
|
|
I am sorry now, I do not know what else to suggest
|
|
|
|
|
I read an interesting article about a logon session broker written by K.Brown published @ MS site:
http://www.microsoft.com/msj/0200/logon/logon.aspx[^]
So I have done one more test and I used
Service-0x0-3e7$\\Default
as a value for DesktopName in STARTUPINFO, but it did not help either. My child process still dies after session log-off.
Thanks,
Peter
|
|
|
|
|
Hi,
I'm having a nightmare with argument passing using OLE automation.
I have created an automation DLL using Visual C++. it's to be used in VB. I want to create a function within this DLL which accepts an array of object as argument. I know how to do that for a single object using the LPDISPATCH argument type but now what if I want an array of this object? I have tried many solutions but none of them worked...
I hope someone will be able to help me!
Jeff
|
|
|
|
|
I wrote a regular MFC dll which should display a dialog-box.
I have a class derived from CDialog to display my dialog.
Now, my exported class is a regular one (NOT MFC) which has a method Open to open the dialog.
(I use a regular class since my client is a console application or none-MFC client)
The problem is that i get assert on AfxGetResourceHandle().
When i added the statement "AFX_MANAGE_STATE(AfxGetStaticModuleState( ));"
i got a link error saying:
"mfcs42d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in RewinderSimulator.obj
mfcs42d.lib(dllmodul.obj) : error LNK2005: __pRawDllMain already defined in RewinderSimulator.obj".
How can i solve my problem?
Thanks,
Dudi
|
|
|
|
|
I would like to clip one region from another. But how to get points array from HRGN????
|
|
|
|
|
Have a look at CRgn::GetRegionData() .
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
I wrote a little COM dll, that placed on one machine, and client programm on another. The machine where com dll is placed - wiht Windows XP, and client program works properly if it on WIndows XP, and doesn't work if it on Windows 2000 Proffessional or Server, i haven't tried it on another OS. What's wrong am i doing? It shows the messagec "Invalid pointer".
|
|
|
|
|
My first guess would be a missing or unregistered DLL that is used by your DLL.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
But how can it be??? I just call the dll from another computer....
As i said on the Windows XP the client programm works, but on another platform doesnt.
As i understand the DCOM - it should make a connection throught the net, and call the methods of my COM. So, may be deal in ports??? which ports used DCOM? - i've never seen that information...
Or maibe i shoud make the instance of My com another way than CoCreateObject???
|
|
|
|
|
open dilaog after 15 years does not work propertly.
Do a simple app. Make it enter MTA.
Pop up a Common Open/Save File Dialog.
On Win2K Hangs When Selecting topmost My Documents Folder.
On Win XP, By selecting my computer the list view is empty.
On both OS-es sometime list of files is chopped (if does not hang meanwhile).
I would apreciate any workaround.
But after 15 years they could not get it right a ... so common open dialog...
|
|
|
|
|
around.:
[code]
class COd : public CFileDialog
{
public:
COd(BOOL bOpenFileDialog,
LPCTSTR lpszDefExt = NULL,
LPCTSTR lpszFileName = NULL,
DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST,
LPCTSTR lpszFilter = NULL,
CWnd* pParentWnd = NULL):CFileDialog(bOpenFileDialog,
lpszDefExt ,
lpszFileName ,
dwFlags ,
lpszFilter ,
0 )
{
}
int DoModal(){
return CFileDialog::DoModal();
}
BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
BOOL ret = CFileDialog::OnNotify(wParam, lParam, pResult);
OFNOTIFY* pNotify = (OFNOTIFY*)lParam;
switch(pNotify->hdr.code)
{
case CDN_TYPECHANGE:
{
CWnd* pWnd = GetActiveWindow();
CWnd* PDlg = pWnd;
if(pWnd)
{
GetFocus()->PostMessage(WM_KEYDOWN,VK_RETURN,0);
GetFocus()->PostMessage(WM_KEYUP,VK_RETURN,0);
}
}
break;
}
return ret;
}
virtual void OnFolderChange()
{
TCHAR cs[128];
CWnd* pWnd = GetActiveWindow();
CWnd* PDlg = pWnd;
CWnd* PSlv = 0;
int relation = GW_CHILD|GW_HWNDFIRST;
while(pWnd = pWnd->GetWindow(relation))
{
GetClassName(pWnd->m_hWnd, cs,128);
if(!strcmp("SHELLDLL_DefView",cs))
{
CWnd* pSave = pWnd;
int relation = GW_CHILD|GW_HWNDFIRST;
while(pWnd = pWnd->GetWindow(relation))
{
GetClassName(pWnd->m_hWnd, cs,128);
if(!strcmp("SysListView32",cs))
{
PSlv = pWnd;
break;
}
relation = GW_HWNDNEXT;
}
pWnd = pSave;
}
relation = GW_HWNDNEXT;
}
}
};
class DlgWrap
{
public:
DlgWrap(BOOL bOpenFileDialog,
LPCTSTR lpszDefExt = NULL,
LPCTSTR lpszFileName = NULL,
DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST,
LPCTSTR lpszFilter = NULL,
CWnd* pParentWnd = NULL)
{
memset(&m_ofn,0,sizeof(m_ofn));
_cfilter = lpszFilter;
_cfilter.Replace('|', '\0');
m_ofn.lStructSize = sizeof(m_ofn);
m_ofn.lpstrDefExt = lpszDefExt;
m_ofn.lpstrFile = (LPTSTR)lpszFileName;
m_ofn.Flags = dwFlags ;//| OFN_EXPLORER;
m_ofn.lpstrFileTitle = "asdfasd";
m_ofn.lpstrFilter = (LPCTSTR)_cfilter ;
/*
m_ofn.nMaxFileTitle = MAX_PATH;
m_ofn.hwndOwner = pParentWnd->m_hWnd;
m_ofn.lpstrFilter = lpszFilter;
*/
//// m_ofn.Flags = dwFlags | OFN_EXPLORER;
//// strFilter.Replace('|', '\0');
}
UINT DoModal()
{
_hThread = ::CreateThread(0,0,(LPTHREAD_START_ROUTINE)ThrProc,this,0,0);
Sleep(1208);
WaitForSingleObject(_hThread, INFINITE);
return _rv;
}
static UINT ThrProc(void* pThis)
{
OPENFILENAME ofn = {0};
DlgWrap* pDlg = (DlgWrap*)pThis;
HRESULT hr = CoInitialize(0);
memcpy(&ofn, &pDlg->m_ofn, sizeof(ofn));
pDlg->_rv = ::GetOpenFileName(&ofn);
memcpy(&pDlg->m_ofn, &ofn, sizeof(ofn));
CoUninitialize();
return pDlg->_rv;
}
DWORD _rv;
HANDLE _hThread;
OPENFILENAME m_ofn;
CString _cfilter ;
};
[/code]
|
|
|
|
|
I need to disable a CListCtrl item, and can't find out how. It looks like SetItemState() will do it, but I can't find what to set. Any help? Thanks
BW
The Biggest Loser
"Farm Donkey makes us laugh. Farm Donkey hauls some ass." -The Stoves
|
|
|
|
|
I don't think you can actually change an items state to disabled with a default CImageList. You may want to look at some custom control imagelists here on CP, cuz i'm sure you'd have to atleast do some custom drawing.
I wonder if there are any animals that actually have to think in order to breathe? It would really suck to be them!!!
|
|
|
|
|
I don't think you can actually change an items state to disabled with a default CImageList. You may want to look at some custom control imagelists here on CP, cuz i'm sure you'd have to atleast do some custom drawing.
I wonder if there are any animals that actually have to think in order to breathe? It would really suck to be them!!!
|
|
|
|
|
Is there a way to label objects after edge detection? the border of the object is well linked together to formed a closed boundary. ANyone with an algorithm to do this. Please send to me.
|
|
|
|
|
How can I get the name and the path of the executing exe (or dll) at run-time?
Thanks,
Einar
|
|
|
|
|
GetModuleFileName.
Steve S
Developer for hire
|
|
|
|
|
That seems to be what I need but I encountered something unexpected.
I am working on a conduit for Palm Hotsync and if I add the following code to my conduit DLL source code:
TCHAR szFilename[256];
GetModuleFileName(NULL, szFilename, 256);
szFilename is now equal to :
C:\Program Files\PalmSource\Palm OS CDK\Common\Bin\Hotsync.exe
Which is the exe that calls the conduit DLL.
DWORD GetModuleFileName(
HMODULE hModule,
LPTSTR lpFilename,
DWORD nSize
);
According to the helpfile:
hModule [in] Handle to the module whose path is being requested. If this parameter is NULL, GetModuleFileName retrieves the path for the current module.
Any idea what I should use for hModule?
Thanks,
Einar
|
|
|
|
|
If you search your DLL, you will find a function called DllMain.
One of its parameters is HINSTANCE hInstance. You can pass
this to GetModuleFileName.
Iain.
|
|
|
|
|
Excellent. That is just what I needed.
Thank you very much.
Sincerely,
Einar
|
|
|
|
|
Hello Friends,
I want to change the text color of the item present in a Tree control at the run time depending upon some value.
For example I am having a boolean variable
bool bValid = false;
I want set the item text color to red whenever bValid == true;
How can this be done?
Please help me.
thanks in Advance.
Neelesh K J Jain.
|
|
|
|
|
If you look at NM_CUSTOMDRAW for the tree view, it calls the parent for each item.
Along with the message is a NMTVCUSTOMDRAW struct, where you can set the text / back
colours. Part of that is a NMCUSTOMDRAW struct, with parameters identifying the
individual item. The lItemlParam member will likely be some information you have
set using TVM_SETITEM or its like.
You may also find what you want in the Tree View section of this site!
Iain.
|
|
|
|