Thanks for your replay , I didnt understand where is the calling to the method of object 2, if you can mark this section it will be helpfull for me. by the way I forgot to specify that I am using MFC but as I realized it doesnt matter. thanks
aangerma
Posts
-
Sending message between objects -
Sending message between objectsObject of a non dialog class
-
Sending message between objectsHello, I have a dialog that contains some radio buttons and a list box I wondered how can I pass a message to another object that the user chaghed his selection by press one of the redio buttons, I need to call to a method of the second object accordeing the user selction . thanks
-
Problem with owner drawn listbox and double bufferingHello, I created owner drawn listbox and I used double buffering for preventing flickering because I have a lot of data , the problem is that its don't present all the items and , whan I scroll it down and up its erases part of the items, the code is:
void HistDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
if(IDC_LIST1 ==nIDCtl)
{
int width=lpDrawItemStruct->rcItem.right-lpDrawItemStruct->rcItem.left;
int height=lpDrawItemStruct->rcItem.bottom-lpDrawItemStruct->rcItem.top;
HDC memDC1 = CreateCompatibleDC(lpDrawItemStruct->hDC);
HBITMAP hMemBmp = CreateCompatibleBitmap(lpDrawItemStruct->hDC,width , height);
HBITMAP hOldBmp = (HBITMAP)SelectObject(memDC1, hMemBmp);
CDC *memDC=CDC::FromHandle(memDC1);
memDC->FillSolidRect(0,0, width, height,RGB(255,255,255));int ODI\_length = 1 + SendDlgItemMessage(IDC\_LIST1, LB\_GETTEXTLEN, lpDrawItemStruct->itemID, 0); if (ODI\_length) { wchar\_t \*ODI\_wstr = NULL; ODI\_wstr = new wchar\_t\[ODI\_length\]; if (ODI\_wstr) { COLORREF ODI\_old\_text\_color; //get the string SendDlgItemMessage(IDC\_LIST1, LB\_GETTEXT, lpDrawItemStruct->itemID, (LPARAM)ODI\_wstr); memDC->DrawText(ODI\_wstr, ODI\_length - 1, &lpDrawItemStruct->rcItem, DT\_RIGHT); } } BitBlt(lpDrawItemStruct->hDC, 0, 0, width,height, memDC1, 0, 0, SRCCOPY); SelectObject(memDC1, hOldBmp); DeleteObject(hMemBmp); DeleteDC(memDC1); }
}
What doe's I'm doing wrong? thanks
-
CreateFile after CloseHandleThank you its solved my problem
-
CreateFile after CloseHandleits return ERROR_ACCESS_DENIED
-
CreateFile after CloseHandleHello, I have a problem , Whan I open a port by CreateFile(..) after closing it by CloseHandle(..) the CreateFile fails , I tried to do a Sleep(2000) before reopening its didnt help, on the first time that I am opening it, its succeed it fails just if I open it after closing it. And its happend only in my laptop that have windows 7, on the other computer that have windows XP its work fine. What can be the problem with reopening port after closing it? Thanks!!
-
Using Timer with non-dialog classCan you give me exmple how to write a messsage handler , I did it only with the class wizard of mfc, and this is the first time I need to add a timer to a class that don't connected to any window, even if I creat a fictive window like dialog box the SetTimer(...) works only if the dialog is opened by DoModal. thanks
-
Using Timer with non-dialog classThanks for the reply, can you give me more details how to use it? How can I know which message I Received by msg?
-
Using Timer with non-dialog classThanks a lot, As I understand I need to use SetTimer() and to give it an handle to window but the class is not connected to a dialog so what the hWnd that I need to pass?
-
Using Timer with non-dialog classThanks for the answer, But the operations that I need to perform on the timer shuld have an approach to the data members and member Functions of the class , can I do it with threads?
-
Using Timer with non-dialog classHello, I have a class that doesn't connect to a dialog or window and I need to do some operations on timer but the timers works only with dialogs , does anyone know another way I do it? thank
-
Dialog box focuscan you explain me what does it mean 'modeless dialog', and how can I change it? thanks
-
Dialog box focusthanks for the replay, I have a dialog that has a menu and clicking on the menu items causes to open other dialogs by DoModal(); The problem is that, while one dialog is opened the user can click other menu items and open more dialogs and its causes me a mess. How can I declare that the main dialog will be a parents of the other dialogs? thanks again
-
Dialog box focusHello, I am writing a program using VC++ with MFC, I added some dialog boxes and I want that once one of the dialog is opened by DoModal() all the buttons on the parent dialog will be disabled, How can I do it? thanks Avishag
-
Disable turning the screen offThe purpose of the system is that the nurse will be able to see the calls from distance, on screen that places on central place, if some one will change the settings of the computer the screen might turn off . thanks again.
-
Disable turning the screen offthank you for the reply, I need to desply on the monitor the calls from ills to nurse, I also uses sounds but I would prefere that the screen will be always on. thanks
-
Disable turning the screen offHello I would like to disable the outomatic turning off the screen, i.e. I want that the screen will always be on. I need that the project will be suitable also to windows xp accordingly, I can't use the function "RegisterPowerSettingNotification " . If anyone know another way to do it I would be glad if he can write it to me. thanks
-
Problem with RegisterPowerSettingNotification and USER32.dll.Thanks now its obvious why it didnt work.
-
Problem with RegisterPowerSettingNotification and USER32.dll.How can I know the version ? I only know that this is Windows xp professional. thanks