|
thanks for your answer. but the PostalAddresses property is supported on both providers (i use LDAP). you also get the E_ADS_PROPERTY_NOT_FOUND error when you try to get a value from a property which has no value yet. but i set the addresses value and so i don't know what's wrong.
|
|
|
|
|
I'm looking for a trick to catch ALL messages and windows events in an application.
I've already used SetWindowsHookEx() with WH_CALLWNDPROC or WH_GETMESSAGE (in dll of course..) but the application doesn't catch events from others windows!!
HELP!!
|
|
|
|
|
Hello, the codegurus around the world.
Try to check CWinApp::ProcessMessageFilter(...) function.
Accroding as MSDN library,
ProcessMessageFilter is only called for messages that are posted to the message queue and is not called for messages that are send directly to the window procedure. Therefore, this function cannot be used to monitor messages that are sent (by "Windows" or by the user) to a dialog box, message box, menu, or a scroll bar.
So, it seems that only one function will not work for your requirement.
HTH?
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
CRecordset::Update() return insertion failed for CString<255 and >65535 char into Mémo(MS Access Database.Why?? I use MDAC 2.6 and ODBC with dynaset.
Please, help me!
|
|
|
|
|
CRecordset::Update() return inserion failed for CString<255 and >65535 char into Mémo(MS Access Database.Why?? I use MDAC 2.6 and ODBC with dynaset.
Please, help me!
|
|
|
|
|
Dear all,
I am encountering a problem in calling this CListCtrl function, OnItemchanged.
Whenever there is a change in selection, this functions will run 3 times!!!
And, for the first time, the string got is " ", but at the second time, it shows the right string, then it is " " again for the third time. Can I know how does it happen for running 3 times?
This is just a testing code. Actually I want to call another function whenever a selection is moved to another one, how can I do this if this function cannot work?
void CTable::OnItemchangedtable(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
POSITION pos = m_table.GetFirstSelectedItemPosition();
int i = m_table.GetNextSelectedItem( pos );
CString cs = m_table.GetItemText(i, 0);
AfxMessageBox( cs);
*pResult = 0;
}
Thank you very much !!!
Regards,
Vickie
|
|
|
|
|
why dont u use the NM_CLICK message instead?
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Since my tools is for the Blind, can't use Mouse but only keyboard, i.e. up, down arrow or short-cut key instead.
|
|
|
|
|
I can't remember why there are 3 calls, but the first is to indicate that an item state is changing, selection state is being removed and the third is to indicate that an item state is changing, selection state is being set. I'm guessing that the second call is to provide access to the string and possibly change it prior to it being selected. Check further and I think you will find that the item for the first call is not the same item as the item for the subsequent second and third call.
Add the pNMListView pointer to the watch window and look at each of the member variables change for each of the three calls to the method. That might aid in your understanding of what is happening.
|
|
|
|
|
Thank you very much!!
I got how to do it now. It is to check the status of pNMListView->uNewState
and pNMListView->uOldState before operation as follow:
void CTable::OnItemchangedtable(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
UINT u = pNMListView->uNewState;
UINT n = pNMListView->uOldState;
if( u != 0 && n == 0 )
{
POSITION pos = m_table.GetFirstSelectedItemPosition();
int i = m_table.GetNextSelectedItem( pos );
CString cs = m_table.GetItemText(i, 0);
AfxMessageBox( cs);
}
*pResult = 0;
}
|
|
|
|
|
I'd like to use my VS_VERSION_INFO resource internally, to put copyright info and version numbers on my splash screen and 'About' dialog.
As far as I can tell I have to have my executable address it's own compiled file via either FindResource/LoadResource or GetFileVersion/VerQueryValue to get at this information.
Either way seems incredibly longwinded for something that (I would think) a lot of people would want to do.
Does anyone know an easy (easier?) way around this?
Cheers,
Dan
|
|
|
|
|
I am trying to add an event into the EventLog Viewer using
ReportEvent() .But it doesn't get added into the viewer?
Any ideas?
|
|
|
|
|
I am trying to add an event into the EventLog Viewer using
ReportEvent() .But it doesn't get added into the viewer?
Any ideas?
|
|
|
|
|
I have 1 exe which needs to call another exe, passing some data.
How best to call another exe within my first exe?
|
|
|
|
|
PROCESS_INFORMATION pInfo;
STARTUPINFO sInfo;
DWORD exitCode;
sInfo.cb = sizeof(STARTUPINFO);
sInfo.lpReserved = NULL;
sInfo.lpReserved2 = NULL;
sInfo.cbReserved2 = 0;
sInfo.lpDesktop = NULL;
sInfo.lpTitle = NULL;
sInfo.dwFlags = 0;
sInfo.dwX = 0;
sInfo.dwY = 0;
sInfo.dwFillAttribute = 0;
sInfo.wShowWindow = SW_SHOW;
if (!CreateProcess(NULL, "path\\second.exe",
NULL, NULL, FALSE, 0, NULL, NULL, &sInfo, &pInfo))
{
printf("ERROR: Cannot launch child process\n");
exit(1);
}
Cheers
|
|
|
|
|
I can think of three ways:
1) Use Shared memory
2) Passing a WM_DATA message to your rxing applications window (This also works for passing data between 16 & 32 bit apps).
3) Make the rxing exe a COM server.
What's your level of expertise?
Do you need more info or is this enough to get you started?
"You can lead a horse to water but a pencil has to be lead"
|
|
|
|
|
Oops, forgot to ask the obvious question (Just saw Prasanth's post )
Do you need to pass the data at application launch? (Prasanth's solution) or at run-time? (my suggestions)
|
|
|
|
|
I would like to see sample code on Prasanth's solution.
What if I need to pass an object, from 1 process to another. Is my object Thread-Safe or do I need to sync data?
I'm use to COM DLL's running under MTS & some connection points experience.
Cheers for all the help!
Gerry.
|
|
|
|
|
Hi Gerry, I need to know a few more things to be able to help.
Re: I would like to see sample code on Prasanth's solution.
It's there in his post. Prasanth is spawning a process from another process. Is this what you want to do?
Re: What if I need to pass an object, from 1 process to another.
C++ object?
COM object?
OS handle object?
Binary data 'object'?
Other(?)
Do you pass the object at from one process to the other when the second process is started?
or..
Do you pass the object when the second process is already running?
Re: Is my object Thread-Safe or do I need to sync data?
Depends on the object (See last comment) and on what you intend to do with it.
If you can describe what exactly you want to do, I will be hopefully be able to give you some better advice.
|
|
|
|
|
It's a C++ object. I want to learn more about Calling another Exe from my main exe, then letting it carry out some task, & then returning.
I would passbyref the object when the second process kicked off.
Not sure to create a new process or spawn another Thread & sync the data. Multi-threaded.
Cheers for everything.
Gerry.
|
|
|
|
|
OK, that's clearer.
If you call into another process from another process, you have two address spaces.
What this means in reality is this. You have a pointer to an area of memory (a C++ object for example). This pointer has a physical address, say 0x1000000 which is meaningful *only* in the address space it is created in. So if you have a separate process to which you pass this C++ object pointer to and try to de-reference it, then it will not point to the object you want.
This is why you need the shared-memory approach.
Of course, you have to come up with a way of calling a function in another process first using some form of IPC. (Into the realms of COM here).
In fact, that's what COM out-of-process servers are designed for.
NOTE: You can expose the C++ object as shared memory between two processes, but you still have to thread synch because two threads are (potentially) using the same memory concurrently.
If you want to create a separate thread in the same process then pass a C++ object by reference (pointer) then that's the simpler solution. You still have to synch access on the data (the C++ object's methods and attributes) though.
My advice, do the in-process (two threads in same address space) approach first, with thread synchronisation, then migrate the code to calling cross-process later.
|
|
|
|
|
Cheers Mick,
That makes everything clearer. I appreciate all the advice you have given me.
I'm going out to buy Advanced Windows for NT, J. Richter...I think it has great coverage of processes & threads..
Thanks.
Gerry.
|
|
|
|
|
I want to make a control that like a Grid that can provide the function of
setting columns and rows, changing selection by just pressing up, down, left
or right arrow keys. Is that the CListCtrl can do so?
Thanks !
Vickie
|
|
|
|
|
check out the mfc grid control here on codeproject ... its way cool
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Hi,
Can I replace a record in a databse through ADO knowing only the index o the record to be replaced?
|
|
|
|