|
|
|
Hi all,
I am from c,c++ background... i am working on VC++ from last few month.. i want to know about the interview question that can be asked... can anybody guide me...
Thankns in advance...
Tasu
|
|
|
|
|
you want interview questions?
Just i am posting a link for asp.net but it not contails only asp dot net. it contains all interview questions.
Many interview questions
Nice talking to you. If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
Thanks Haranadh ....
definitly it will help me
Tasu
|
|
|
|
|
Hi,
I am trying to run two process (Process A & Process B) in User credentials. Process A is running with Admin credentials (Process A runs with CreateProcessWithLogon API) and Process B running with User credentails. I am trying to get the handle of Process B in Process A but it is returning NULL handle.
I would like to know how can I get the process handle of Process B, which is running under User credentials using Process A, which is running with Admin credentials.
Any idea / view on this would help.
Thanks
Suhas
SNI
|
|
|
|
|
More information would be nice. Try the OpenProcess API perhaps.
Steve
|
|
|
|
|
Steve,
I am using Openprocess to get the handle of Process B in Process A. I get the handle to the window of process B and find out the Process ID (which is I am receiving correct), but when I tried to get the handle using OpenProcess it is returning NULL. The reason behind this could be Process A runs with Admin credentails and Process B running with User creadentails.
I need to find out the way how to get the process handle for Process B.
Thanks
SNI
SNI
|
|
|
|
|
Perhaps if you post some code the problem may be noticed by someone.
Steve
|
|
|
|
|
Here is the code where I am trying to get the handle of process B is Process A
--------------------------------------------------------------------------------
HWND hwnd = ::FindWindow(NULL,"Process B");
DWORD dwThreadId, dwProcessId;
dwThreadId = GetWindowThreadProcessId(hwnd, &dwProcessId);
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS |PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,FALSE,dwProcessId );
Here hProcess becomes NULL.
Thanks
SNI
|
|
|
|
|
Try putting a breakpoint after the OpenProcess call and then enter the following in the watch window of your debugger:
@ERR,hr
What problem does the debugger report when the breakpoint is hit?
Steve
|
|
|
|
|
I Ran Process B in User credentials and after hitting berak point @ERR,hr valus is S_OK.
jhghjghj
|
|
|
|
|
Interesting. Perhaps try this:
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, dwProcessId);
If this doesn't work then I'm not sure what to suggest.
Steve
|
|
|
|
|
Steve,
Thanks for your reply. But it is not working. I'll explain you once again how I am running these processes. I have write a program where I am executing Process B using shellexecute with out any credentials and Process A with CreateProcessWithLogon API with admin credentials. Now when both processes are running Process A tries to get handle to the Process B and it fails.
The code given above will work only when I am running these two processes indiviually. but not thru any program as I explained.
If you any idea how can one get the handle to the process B when running thru third program / utility.
Thanks
SNI
|
|
|
|
|
I too had problem in opening the process created by another user.I can even open system process but not process created by another user. That problem not solved yet.
|
|
|
|
|
Nave,
Can you tell me how do you achieve this. pls spedify code if possible.
Thanks
SNI
-- modified at 5:53 Wednesday 4th July, 2007
|
|
|
|
|
Hello,
I want to find computers and network shares with in My network places using C++/MFC code.
I can find files and folders using FindFirstFile and FindNextFile but how can I find network shares and computers in work group?
can any one help me please?
Regds
Buddhika
Annasi
|
|
|
|
|
check the NetShareEnum() function in msdn. A sample is also there.
|
|
|
|
|
Hi,
I know how to sort simple int or String based Carrays using qsort but I'd like to sort a CArray that is composed of a class with mixed variable types. Also, I'd like to sort the CArray based on one member of the base class and have the other members maintain their original association, ie.,
class CMyClass : public CObject
{
int m_A;
double m_B;
CString m_C;
}
CArray <cmyclass, cmyclass&=""> MyClassArray;
as an example say the members in MyClassArray are:
m_A, m_B, m_C
2 2.4 HI
1 5.6 BYE
4 8.3 NO
after sorting on the int field the sorted CArray would look like-
m_A, m_B, m_C
1 5.6 BYE
2 2.4 HI
4 8.3 NO
There is an articleon this site, "QuickSort enabled CArray template class" which describes sorting of user defined class members but it appears to sort the column selected independently without reordering the associated elements.
A very "inelegant" way of doing this would be to copy the sort field to a simple CArray, sort it and then locate the elements in the original array that correspond with the sorted elemnts and rebuild the complex array. I'm hoping there is better way.
Thanks
|
|
|
|
|
Try something like this. Note I use STL's collection classes and not MFC's.
----------------------------------
// Console.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
class CMyClass
{
public:
CMyClass(int a, int b)
: m_A(a)
, m_B(b)
{}
int m_A;
double m_B;
};
// Function to sort by 'm_A'.
inline bool MyClassLessByA(const CMyClass &l, const CMyClass &r)
{
return l.m_A < r.m_A;
}
// Function to sort by 'm_B'.
inline bool MyClassLessByB(const CMyClass &l, const CMyClass &r)
{
return l.m_B < r.m_B;
}
// Function to write the class to an output stream.
inline std::ostream& operator<<(std::ostream &os, const CMyClass &cr)
{
os << "CMyClass(" << cr.m_A << ", " << cr.m_B << ")";
return os;
}
int main(int arvc, char* argv[])
{
using namespace std;
// Create an "array" and populate it.
vector<CMyClass> array;
array.push_back(CMyClass(1, 5.0));
array.push_back(CMyClass(2, 4.0));
array.push_back(CMyClass(3, 3.0));
array.push_back(CMyClass(4, 2.0));
array.push_back(CMyClass(5, 1.0));
// Shuffle the array into a random order.
random_shuffle(array.begin(), array.end());
// Output the shuffled array to the console.
cout << "Array before sorting:" << endl;
copy(array.begin(), array.end(), ostream_iterator<CMyClass>(cout, "\n"));
cout << endl;
// Sort by 'm_A'.
sort(array.begin(), array.end(), MyClassLessByA);
// Output the array to the console.
cout << "Sorted by 'm_A':" << endl;
copy(array.begin(), array.end(), ostream_iterator<CMyClass>(cout, "\n"));
cout << endl;
// Sort by 'm_B'.
sort(array.begin(), array.end(), MyClassLessByB);
// Output the array to the console.
cout << "Sorted by 'm_B':" << endl;
copy(array.begin(), array.end(), ostream_iterator<CMyClass>(cout, "\n"));
cout << endl;
return 0;
}
----------------------------------
The output on my system was the following:
Array before sorting:
CMyClass(5, 1)
CMyClass(4, 2)
CMyClass(1, 5)
CMyClass(3, 3)
CMyClass(2, 4)
Sorted by 'm_A':
CMyClass(1, 5)
CMyClass(2, 4)
CMyClass(3, 3)
CMyClass(4, 2)
CMyClass(5, 1)
Sorted by 'm_B':
CMyClass(5, 1)
CMyClass(4, 2)
CMyClass(3, 3)
CMyClass(2, 4)
CMyClass(1, 5)
Steve
|
|
|
|
|
My registered activex control seems to be corrupted or missing. Now before installing new one I want to remove it entirely even from VC++ registered activex control. How Can I remove it.
In similar manner how to remove added activex control in application.Because it gets added to standard controls list. How to remove it. I agree most of time when you add same control it gets overwritten but I dont want that, as I am not sure overwriting may not be correct.
|| Lust Causes Sorrow ||
|
|
|
|
|
Hi
The typeid operator requires run-time type information (RTTI) to be generated, which must be explicitly specified at compile time through a compiler option.
Could i know,how to enable RTTI in VC6.0
VIBIN
"Fool's run away,where angle's fear to tread"
|
|
|
|
|
Its in the compiler option, under the Language category I think
|
|
|
|
|
project->settings->C/C++->Enable Run Time Type Information (RTTI)
|
|
|
|
|
1. Select "Project"->"Settings" from the application's menu.
2. Select the project and configuration.
3. Select the "C/C++" tab.
4. Select "C++ Language" in the "Category" combo.
5. Tick the "Enable Run-Time Type Information (RTTI)" check box.
Steve
|
|
|
|