|
So what exactly is your question? If you are not wanting all of the processes that CreateToolhelp32Snapshot() provides a list of, what are you wanting to filter on?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
The desktop they are a part of. One of the memebers of STARTINFO is lpDesktop. If you create a desktop called CP, using CreateDesktop, then set lpDesktop to "CP", when using CreateProcess, the process runs in the CP desktop, so, if your not viewing the CP desktop, you wouldnt see the applications window appear (if it has one).
What I can get, is handles to all of the windows in running on the desktop - maybe I can use that to find the processes, and kill them.
To those who didn't make it, we will remember you. To those who did is back. - Megan Forbes in Black FridayAnother Post by NnamdiOnyeyiri
|
|
|
|
|
I've got a service.
On rare occasions, it crashes. When it does, it needs to restart.
Here's the details:
(1) it is configured in service-control to restart if failure.
(2) we don't want to rely on DrWatson or any external program to monitor it.
(3) we've tried using SetServiceStatus to signal error on shutdown.
How do we programmatically signal to the service control manager that this failed and it just needs to restart. We've had some problems where 'crash ui' get's invoked.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.santacruznetworks.com">Santa Cruz Networks</A>
|
|
|
|
|
Peter,
Since no body is providing any direct answers I will ask a few questions.
How do you now it crashes? Does it log errors or what?
Could you define “crash”? If your service terminates abnormally then how can you signal anything since your “shutdown” routine will not be executed.
I am not familiar with the term “crash ui” what is it?
Ultimately I suggest you find the problem and fix it rather than counting on restart.
|
|
|
|
|
Ok... well that reply is me! Don't know how i managed to get logged out and post a reply at the same time. Maybe i need a beer!
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
Ultimately I'd like to fix all crashes. But if something bad does happen the service needs to log what happened and restart.
A crash is a crash -- and sometimes it's an assertion. We can detect the crash and write out a minidump. But getting the service control manager to allow us to restart is the problem.
As for "crash ui" -- on a machine with no installed debugger, a message box comes up saying that you did something bad (read attemtped at 0x000000....)
MSDN support had no good answer, except they recommended to write a "service monitor" program to accomplish what the SCM won't do.
oh well.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.santacruznetworks.com">Santa Cruz Networks</A>
|
|
|
|
|
Hi guys
Somebody has an example about to reduce the minimum size of a ComboBox
When I add a Combo box,there is a minimum size and I'd like to have one smaller (I talk about height) than this.
Do you know a derived class where I could see how to do this?
Best Regards
Doc
|
|
|
|
|
You can adjust the height within the resource editor. If you click on the down arrow portion it outlines the minimum size.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fuity and sweet. I'm jelly, what am I? - David Williams (Little Britain)
|
|
|
|
|
You might want to try SetItemHeight for the combo.
|
|
|
|
|
i want to draw into a windows menu but i
can't find a way to get a device context
for it. more specificially, i want to
make a rectangular menu of icons. windows
doesn't seem to support rectangular menus,
so instead i am making a menu with 1 owner
drawn item. i draw the menu when i get the
WM_DRAWITEM message. i can select the
correct option because i can call
GetCursor() when processing WM_MENUSELECT.
what i can't do is update the highlighting
while the mouse moves. i can process
WM_EVENTIDLE messages, but when handling
this message i have no way of drawing into
the menu. WM_DRAWITEM provides a DC, so I
know one exists in the system. Is there
any way to copy this DC and use it later,
or get the DC? Are menus implemented as
windows? Because if so i could maybe
get the hWnd for the menu or something.
Thanks, Phil.
|
|
|
|
|
|
I am studying the communication of MS Media Player while it plays a http file. I find a interesting thing.
I wrote a small program to accept requests from the media player. For most video files like mpeg, I found that it sends http get request to download a the video file. But, the I tried to use the media player to play a wmv or asf file, it did not send any request, it however tried to receive the information from the server instead of sending a request. As result, the server program of course can not provide any wmv/asf file for downloading by media player.
I don't understand why media plyer doest not send an http request while downloading wmv or asf files. What possible inside operation does it perform?
Could you give me some tips?
|
|
|
|
|
Does anybody know?
Why does the web client begin to receive information from the server before sending a request? In what case they will do that?
|
|
|
|
|
I am currently using the Pdh to enumerate through processes running on the system in order to get the process id of a particular application.
Given that I know its name is there a simpler way to achieve this?
Thanks
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fuity and sweet. I'm jelly, what am I? - David Williams (Little Britain)
|
|
|
|
|
Here are a couple of options:
http://www.codeproject.com/threads/getprocessid.asp
http://www.mvps.org/vb/hardcore/html/moreabouthandlesprocessids.htm
http://www.efimov.org/mef/modules.php?name=News&file=article&sid=4
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thankyou David
I particularly like the WMI flavour.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fuity and sweet. I'm jelly, what am I? - David Williams (Little Britain)
|
|
|
|
|
Okay, so WMI seems pretty neat, until you figure out what it takes to get it installed if it is not already on a system. Just a word of warning before running off to depend upon it.
|
|
|
|
|
Thanks I will bear this in mind
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fuity and sweet. I'm jelly, what am I? - David Williams (Little Britain)
|
|
|
|
|
I wrote a resource script with menu resources duplicated on several languages.
MSDN states that I can control loading appropriate version of resource using
SetThreadLocale() call, but this way doesn't work. Operating system always
loads English version of menus in spite of what thread locale I'm using. Can
you tell me what's wrong? I'm working with Windows XP SP1.
|
|
|
|
|
chupeev@tmn.ru wrote:
...I can control loading appropriate version of resource using
SetThreadLocale() call, but this way doesn't work.
What value does it return?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
SetThreadLocale() return TRUE. I'm feed in it LCID equal to
MAKELCID(MAKELANGID(LANG_RUSSIAN, SUBLANG_DEFAULT), SORT_DEFAULT),
but it resources loaded in English. Dont know why?
|
|
|
|
|
Here is an example which should load russian version of menu, but it will display window with english menu. Why?
------------- sh ./eg.sh ------------------
#!/bin/sh
cat > generic.c << EOF
#include <windows.h>
#include <tchar.h>
#include <windowsx.h>
#define NAMESTART 16
WNDPROC Listbox_WindowProc;
BOOL CALLBACK Enumres_EnumProc(HMODULE hModule, \
LPCTSTR lpszType, LPCTSTR lpszName, LANGID wIDLanguage, LPARAM lParam)
{
TCHAR szItemText[NAMESTART + MAX_PATH];
HWND* hwnd = (HWND*) lParam;
wsprintf(szItemText, TEXT("%#03x %#03x - "), PRIMARYLANGID(wIDLanguage), SUBLANGID(wIDLanguage));
if (0 < GetModuleFileName(hModule, &szItemText[lstrlen(szItemText)], MAX_PATH))
{
ListBox_AddString(*hwnd, szItemText);
}
return (GetLastError() == ERROR_SUCCESS? TRUE: FALSE);
}
void Enumres_OnDestroy(HWND hwnd)
{
SetWindowLong(hwnd, GWL_WNDPROC, (LONG) Listbox_WindowProc);
PostQuitMessage(0);
}
LRESULT CALLBACK Enumres_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_DESTROY:
HANDLE_WM_DESTROY(hwnd, wParam, lParam, Enumres_OnDestroy);
break;
default:
return Listbox_WindowProc(hwnd, uMsg, wParam, lParam);
}
return 0;
}
BOOL InitInstance(int nCmdShow)
{
LCID dwCurrLocale = MAKELCID(MAKELANGID(LANG_RUSSIAN, SUBLANG_DEFAULT), SORT_DEFAULT);
if (SetThreadLocale(dwCurrLocale))
{
HMENU menu = LoadMenu(NULL, TEXT("GENERIC"));
if (menu)
{
HWND hwnd = CreateWindow(
TEXT("LISTBOX"), // name of window class
TEXT("Enumres"), // title-bar string
WS_OVERLAPPEDWINDOW, // top-level window
CW_USEDEFAULT, // default horizontal position
CW_USEDEFAULT, // default vertical position
CW_USEDEFAULT, // default width
CW_USEDEFAULT, // default height
NULL, // no owner window
menu, // required menu
NULL, // handle to application instance
(LPVOID) NULL); // no window-creation data
if (hwnd)
{
Listbox_WindowProc = (WNDPROC) SetWindowLong(hwnd, GWL_WNDPROC, (LONG) Enumres_WindowProc);
if (EnumResourceLanguages(NULL, RT_MENU, TEXT("GENERIC"), Enumres_EnumProc, (LPARAM) &hwnd))
{
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
return TRUE;
}
}
}
}
return FALSE;
}
int WINAPI _tWinMain(HINSTANCE hCurrInst, HINSTANCE hPrevInst, LPTSTR lpCmdLine, int nCmdShow)
{
if (InitInstance(nCmdShow))
{
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return ((int) msg.wParam);
}
return 0;
DBG_UNREFERENCED_PARAMETER(hPrevInst);
DBG_UNREFERENCED_PARAMETER(lpCmdLine);
}
EOF
cat > resource.h << EOF
#define ID_FILE_NEW 100
#define ID_FILE_OPEN 101
#define ID_FILE_SAVE 102
#define ID_FILE_SAVE_AS 103
#define ID_FILE_PRINT 104
#define ID_FILE_PRINT_SETUP 105
#define ID_FILE_EXIT 106
#define ID_EDIT_UNDO 200
#define ID_EDIT_CUT 201
#define ID_EDIT_COPY 202
#define ID_EDIT_PASTE 203
#define ID_EDIT_LINK 204
#define ID_HELP_CONTENTS 300
#define ID_HELP_SEARCH 301
#define ID_HELP_HELP 302
#define ID_HELP_ABOUT 303
#define ID_HELPTOPICS 304
EOF
cat > generic.rc << EOF
#include "windows.h"
#include "winver.h"
#include "resource.h"
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
GENERIC MENU
BEGIN
POPUP "&" c<"
BEGIN
MENUITEM "'R¤& вм\tCtrl+N", ID_FILE_NEW, GRAYED
MENUITEM "&_вЄалвм...\tCtrl+O", ID_FILE_OPEN, GRAYED
MENUITEM "&'Rеа -Ёвм\tCtrl+S", ID_FILE_SAVE, GRAYED
MENUITEM "'Rеа -Ёвм &Є Є...", ID_FILE_SAVE_AS, GRAYED
MENUITEM SEPARATOR
MENUITEM "&__з вм...\tCtrl+P", ID_FILE_PRINT, GRAYED
MENUITEM "_ а &┐_вал бва -Ёжл...", ID_FILE_PRINT_SETUP, GRAYED
MENUITEM SEPARATOR
MENUITEM "'&леR¤\tAlt+X", ID_FILE_EXIT
END
POPUP "&_а ўЄ "
BEGIN
MENUITEM "&_в┐_-Ёвм\tCtrl+Z", ID_EDIT_UNDO, GRAYED
MENUITEM SEPARATOR
MENUITEM "&'ла_ вм\tCtrl+X", ID_EDIT_CUT, GRAYED
MENUITEM "&_RЇЁаRў вм\tCtrl+C", ID_EDIT_COPY, GRAYED
MENUITEM "&'бв ўЁвм\tCtrl+V", ID_EDIT_PASTE, GRAYED
MENUITEM "'бл&<Є ", ID_EDIT_LINK, GRAYED
END
POPUP "&'Їа ўЄ "
BEGIN
MENUITEM "&'R¤_а│ -Ё_", ID_HELP_CONTENTS, HELP
MENUITEM "&_а_¤┐_в-лc гЄ в_<м...", ID_HELP_SEARCH, HELP
MENUITEM "_ бЇ&а ўRз-Rc бЁбв_┐_", ID_HELP_HELP, HELP
MENUITEM SEPARATOR
MENUITEM "&_ ЇаR_а ┐┐_...", ID_HELP_ABOUT
END
END
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
GENERIC MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&New\tCtrl+N", ID_FILE_NEW, GRAYED
MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN, GRAYED
MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE, GRAYED
MENUITEM "Save &As...", ID_FILE_SAVE_AS, GRAYED
MENUITEM SEPARATOR
MENUITEM "&Print...\tCtrl+P", ID_FILE_PRINT, GRAYED
MENUITEM "P&rint Setup...", ID_FILE_PRINT_SETUP, GRAYED
MENUITEM SEPARATOR
MENUITEM "E&xit\tAlt+X", ID_FILE_EXIT
END
POPUP "&Edit"
BEGIN
MENUITEM "&Undo\tCtrl+Z", ID_EDIT_UNDO, GRAYED
MENUITEM SEPARATOR
MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT, GRAYED
MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY, GRAYED
MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE, GRAYED
MENUITEM "Paste &Link", ID_EDIT_LINK, GRAYED
END
POPUP "&Help"
BEGIN
MENUITEM "&Contents", ID_HELP_CONTENTS, HELP
MENUITEM "&Search for Help On...", ID_HELP_SEARCH, HELP
MENUITEM "&How to Use Help", ID_HELP_HELP, HELP
MENUITEM SEPARATOR
MENUITEM "&About Generic...", ID_HELP_ABOUT
END
END
EOF
rc generic.rc
cl /nologo /MDd /Zi /D_UNICODE /DUNICODE generic.c generic.res user32.lib
|
|
|
|
|
Hi,
I use a thread in my app and in one portion of the code, the thread call another class. This class trie to pop up a window but get's a handle of 0x0000. Look like the Create or CreateIndirect fails.....
<br />
CWaitDlg *w=new CWaitDlg ("","Please Wait");
w->Create (IDD_WAIT); <br />
w->ShowWindow (SW_SHOWNORMAL);<br />
<br />
|
|
|
|
|
The handle will always be 0 until you actually create the window.
John
|
|
|
|
|
You are right.
The problem starts when I use the Create function.....
|
|
|
|
|