|
I misunderstood the question. The logon scripts are run in interactive desktop so my method will fail.
|
|
|
|
|
Toby, Rama
You guys are great help. The other thing is, this strategy has to work
with both Windows XP Professional Fast Logon Optimization AND with
login scripts running synchronously or non-synchronously.
So again, looks like my best bet is enuming userinit.
Cant say thanks enough.
-Shawn
|
|
|
|
|
You can also look if explorer is running yet (unless the shell was replaced) as a backup verification.
8bc7c0ec02c0e404c0cc0680f7018827ebee
|
|
|
|
|
Ok gents ... just walked my procs on a typical logon ... here's are
the results (proc.exe is my proc).
pid=1484 proc=proc.exe
pid=3412 proc=cmd.exe
pid=3120 proc=userinit.exe
pid=972 proc=winlogon.exe
pid=892 proc=smss.exe
pid=4 proc=System
pid=0 proc=[System Process]
so looks like userinit is the ticket, unless you guys see something
else I should be keying in on.
|
|
|
|
|
Just make sure in Windows 2000 that USERINIT goes away after starting the shell; I don't remember if it does or not but in XP it does.
8bc7c0ec02c0e404c0cc0680f7018827ebee
|
|
|
|
|
Good point. Walking my procs from the command line, after
being logged in yields this:
pid=2704 proc=proc.exe
pid=472 proc=cmd.exe
pid=3188 proc=explorer.exe
Like you say, this is on XP as well. Will do both
these tests on Windows 2000 and advise.
|
|
|
|
|
Here is my first stab at a function - LogonMode returns 1 if running during logon, 0 (zero) otherwise.
#include <TlHelp32.h>
LONG LogonMode()
{
LONG pid = GetCurrentProcessId();
PROCESSENTRY32 pe;
pe.dwSize = sizeof(pe);
while((pid = GetParentPid(pid,&pe)) != 0)
{
if(_tcsncicmp(pe.szExeFile,"userinit.exe",12) == 0)
{
return 1;
}
}
return 0;
}
LONG GetParentPid(LONG pid, PROCESSENTRY32* pe)
{
LONG lRet = 0;
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if(hSnapshot != INVALID_HANDLE_VALUE)
{
if(Process32First(hSnapshot, pe))
{
do
{
if(pe->th32ProcessID == pid)
{
return pe->th32ParentProcessID;
}
}
while((lRet = Process32Next(hSnapshot,pe)));
}
}
return lRet;
}
|
|
|
|
|
Can anyone help me in making a source code for a profeller
EXAMPLE
enter a number[1-10]: 5
*****
* ****
** ***
*** **
**** *
***** *****
* ****
** ***
*** **
**** *
*****
pls can someone help me....
|
|
|
|
|
need4change wrote: Can anyone help me in making a source code for a profeller
I assume you meant to say profiler. What's wrong with the one that ships with Visual Studio?
need4change wrote: EXAMPLE
Just out of curiosity, what is this an example of?
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
Looks like a CS homework assignment.
8bc7c0ec02c0e404c0cc0680f7018827ebee
|
|
|
|
|
need4change wrote: pls can someone help me....
Yes, if you ask the right question. I don't see any question in your post. And your post is also very unclear. If you ask for people to do the job for you, be very carefull then. You'll be warned
|
|
|
|
|
I've got a c++ win32 (non MFC) dialog based app with a custom control
that listens to WM_KEYDOWN,WM_KEYUP for keypress/releases to
behave like a synth keyboard - so i NEED keyup events.
Thing is, it's BEEPING! (a "default beep" type beep)
In my custom control i've tried returning 0, returning 1 and
calling the default message handler - STILL beeps.
I tried with and without calling TranslateMessage() in my msgloop.
STILL BEEPS!
Can anybody help meee?
Here's my custom control - pretty basic:
(KeyMap and Canvas are my own classes, but are pretty simple and DON'T BEEP)
struct {key k; ubyte nt;} KyNt [] = {
{'z', M_NT(M_C,0)}, {'x', M_NT(M_D,0)},
{'c', M_NT(M_E,0)}, {'v', M_NT(M_F,0)},
{'b', M_NT(M_G,0)}, {'n', M_NT(M_A,0)},
{'m', M_NT(M_B,0)}, {',', M_NT(M_C,1)},
{'.', M_NT(M_D,1)}, {'/', M_NT(M_E,1)},
{'s', M_NT(M_Db,0)}, {'d', M_NT(M_Eb,0)},
{'g', M_NT(M_Gb,0)}, {'h', M_NT(M_Ab,0)},
{'j', M_NT(M_Bb,0)}, {'l', M_NT(M_Db,1)},
{';', M_NT(M_Eb,1)},
{'q', M_NT(M_C,1)}, {'w', M_NT(M_D,1)},
{'e', M_NT(M_E,1)}, {'r', M_NT(M_F,1)},
{'t', M_NT(M_G,1)}, {'y', M_NT(M_A,1)},
{'u', M_NT(M_B,1)}, {'i', M_NT(M_C,2)},
{'o', M_NT(M_D,2)}, {'p', M_NT(M_E,2)},
{'[', M_NT(M_F,2)}, {']', M_NT(M_G,2)},
{'\\', M_NT(M_A,2)},
{'2', M_NT(M_Db,1)}, {'3', M_NT(M_Eb,1)},
{'5', M_NT(M_Gb,1)}, {'6', M_NT(M_Ab,1)},
{'7', M_NT(M_Bb,1)}, {'9', M_NT(M_Db,2)},
{'0', M_NT(M_Eb,2)}, {'=', M_NT(M_Gb,2)},
{BSP_KEY, M_NT(M_Ab,2)}
};
struct CtlKbd {
public:
void Init ()
{
TRC("CtlKbd::Init bgn");
MemSet (& _wc, 0, sizeof (_wc));
_wc.lpszClassName = "KBD";
_wc.lpfnWndProc = WinProc;
_wc.cbSize = sizeof (WNDCLASSEX);
_wc.hCursor = ::LoadCursor (0, IDC_ARROW);
if (::RegisterClassEx (& _wc) == 0)
DieWn ("CtlKbd::CtlKbd RegisterClassEx");
TRC("CtlKbd::Init end");
}
private:
WNDCLASSEX _wc;
static LRESULT CALLBACK WinProc (HWND hwnd, UINT msg, WPARAM w, LPARAM l)
{ static bool foc = false;
static ubyte oct = 4;
static ubyte vel = 100;
switch (msg) {
case WM_LBUTTONDOWN:
::SetFocus (hwnd);
return 0;
case WM_SETFOCUS:
foc = true; ::RedrawWindow (hwnd, NULL, NULL, RDW_INVALIDATE);
return 0;
case WM_KILLFOCUS:
foc = false; ::RedrawWindow (hwnd, NULL, NULL, RDW_INVALIDATE);
return 0;
case WM_PAINT:
{ PAINTSTRUCT p;
Canvas c (::BeginPaint (hwnd, & p));
c.SetBg (foc ? 0 : 255, foc ? 255 : 0, 0);
c.Text (0, 0, "in");
::EndPaint (hwnd, & p);
}
return 0;
case WM_ERASEBKGND:
return 0;
case WM_KEYDOWN: case WM_KEYUP:
{ KeyMap km;
key k;
ubyte i;
TrkEv e;
char buf [900];
if ((l & 0x80000000) || (!(l & 0x40000000))) if (k = km.Map (w)) {
for (i = 0; i < BITS (KyNt); i++)
if (k == KyNt [i].k) {
e.ctrl = (ubyte)(KyNt [i].nt + oct*12);
e.valu = (l & 0x80000000) ? 0 : vel;
if ((l & 0x80000000) == 0) e.valu |= 0x80;
e.chan = 0;
sprintf (buf, "kbd ctl: $%02X $%02X\n", e.ctrl, e.valu);
DBG(buf);
break;
}
}
return 0;
}
}
return ::DefWindowProc (hwnd, msg, w, l);
}
};
|
|
|
|
|
Seems to me you could play around with the various messages you are handling by calling DefWindowProc() instead until you find the message that is in question. From there, you could narrow it down to the actual statement that is causing the problem.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
Well, I suspect the DefWindowProc itself is actually DOING the beeping.
But I don't know why???
I must be doing something wrong, but I don't know what...
|
|
|
|
|
Hmm, I took everything out and it still beeps.
So it has to be due to IsDialogMessage of the MsgLoop
or DefWindowProc of my custom control...
When focus is on a combo box, holding down keys doesn't cause "default beep".
But when my custom control has focus it DOES do the "default beep".
Maybe my control has to say "hey i need keypresses" so IsDialogMessage doesn't
beep (I'm guessing due to not being able to navigate to a static with that mnemonic???)
Hmmmmmmmmmm......
(And thanks for the reply!)
...Steve
|
|
|
|
|
Ok. I needed to handle WM_GETDLGCODE for my custom control to get wm_keyup/down...
No more beeping.
Buuuut, now I can't tab outa the field once I'm in it.
I can click out, but can't tab/shift-tab out...
Anybody know how to correctly handle tab, shift-tab, cursor up/down/left/right, mnemonic???
Sighhh...
...Steve
struct CtlKbd {
public:
void Init ()
{
TRC("CtlKbd::Init bgn");
MemSet (& _wc, 0, sizeof (_wc));
_wc.lpszClassName = "KBD";
_wc.lpfnWndProc = WinProc;
_wc.cbSize = sizeof (WNDCLASSEX);
_wc.hCursor = ::LoadCursor (0, IDC_ARROW);
if (::RegisterClassEx (& _wc) == 0)
DieWn ("CtlKbd::CtlKbd RegisterClassEx");
TRC("CtlKbd::Init end");
}
private:
WNDCLASSEX _wc;
static LRESULT CALLBACK WinProc (HWND hwnd, UINT msg, WPARAM w, LPARAM l)
{ static bool foc = false;
static ubyte oct = 4;
static ubyte vel = 100;
switch (msg) {
case WM_GETDLGCODE:
return DLGC_WANTALLKEYS;
case WM_LBUTTONDOWN:
::SetFocus (hwnd);
return 0;
case WM_SETFOCUS:
foc = true; ::RedrawWindow (hwnd, NULL, NULL, RDW_INVALIDATE);
return 0;
case WM_KILLFOCUS:
foc = false; ::RedrawWindow (hwnd, NULL, NULL, RDW_INVALIDATE);
return 0;
case WM_PAINT:
{ PAINTSTRUCT p;
Canvas c (::BeginPaint (hwnd, & p));
c.SetBg (foc ? 0 : 255, foc ? 255 : 0, 0);
c.Text (0, 0, "in");
::EndPaint (hwnd, & p);
}
return 0;
case WM_ERASEBKGND:
return 0;
case WM_KEYDOWN: case WM_KEYUP:
{ KeyMap km;
key k;
ubyte i;
TrkEv e;
char buf [900];
if ((l & 0x80000000) || (!(l & 0x40000000))) if (k = km.Map (w)) {
for (i = 0; i < BITS (KyNt); i++)
if (k == KyNt [i].k) {
e.ctrl = (ubyte)(KyNt [i].nt + oct*12);
e.valu = (l & 0x80000000) ? 0 : vel;
if ((l & 0x80000000) == 0) e.valu |= 0x80;
e.chan = 0;
sprintf (buf, "kbd ctl: $%02X $%02X\n", e.ctrl, e.valu);
DBG(buf);
return 0;
}
}
break;
}
}
return ::DefWindowProc (hwnd, msg, w, l);
}
};
|
|
|
|
|
Steve Hazel wrote: case WM_GETDLGCODE:
return DLGC_WANTALLKEYS;
What about DLGC_WANTARROWS and DLGC_WANTTAB ?
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
handling WM_GETDLGCODE with return DLGC_WANTALLKEYS tells the dialog manager
that I want keys and to NOT beep when a key doesn't resolve to a static to navigate to.
The keys I want to watch go up and down don't include arrows or tab.
I was -hoping- that the msgloop's IsDialogMessage() or control's DefWindowProc
would handle tabbing(and shift tabbing and arrowing) to other controls,
but noooooo...
So now I gotta figure out how to correctly tab/shift-tab/etc...
...Steve
|
|
|
|
|
How about changing it to DLGC_WANTCHARS instead, so the dialog manager will still process the arrow keys and the tab character if the IsDialogMessage is properly introduced into whatever main message loop you have for your application.
If not, then you need to handle the arrow keys and TAB/SHIFT+TAB your self and translate them into setting focus of appropriate next and previous dialog controls.
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|
|
Not sure about DLGC_WANTCHARS.
I need WM_KEYDOWN/WM_KEYUP messages.
I need the up messages so I know when to turn notes off.
right now i got it covered by DLGC_ANY<whatever_that_was_called>
it stops the beeps.
when i get a tab or shift tab, I send the parent dialog the
message for next/prev control.
i never use arrow keys, but i suppose i SHOULD handle those, too.
not gonna bother with the mnemonic hoppin' biz
Anywayyyyyyyyyz, it's good enough i spose.
Thanks
...Steve
|
|
|
|
|
Hi I posted this question earlier too. I have a VC application runing fine on 2000 n XP . But I could't run that application on server 2003. So after trying everything , I just installed MS VC++ 6 on Server2003 and compile that application and ran it , and it ran fine.
But now I have to ran that VC application on another MS 2003 server , and even after copying the 2003 DLLs , its not runing. Do I have to install MS VC++ on that machine also to ran my application ???
Any solution ? suggestions ?? plz !
ZINC
|
|
|
|
|
Hello ZINC,
Your application has so many dependencies.
So first u have to find that all.
Or just making package. which is recommended by me.
Becoz as u said u copy all dll file's
but some dll file u have to register with os be regsvr32.exe command.
so by making package it will handle all that things for u.
Divyang Mithaiwala
with best regards
|
|
|
|
|
Hi Divyang ,
Thanks for reply , can you please guide me how to make package ?
Kind Regards,
Zinc
|
|
|
|
|
Hello zinc_z,
For making package first make exe file by building project.
then there is one tool
start->Program->Microsoft Visual Studio 6.0->Microsoft Visual Studio 6.0 tool -> Package & Deployment Wizard
|
|
|
|
|
hi there ,
i have checked this tool , this tool only give option to open VBP visual basic project. Mine is a Viusal C++ project.
Regards
ZINC
|
|
|
|
|