|
This code should print 1. I went as far as to try it myself and it does.
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
I didnt know of that.
I always thought the function of the current namespace would be used.
Just tested it. It works. cooool
Thanks
|
|
|
|
|
No problem. That's what the virtual keyword is for, in front of your f() function. I suggest you read up on it.
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
You mean?
A.DoFunc() == 1
No, class A knows nothing about class B.
B on the other hand knows about A because it is derived from it.
|
|
|
|
|
I wrote Inst.DoFunc() in the example.
This was not obvious to me. Inst.DoFunc() does indeed ignore f() member
in class A and uses the derived f() from B.
|
|
|
|
|
If it is public or protected it will work.
Jason Henderson start page ; articles
henderson is coming
henderson is an opponent's worst nightmare
* googlism *
|
|
|
|
|
You should have a new public (not private or protected) member function in class B, inside which you would call A's DoFunc() function...
There are no failures; there are only extended learning opportunities.
|
|
|
|
|
If you want to guarantee that the base class version will be called, rather than a virtual one from a derived class, you can do the following:
class A
{
protected:
virtual int f() { return -1; };
public:
void DoFunc() { printf("\nValue: %d",A::f()); };
};
Software Zen: delete this;
|
|
|
|
|
Hello!
After some fights with the taskbar at last I've been able to resize windows properly...
- If I use ShowWindow(SW_MAXIMIZED); then the window first appears on the normal workarea (up the taskbar) and then it gets well positioned all over the full screen (flickering).
- If I use:
<br />
this->SetWindowPos(&wndTopMost,0,0,::GetSystemMetrics(SM_CXSCREEN),::GetSystemMetrics(SM_CYSCREEN),SWP_SHOWWINDOW);<br />
this->ShowWindow(SW_SHOWMAXIMIZED);<br />
then the window is displayed properly and it gets maximized, but I can continue moving it.
PS:
it only don't work under win2k... unfortunately it's the OS in which the app must be installed.
Is there any way to make a window stay at the place in which I've left it?
thank you very much for your help!
|
|
|
|
|
You can do this:
Add the following to your message map:
ON_WM_NCLBUTTONDOWN()
Add the following to the //{{AFX_MSG section of the window header:
afx_msg void OnNcLButtonDown( UINT nHitTest, CPoint point );
Implment the following:
void CYourWindow::OnNcLButtonDown( UINT nHitTest, CPoint point )
{
}
When I did this, the window could not be dragged......
But, you'll need to do some work to get the caption buttons and system menu buttons to work......But this is a start......
Just trying to keep the forces of entropy at bay
|
|
|
|
|
Actually, all you need to do is in the non client click handler....i tested it with a dialog but any cwnd should do:
void CDummyDlg::OnNcLButtonDown( UINT nHitTest, CPoint point )
{
// swallow caption hits, let all others go through.....
//
if ( nHitTest != HTCAPTION )
CDialog::OnNcLButtonDown( nHitTest, point );
}
Just trying to keep the forces of entropy at bay
|
|
|
|
|
Direct, Easy and now working for me!
thanks!
|
|
|
|
|
You can also override WM_MOVING and WM_SIZING to force (or disallow) selective motion (hugging an edge, resizing to specific sizes only, etc).
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
infect i want to halt ctrl+alt+del after writing my gina dll?
but i could not sucessed yet.
can any body provide the link of related examples?
i have searched a lot but i could not sucessed to find it out .
i need some gina examples.
r00d0034@yahoo.com
|
|
|
|
|
Bonjour,
All you need I think ...
http://msdn.microsoft.com/msdnmag/issues/02/09/CQA/default.aspx
Simplicity is the supreme sophistication.
-------------------------------------------
http://www.borie.org/
|
|
|
|
|
|
i have used this function, it return sucessfully but the system is not login and desktop did not appear.
is there any step remains ?
or is there any mistake?
if yes plz tell.
i will be very thank full to you.
BOOL Successful;
HANDLE AccessToken;
DWORD ErrorCode;
char *BufferPtr;
::SetCursorPos(20,20);
Successful = LogonUser ("super", ".", "super", LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT, &AccessToken);
r00d0034@yahoo.com
|
|
|
|
|
there are plenty of examples in MSDN that shows you how to implement that stuff...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
I posted a threaad earlier on, but I still have probs
I need to enter a username, password and domain. Then it needs
to validate this info from a server (permissions, privileges,
groups etc..).
The code below works fine to logon to windows, but I need to check whether a user is part of a particular group? CAn anyone shed any light into the matter.
int AttemptLogon()
{
HANDLE hUser;
TOKEN_STATISTICS TStats;
TOKEN_GROUPS * pGroups;
PSID pLogonSid;
PLUID pLogonId;
HANDLE hUserToken;
DWORD size;
MiniAccount stAccount;
pLogonId = new LUID;
pLogonSid = new SID;
strcpy(stAccount.szUsername, "eric");
strcpy(stAccount.szDomain, "cognitronics");
strcpy(stAccount.szPassword, "");
if (LogonUser( (LPTSTR)stAccount.szUsername,
(LPTSTR)stAccount.szDomain,
(LPTSTR)stAccount.szPassword,
LOGON32_LOGON_INTERACTIVE,
LOGON32_PROVIDER_DEFAULT,
&hUser))
{
hUserToken = hUser;
//
// Now, grovel the token we got back for interesting
stuff:
//
GetTokenInformation(hUser,
TokenStatistics,
&TStats,
sizeof(TStats),
&size);
*pLogonId = TStats.AuthenticationId;
pGroups = (TOKEN_GROUPS*)LocalAlloc(LMEM_FIXED, 1024);
if (!pGroups)
{
CloseHandle(hUser);
return(WLX_SAS_ACTION_NONE);
}
//
// The tricky part. We need to get the Logon SID from
the token,
// since that is what Winlogon will use to protect the
windowstation
// and desktop.
//
GetTokenInformation(hUser,
TokenGroups,
pGroups,
1024,
&size);
if (size > 1024)
{
pGroups = (TOKEN_GROUPS*)LocalReAlloc(pGroups,
LMEM_FIXED, size);
GetTokenInformation(hUser,
TokenGroups,
pGroups,
size,
&size);
}
int n = pGroups->GroupCount;
for (int i = 0; i < pGroups->GroupCount ; i++)
{
if ((pGroups->Groups[i].Attributes &
SE_GROUP_LOGON_ID) == SE_GROUP_LOGON_ID)
{
CopySid(GetLengthSid(pLogonSid),
pLogonSid,
pGroups->Groups[i].Sid );
break;
}
}
LocalFree(pGroups);
return(WLX_SAS_ACTION_LOGON);
}
delete pLogonId;
delete pLogonSid;
int nLastError = GetLastError();
return(WLX_SAS_ACTION_NONE);
}
Does anyone have any ideas or sample source code.
Thankyou for your time
Rich
|
|
|
|
|
sorry for Inconveniences.
but plz solve my problem.
you say?
The code below works fine to logon to windows, but I need to check whether a user is part of a particular group? CAn anyone shed any light into the matter.
but the important thing for me is that you say
"The code below works fine to logon to windows"
did desktop appears after using this code please ans the above thread thats my question?
i will be very thank full to you.
r00d0034@yahoo.com
|
|
|
|
|
Richard Hudson wrote:
The code below works fine to logon to windows, but I need to check whether a user is part of a particular group? CAn anyone shed any light into the matter.
You can use some of the net* functions to check to see if a user is in a group.
I'm sorry, but I don't remember the exact function right now...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
when we are at logoff state in professional xp a window is displayed having a window text
-------------------
LOG ON TO WINDOW
-------------------
that window has two edit box one for username and other for password i want to get the hwnd of these edit box and want to type username and password and click a button
and the code i have used for this purpose is this
POINT pt;
::GetCursorPos(&pt);
HWND h=::WindowFromPoint(pt);
-----------------------------------------
for typing some characters i use this code
-----------------------------------------
::SendMessage(h, WM_CHAR, (WPARAM) 's', (LPARAM) 0);
::Sleep(300);
::SendMessage(h, WM_CHAR, (WPARAM) 'u', (LPARAM) 0);
::Sleep(300);
::SendMessage(h, WM_CHAR, (WPARAM) 'p', (LPARAM) 0);
::Sleep(300);
::SendMessage(h, WM_CHAR, (WPARAM) 'e', (LPARAM) 0);
::Sleep(300);
::SendMessage(h, WM_CHAR, (WPARAM) 'r', (LPARAM) 0);
-----------------------------------------------
for clicking purpose i use this code
::SendMessage(h,WM_LBUTTONDOWN,0,0);
::SendMessage(h,WM_LBUTTONDOWN,0,0);
::Sleep(300);
::SendMessage(h,WM_LBUTTONUP,0,0);
i get mouse position when mouse is at one of the edit box and button of that window.
that code executed at any other window sucessfully but it does not execute at this(described above)window.
what to do ?
is there any change in logic ?
r00d0034@yahoo.com
|
|
|
|
|
What you need is the mouse_event or the SendInput functions.
[edit]Oops, sorry:
I think that for security reasons you can't control nor send events to the Logon window. I don't recall a reference right now...
[/edit]
My latest article:
SQL Server DO's and DONT's[^]
|
|
|
|
|
If you want to get access to the logon screen you must perform this inside a GINA.DLL. programatically it's impossible to get access to the logon screen if you don't do it from that DLL.
You can create a gina dll and make this... take a look at the msdn for more info.
(I've never done it, but I have readen something because some time ago I was interested in something similar...)
Hope this helps...
|
|
|
|
|
My project has been "hanging" lately on rebuilds using VS6... Like right now, it's:
Generating Code...
Creating library...
And no CPU is being used in task manager?!?! If I Cancel build, it locks up and I can't terminate the process via the task manager because it thinks the program is being "debugged" So the only thing I can do is kill the power
I am using VS6 SP3. I can't use SP5 (or 6?) because some of our libraries expose many bugs in those SP's. Anyone have a clue?
P.S. I'm compiling across the network. I'm going to try to copy the project to my local machine next. But our network is fine, and plenty fast...
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|