|
|
I have a CSocket object that I need to share between two threads in two different objects (one thread in each object). I am using a Console App that supports MFC using VC++ 6.0.
I create the CSocket object in the 'main' function of the console app and then pass a pointer to the CSocket into the 2 objects. I then fire up the threads in the two objects.
When I try to perform a 'Receive' call on the CSocket in the thread, I get an assertion error. The line that crashes is 'ASSERT(pState->m_hSocketWindow != NULL)' found in 'CSocket::PumpMessages()'. I checked the pointer value of the CSocket and it matches the CSocket object that was created in the 'main'.
I know there are certain MFC objects that cannot be shared across thread boundaries - is the CSocket one of them?
Thanks!
|
|
|
|
|
take a look at this ^
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Thanks a lot! That's exactly what I needed to know!
|
|
|
|
|
I have created several layers of dialog boxes using MFC C++ .Net. However, I do not want to automatically go back to calling dialog when I hit return anywhere in the active dialog. I want to just be able to click on OK button to do this.
I have set the OK button as not the Default button, but clicking anywhere in Dialog box still always closes the active Dialog Box and goes back to calling Dialog box. Is there a fix?
|
|
|
|
|
Override the OnOK function in your dialog and do not call CDialog::OnOK in your override. The CDialog::OnOK function is automatically called when you hit the enter key unless your dialogs override it.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
I thought so too but he indicated that it happens with a click (of the mouse), rather than the pressing of a key.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
This is a subdialog.. Called by another dialog box. This happens on hitting the return/enter key,not by the click of a mouse.
|
|
|
|
|
Adding a visible blank button as default button and then prescribing an OnOK button works.
Thanks all.
|
|
|
|
|
For future reference...
Shog9
I'm not the Jack of Diamonds... I'm not the six of spades.
I don't know what you thought; I'm not your astronaut...
|
|
|
|
|
I took a wild guess base on his reference to the enter key in the previous sentence
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
Smart guy.
Reminds me of those word problems i used to get in math as a kid... the ones where they start out by giving you 20 specific details, most of which are confusing or wrong, but only a couple of which are actually relevant.
Shog9
I'm not the Jack of Diamonds... I'm not the six of spades.
I don't know what you thought; I'm not your astronaut...
|
|
|
|
|
Stop calling EndDialog() in your OnLButtonDown() method...
Ok, that might not be exactly what's happening. But dialogs don't normally close when you click on them, so you've done something to alter that. Dialogs normally close when they recieve a command message with the IDOK or IDCANCEL, an Enter or Escape keypress, or a WM_CLOSE message... be sure you know where all these can come from before moving on.
Shog9
I'm not the Jack of Diamonds... I'm not the six of spades.
I don't know what you thought; I'm not your astronaut...
|
|
|
|
|
Actually I didn't do this. However I solved problem by putting in a visible "do nothing" buttonand defining the OK button in the code. This works. I have a deadline so I will look to see what bug actually is when I submit project.
Thanks for such quick replies!!!!
|
|
|
|
|
I'm using a GSM/GPRS modem and some times (don't know why) it gets dumb, only de carrier detect and the power leds are on, and i can't do ping. The only way to solve this problem is unpluging the prower cord but this will not be posible because it will work on an unattended PC, so.... i think if i reset the modem i'll work again but how do i reset the thing? AT commands or win32 API? any advice? thanx in advance, everybody
"I don't want to achieve immortality through my work... I want to achieve it through not dying."
Woody Allen
|
|
|
|
|
I had a motorola phone that worked the same way, and if I looked in my modem properties i saw that it took a com port. So i suggest that you open the port using createfile and write an AT reset command to it.
Good luck.
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
I am doing a number plate recognition system, i am having great difficulty with the segmentation of the characters, there are loads of papers out there but not much code im currently using visual c++ but could use java as a back end any one any ideas????
|
|
|
|
|
hi,
On my application, i have many Lock and Unlock operations that slowdown a performance. How can I minimise it?
Thanks.
|
|
|
|
|
That depends a lot upon the architecture and purpose of the application. Generally speaking, I would see if the locking could be made more granular and if I could partition the data in such a way that locking is reduced to just the data that I want to update, rather than the entire list/table/array etc. Also, I would see if I could use critical sections, rather than kernel object locks like mutexes, semaphores.
However, without an understanding of what your app does, these suggestions are purely general and may be wrong.
onwards and upwards...
|
|
|
|
|
I assume you are talking about locking and unlocking in the ciontext of a database. Yes? Is it optimistic or pessimistic? Pessimistic locking will have a potential performance penalty in a multiuser environment, since concurrent access to the same record may have to wait until completion of the application’s update process.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hello,
I have PropertySheet with 11 PropertySheet pages. The proprtysheet has style - PSH_WIZARD97.
In this scenario I have individual dilaog procedures for each page in the wizard. The dialogs are designed using VC dialog editor and I have given them a caption using the dialog editor only.
Now I want to change the caption of that dialog dynamically. So in the WM_INITDIALOG, I am having a function call:
SetWindowText ( GetParent(hwnd), "Some header" );
If I do this then dialog caption changes for the first time the page is activated but then if I do {next} or {back} and come back to the same page, the title gets changed to the one that I provided in the dialog editor?
I have even tried the same thing in PSN_SETACTIVE: event without any help.
How can I always change the title?
Regards,
Ritesh
|
|
|
|
|
akhildhanuka wrote:
Now I want to change the caption of that dialog dynamically. So in the WM_INITDIALOG, I am having a function call:
SetWindowText ( GetParent(hwnd), "Some header" );
So I'm confused, are you trying to change the title on the prop sheet dialog? Are you doing this in the OnInitDlg of your parent app?
The reason I ask is that if you are doing this in the prop sheet shold you not be passing the handle of the prop sheet dialog to SetWindowText to change the title?
Here is what MSDN says:
hWnd
[in] Handle to the window or control whose text is to be changed.
Hope this helps
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
I am creating the wizard as suggested at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/CommCtls/PropSheet/wizards.asp
So lets say - i want to change the title of on of the page during runtime e.g. IntPage1DlgProc(...)
BOOL CALLBACK IntPage1DlgProc (
HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA)
GetWindowLong(hwndDlg, GWL_USERDATA);
switch (uMsg)
{
case WM_INITDIALOG :
{
pdata = (LPSHAREDWIZDATA)
((LPPROPSHEETPAGE) lParam) ->
lParam;
SetWindowLong(hwndDlg, GWL_USERDATA,
(DWORD_PTR)pdata);
SetWindowText ( hwndDlg, "XXX" );
break;
}
does not work and the title remains same as one provided using resource editor.
I want to change it dynamically.
|
|
|
|
|
You need to postmessage in PSN_SETACTIVE and use
SetWindowText ( GetParent ( hwnd ), "your text" );
|
|
|
|
|
Hi:
which is the easiest way to insert a little image (maybe a BMP 30x30 pixels) in specific coordinates (x, y) into a view?
Thanks.
|
|
|
|