|
It reminded me of this[^]
are you one of those girls?
-prakash
-- modified at 22:57 Monday 17th October, 2005
|
|
|
|
|
Mr.Prakash wrote: are you one of those girls?
Seems to be
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
I'm trying to use CObList with a class I created. The class I created I inherited CObject.
class CFAFRecord : public CObject
{/*data*/}
I'm able to create this and insert it into the CObList. But when I try to access the list with m_variable.GetNext(m_curPosition); and I try to assign it to a CFAFRecord object, I get the error, 'cannot convert 'class CObject' to 'class CFAFRecord'.
It won't let me typecast it. It looks like it's not recognizing that CFAFRecord is a CObject. Any help here?
Danny
The stupidity of others amazes me!
|
|
|
|
|
First bit of advice is to drop CObList and use STL's std::list instead. If you can not do that and have compeling reasons to use CObList maybe you could post some code showing how you are trying to cast the returned pointer.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Thanks for the advice, but I'd really like to stick with MFC in this case. I switched to using CObArray, but something very similar happens. I've found I can do CFAFRecord * my_record = (CFAFRecord *)my_variable.GetAt(index); but on the next line I try, my_record->member_variable; and I get an access violation.
Danny
The stupidity of others amazes me!
|
|
|
|
|
You are obviously doing something wrong with code you have not posted here so far.
I slapped together a quick MFC console app to show you what I did to make it work
CWinApp theApp;
using namespace std;
class CMyObject : public CObject
{
public:
CMyObject() { i = 0; d = 0.0; }
int i;
double d;
};
CObList ObList;
void DumpList()
{
if (ObList.GetCount() == 0)
return;
POSITION pos = ObList.GetHeadPosition();
while(pos)
{
CMyObject *p = (CMyObject *)ObList.GetNext(pos);
cout << p->i << " " << p->d << endl;
}
}
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = 1;
}
else
{
CString strHello;
strHello.LoadString(IDS_HELLO);
cout << (LPCTSTR)strHello << endl;
}
for (int x = 1; x < 10; ++x)
{
CMyObject *p = new CMyObject;
p->i = x;
p->d = x + x / 10.0;
ObList.AddTail(p);
}
DumpList();
return nRetCode;
} Not perfect, leaks memory, but it should give you an idea.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Although I have used MFC's template classes for years in the past, I second the advice above. Take a look at stl.
John
|
|
|
|
|
John M. Drescher wrote: Although I have used MFC's template classes for years in the past, I second the advice above. Take a look at stl
Any Preculiar reason for that ?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Two main reasons. Power and Portability. stl offers you signifigantly more power than the MFC template classes. The ability to use algorithms on your collection classes is a very nice feature. http://oopweb.com/CPP/Documents/STL/VolumeFrames.html?/CPP/Documents/STL/Volume/prw432.htm[^]
There are also way more different template (hash_maps, stacks, queues, sets ...) types than are offered with the MFCTemplates. Changing from one container type to a second usually does not require many changes at all as the iterators code is all the same. Inserts and sorting may vary though.
And portability, besides being able to use stl code on different operating systems you can also use it with your win32 or atl projects without any changes to the stl code.
John
|
|
|
|
|
try this
CFAFRecord *my_list =(CFAFRecord*) m_variable->GetNext( m_curPosition);
regards
Rajesh
|
|
|
|
|
Your suggestion does not work. I've switched to using CObArray, but the same sort of thing happens. m_variable is not a pointer to the CObArray, so I don't need to dereference it using ->, I need to access it using .
The problem really occurs, I guess, when I try to access one of the variables of my_list after this statement, using my_list->variable.
Danny
The stupidity of others amazes me!
|
|
|
|
|
show ur code what u exactly doing?
|
|
|
|
|
I'm rewriting my C++ dll in MFC so that I can add some more functionality. If I add in the same exact entry points will I have issues with the apps that are calling this dll? Will I need to recompile them?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Tom Wright wrote: If I add in the same exact entry points will I have issues with the apps that are calling this dll? Will I need to recompile them?
Have a Try
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hey, that's a great idea! How is it that you are so wise in the ways of the world?
Thanks...I did and it worked.
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Tom Wright wrote: How is it that you are so wise in the ways of the world?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
i posted a message last night about help retrieving the conversation from a msn messenger windows using the clipboard and searching in the child elements for a RichEdit20W or RichEdit20A and copying the text but user ThatsAlok replied me that msn messenger doesn't use those kind of controls as i'm new in this kind of app's i'll take his word on that
so i was wondering if there could be a way to make a list of all the child elements of the conversation windows and try to retrieve the text from the new textbox element whichever it is now
i already have coded a way to retrieve all the windows titles and put them in a list so i think there might be a way to retrieve all the elements that make that window as i select it from the list
OnInitDialog(){<br />
...<br />
EnumWindows(EnumWindowCallBack, (LPARAM)::GetDlgItem(m_hWnd, IDC_LIST_RUNNING));<br />
...<br />
}<br />
<br />
static BOOL CALLBACK EnumWindowCallBack(HWND hwnd, LPARAM lParam)<br />
{<br />
HWND hWnd = (HWND)lParam;<br />
CString strTitle;<br />
DWORD wndPid;<br />
<br />
if (IsWindowVisible(hwnd))<br />
{<br />
GetWindowThreadProcessId(hwnd, &wndPid);<br />
CWnd::FromHandle(hwnd)->GetWindowText(strTitle);<br />
strTitle.TrimRight();<br />
if (!strTitle.IsEmpty())<br />
{<br />
CListBox *pListBox = (CListBox *)CWnd::FromHandle(hWnd);<br />
pListBox->AddString(strTitle);<br />
if((strTitle.Find("- Conversation",0))!=-1){<br />
::MessageBox(hWnd,"Found","MSN",MB_OK);<br />
EnumChildWindows(hWnd, ChildWndProc,0);<br />
}<br />
}<br />
}<br />
<br />
return TRUE;<br />
}
i think you have to use EnumChildWindows and EnumChildProc but i don't have a clue on how to use them. actually i have a hard time writing the above code so if anyone could help me with this or tell me where to find some good examples on this subject i'll really appreciate it
other way i was told i could retrieve the conversations from msn messenger was making a hook for msn messenger events and using that data to make a log. if someone knows something about this plz TELL ME!! cuz i got to have this app running by december and all the other apps and examples i have found in internet just doesn't work with the new versions of msn messenger
i'm using Visual C++ SP6, W2K and MSN Messenger 7.0
|
|
|
|
|
smargada wrote:
i posted a message last night about help retrieving the conversation from a msn messenger windows using the clipboard and searching in the child elements for a RichEdit20W or RichEdit20A and copying the text but user ThatsAlok replied me that msn messenger doesn't use those kind of controls
I'm using Windows Messenger v4.7 and, using Spy++, confirmed that RichEdit20W is indeed the control that is used.
Try this:
HWND hWndParent = ::FindWindow(_T("IMWindowClass"), NULL);
if (hWndParent != NULL)
{
HWND hWnd = FindWindowEx(hWndParent, NULL, _T("RichEdit20W"), NULL);
if (hWnd != NULL)
{
hWnd = FindWindowEx(hWndParent, hWnd, _T("RichEdit20W"), NULL);
TCHAR szText[1024];
if (::SendMessageW(hWnd, WM_GETTEXT, sizeof(szText), (LPARAM) szText) > 0)
...
}
}
"Take only what you need and leave the land as you found it." - Native American Proverb
-- modified at 9:33 Tuesday 18th October, 2005
|
|
|
|
|
smargada wrote: ThatsAlok replied me that msn messenger doesn't use those kind of controls as i'm new in this kind of app's i'll take his word on that
Buddy, Ohh I believe you are creating Chat spy type Application... I had created such type of application in past for some company but I am sorry DUE to NDA, I can't disclose you to exact implementation I have done there.. But I can tell you some way to achieve it.
#1 you can go to protocol level i.e. hook WinSock.dll to retrieve actual text coming and going through MSN messenger, as MSN messenger don't encrypt the Message before sending it.
This link will help: -
HOOKING WinSock DLL[^]
MSN Protocol[^]
#2 Try Searching MSDN site for MSN messenger Com API's
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
u got right what i have to do!!!!, it's my college final project that they gave to me in order to graduate in december
actually i coded a chat like app in java last semester and i was thinking there would be some way to listen to the traffic coming and going from the nic or modem in c++. i thought on doing that but i had the idea that the text would have some kind of encryption and it would be a problem to find out how to decode it.
i'll work on the material you recommended me since i still have about 6 weeks to finish it and i think it's enough time to code the project
THANKS!!!!
|
|
|
|
|
smargada wrote: THANKS!!!!
Mention Not! sorry not much of your HELP
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hello,
I need to be able to detect a user that could be logged into the machine - by which I mean:
1. NOT the user returned by GetUserName/Ex, because this returns who the current thread is running as, NOT the user that is logged in.
2. NOT by OpenProcess and OpenProcessToken, because this only works when the process doing this is running as NT AUTHORITY\SYSTEM
I am currently grabbing the module name of the shell that should be running, and searching for that process. I then use that process to try to figure out what user the shell is running as - this should let me know what user is logged in. I am currently trying to use GetKernelObjectSecurity on a process handle, and then using GetSecurityDescriptorOwner to get the SID. This seems to work nicely on Windows XP, but it gives different results in Windows 2000. In Windows XP, I usually get the actual user name that is running the process, but in Windows 2000, it often gives a group as the owner (such as BUILTIN\Administrators).
I also considered trying to grab the process's environment block and reading the USERNAME and USERDOMAIN environment variables from there. I could not find a way to do this.
I know this problem is solvable - Process Explorer does it, for example.
Any suggestions? Thank you for your time!
PS. Yes, this must be done using Win32 API/MFC, this can not use .Net stuff.
-- modified at 13:12 Monday 17th October, 2005
|
|
|
|
|
Xori wrote: I need to be able to detect a user that could be logged into the machine - by which I mean:
1. NOT the user returned by GetUserName/Ex, because this returns who the current thread is running as, NOT the user that is logged in.
How about NetWkstaUserGetInfo() ?
Xori wrote: I also considered trying to grab the process's environment block and reading the USERNAME and USERDOMAIN environment variables from there. I could not find a way to do this.
See here.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
NetWkstaUserGetInfo won't work for me because it must be called in the context of the currently logged on user. The code I am writing here maybe running as SYSTEM or as an administrator - and the administrator isn't necessarily the one that is logged on.
Thanks for the PEB information.
|
|
|
|
|
How about NetWkstaUserEnum() ?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|