|
How can I, from a dll, get the text in an edit control on my main app. In the dll I have the HWND of the edit control.
I tried
::GetWindowText(hWndEdit, buffer, _MAX_PATH); didn't work
so I tried
::SendMessage(hWndEdit, WM_GETTEXT, _MAX_PATH, (LPARAM)buffer);
still no luck
There must be a way to do this, but I can't seem to find it.
---
Blessed are those who can laugh at themselves, for they shall never cease to be amused ![Laugh | :laugh:](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_laugh.gif)
|
|
|
|
|
Hi,
I would like to transmit very simple data (like two integers) between two applications through a dll. I use a shared data segment to store the data. One application writes the data and the other reads it. The problem is the following:
The application which reads the data has to do some sort of polling to check if new data has arrived and this is too slow. Isn't there a simple way to install a callback mechanism (please as simple as possible... I'm not a programming guru (and "memory mapped file" makes me afraid ))
Thanks for your help
|
|
|
|
|
I would use a registered windows message to relay the sync info. Register a message in each of your applications (a GUID is a very good name to use for the message). After one app updates the shared info it broadcasts the registrered message (PostMessage with NULL HWND). In the recieving app your respond to the registered message and read the shared data.
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
...hope that is as easy at it sounds ![Wink | ;)](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_wink.gif)
|
|
|
|
|
This should be a simple question.
I have set up a global hook using the WH_GETMESSAGE flag (no problem there). After I have processed the message in my hook function, how do I remove it from the message queue so that it not processed by the application
(The message is a WM_KEYDOWN message trapping the VK_UP and VK_DOWN keys).
---
Blessed are those who can laugh at themselves, for they shall never cease to be amused ![Laugh | :laugh:](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_laugh.gif)
|
|
|
|
|
I think you might need to use WH_KEYBOARD.
From "INFO: Importance of Calling DefHookProc()" in the MSDN:
<snip>
"Only a keyboard hook (WH_KEYBOARD) can suppress a keyboard event by not calling DefHookProc() and returning a 1. When the system gets a value of 1 from a keyboard hook callback function, it discards the message. "
</snip>
oops - wrong snip! - the above was for win 3.0
"For Win32, mouse and keyboard hooks can suppress messages by return value and do not have to call CallNextHookEx(), unless they want to pass the message on. Other hooks, like WH_CALLWNDPROC, don't need to call CallNextHookEx(), because it will be called by the system. However, all hooks should call CallNextHookEx() immediately if nCode<0."
Someday I hope to be able to get a post right on the first attempt! ![Smile | :)](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
Hi all,
My source code won't work, what is my wrong ?
My database is Access 2000.
pApp->pConnection->Open(_bstr_t("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Server.mdb;"), _bstr_t(""), _bstr_t(""), adConnectUnspecified);
pApp->pRecordsetACTION->Open(_variant_t(_bstr_t("SELECT * FROM ACTION")), pApp->pConnection.GetInterfacePtr(), adOpenDynamic, adLockOptimistic, adCmdText);
Help me !!!
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
When you say it won't work, what does it do ? What errors do your connection object contain ( they are flags in the object ) ? Are both pointers OK ?
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Hi Christian ...
My source code haven't error in compiling ...
But when my program want to run, have crash !!!
My English is VERY BAD, sorry
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
My English is VERY BAD, sorry
That's fine, I'm sure it's better than if I was trying to speak whatever your first language is
I had a LOT of trouble with ADO because it crashes whenever you get ANYTHING wrong in the strings you pass in. These should always be in a try/catch, and you should try to get error info if you can. Either way, you should trace into the program to see which command is crashing, and use the debugger to verify that the two pointers are OK. Also, if you type err, hr into the variable watch window, it will show the HRESULT returned by your last COM call ( ADO being a COM object ).
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Thanks for your advices
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I think you should try to set the CursorLocation of the Recordset to adUseClient because
a Access Database does not work correct with CursorLocation adUseServer !
pApp->pRecordsetACTION->CursorLocation = adUseClient;
pApp->pRecordsetACTION->Open(_variant_t(_bstr_t("SELECT * FROM ACTION")), pApp
->pConnection.GetInterfacePtr(), adOpenDynamic, adLockOptimistic, adCmdText);
Greetings Hiasi ! ![Smile | :)](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
Thanks for your help !
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hi,
When you create a new Multi Document MFC app, compile and run it a child window immediately appears in the main window. Where is the best place to stop this from happening?
Thanks,
Jim
|
|
|
|
|
For a quick try, comment these lines in ::InitInstance() of your application class:
Hope this helps.
// Fazlul
Get RadVC today! Play RAD in VC++
http://www.capitolsoft.com
|
|
|
|
|
Hi,
Commenting out the command line dispatch may be a little to invasive. Instead leave Fazlul's code uncommented and place this above it:
if(cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew) cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
-Kevin
|
|
|
|
|
I agree, this is a better solution.
Thanks.
// Fazlul
|
|
|
|
|
Hi to all !!!
I'm currently trying to code a Winsock server application. I'm using the main process thread to listen to incoming connection. When a connection is detected (i'm using WSAAsyncSelect) i spawn a new UI thread that will process that connection. I do not want a window to appear but i'm creating a dummy window because I need the message map...
But the problem i'm having right now is that the messages for the WSAAsyncSelect goes to the dummy window and not to the UI thread message map...
Here is how I create the dummy window...
//-------------------------------------------------
bool CConnection::InitDummyWnd(void)
{
m_pDummyDlg = new CDummyDlg;
if (!m_pDummyDlg->Create(IDD_DUMMY, NULL))
return false;
m_pMainWnd = (CWnd *)m_pDummyDlg;
m_pMainWnd->SubclassWindow(m_pDummyDlg->GetSafeHwnd());
m_pMainWnd->ShowWindow(SW_SHOW);
return true;
}
bool CConnection::PrepareWSAAsync(void)
{
if (WSAAsyncSelect(m_sock.getSocket(), m_pMainWnd->GetSafeHwnd(), WSA_THREADSOCKETEVENT,
FD_READ | FD_WRITE | FD_CLOSE) == SOCKET_ERROR)
{
WORD err = WSAGetLastError();
return false;
}
return true;
}
//------------------------------------------------------------
How can I make sure that the thread message map gets all the winsock message instead of the dummy window message map ???
Thanks for any advice !
Luc B.
|
|
|
|
|
It is the call WSAAsyncSelect(m_sock.getSocket(), m_pMainWnd->GetSafeHwnd(),...) that is telling Winsock to send notifications to your dummy window. The problem is that WSAAsyncSelect needs a valid HWND to send the notifications to. One workaround for this is having PreTranslateMessage overriden so that it intercepts messages intended to the dummy window from Winsock, like this:
BOOL CConection::PreTranslateMessage(MSG *pMsg)
{
if(pMsg->message==WSA_THREADSOCKETEVENT){
pMsg->hwnd=0;
}
return 0;
} Haven't checked it out myself, so it'd be great if you tell us back whether this works.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Nope doesn't work. My CConnection::PreTranslateMessage never gets called !?!?!
|
|
|
|
|
Hmmm... Do you mean CConnection::PreTranslateMessage never ever gets called (for this or for any other message) and yet the Winsock messages make their way to the dummy window message map? At least some standard messages delivered to the dummy window upon creation should go across PreTranslateMessage .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
How can I find out what the color of the desktop icons' text is? It looks like GetSysColor won't do it. Any help is greatly appreciated.
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
The icon text color appears to be derived from the desktop background color. I think it's either black or white, depending on the desktop background.
/ravi
"There's always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
But how do I find out if its black or white? Also, there is a utility called SetTextColor made by Pact Software www.12ghosts.com which says they send a message to the desktop telling it to change the icon text color...how do they do that? Thanks.
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
Do you know how to get the hue/luminance of a color? That is what its based on. Thanks.
Bret Faller
Odyssey Computing, Inc.
|
|
|
|