|
Hey i have faced the same problem and got the solution over this.
univega_r304 wrote: If I delete the control, everything works fine again and the dialog box will once again appear.
Call the Following Method to enable the custom containers in the application where you are using the custom controls
AfxEnableControlContainer();
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
How do I get user input from a toolbar embedded in a CMDIFrameWnd, to a control in a Cdialog called by a CView?
Ideally, I would like to open the dialog modal, then take the mouse out of the dialog to click on a button in the toolbar, thereby updating a control in the dialog according to which button was clicked on the toolbar.
I presume I need to make the dialog modeless, then somehow disable all other windows except the toolbar. Is that the best way, and if so can you please point me to ways to do that? Otherwise, can I somehow activate the toolbar from the modal dialog when the mouse gets over the toolbar, or gets clicked in the toolbar?
Thanks, Chris.
|
|
|
|
|
Hi Chris,
U can get the parent window from dialog and convert into appropriate class and get tool bar -> get the status . or else
declare a pointer in the mainframe class to ur dialog . send notification any changes in the Tool bar event.
|
|
|
|
|
Thankyou Kiran
But I remain confused! Currently, ny dialog is modal, so as I understand it, when it is open, the toolbar will not get any messages. I am happy to make the dialog modeless, but if I do, how do I fake modal behaviour? I can see how to disable the parent window, but I want the toolbar to be able to get mouse clicks so I can use it to enter data into the dialog. Thanks, Chris.
|
|
|
|
|
I have a problem where my toolbars automatically get stacked on top of each other on the upper left side of my app.
These are the steps that cause the problem:
1. User starts analysis process with toolbars set to his/her liking
2. Analysis process runs with modeless progress dialog (counter)
3. User minimizes app window before analysis ends
4. Analysis runs to completion while app window is minimized
5. User restores app window - toolbars show up stacked on the upper left side
The problem does not occur if the app window is restored before the end of the analysis. It also does not occur if the app window is in the background of another window (instead of minimized). So it only occurs when the analysis completion & progress dialog termination occur while minimized.
Any help is greatly appreciated. Thanks,
Victor
|
|
|
|
|
Hi:
Im using GDI to draw some images on a window.
The images vary according to the lParam I pass to the Window Procedure of the DialogBox.
The problem is:
when I draw more than one window, the procedure applies to ALL of the Dialogs that I could have opened.
This is a real problem, because the windows MUST maintain the info after another appears, but it doesn´t. What did i do wrong?
BOOL CALLBACK AlertaDlg(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
(...) //a lot of Variable Declarations
switch(msg)
{
case WM_INITDIALOG:
desfasex=5*num_alarmas;
desfasey=5*num_alarmas;
BringWindowToTop(hwnd);
SetActiveWindow(hwnd);
hwndOwner = GetDesktopWindow();
GetWindowRect(hwndOwner, &rcOwner);
GetWindowRect(hwnd, &rcDlg);
CopyRect(&rc, &rcOwner);
OffsetRect(&rcDlg, -rcDlg.left, -rcDlg.top);
OffsetRect(&rc, -rc.left, -rc.top);
OffsetRect(&rc, -rcDlg.right, -rcDlg.bottom);
sprintf(cuadro,"--");
mapset=FALSE;
planta=-1;
/*
Here i catch the info of the LPARAM, is a struct with some info about the drawings.
*/
if(lParam!=0)
{
msg_params=(msg_param *)lParam;
if (strlen(msg_params->cuadro)>0)
{
ptpuerta.x=msg_params->ptpuerta.x;
ptpuerta.y=msg_params->ptpuerta.y;
sprintf(cuadro,"%s",msg_params->cuadro);
mapset=(msg_params->mapa==1);
img_cuadro=msg_params->img_cuadro;
planta=msg_params->planta;
}
}
SetWindowPos(hwnd,HWND_TOP,(rc.right / 2)+desfasex,rcOwner.top + (rc.bottom / 2)+desfasey,0, 0, SWP_NOSIZE);
num_alarmas++;
return 0;
case WM_PAINT:
hbmp_alarma=(HBITMAP)LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_ALERTA));
hbrush=CreateSolidBrush(RGB(255,0,0));
hwndItem=hwnd;
hDC = BeginPaint(hwndItem, &ps);
memHDC= CreateCompatibleDC(hDC);
SelectObject(memHDC, hbmp_alarma);
BitBlt(
hDC, //HDC hdcDest, // manipulador del contexto de dispositivo destino
10, //int nXDest, // coordenada x de la esquina superior izquierda del rectángulo de destino
10, //int nYDest, // coordenada y de la esquina superior izquierda del rectángulo de destino
600, //int nWidth, // anchura del rectángulo de destino
400, //int nHeight, // altura del rectángulo de destino
memHDC, //HDC hdcSrc, // manipulador de contexto de dispositivo de origen
0, //int nXSrc, // coordenada x de la esquina superior izquierda del rectángulo de origen
0, //int nYSrc, // coordenada y de la esquina superior izquierda del rectángulo de origen //para cliping
SRCCOPY //DWORD dwRop // código de operación de rastreo
);
switch(planta)
{
case 1:
hPlanta=(HBITMAP)LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_PLANTA1));
break;
case 2:
hPlanta=(HBITMAP)LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_PLANTA2));
break;
case 3:
hPlanta=(HBITMAP)LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_PLANTA3));
break;
default:
hPlanta=(HBITMAP)LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_PLANTA1));
break;
}
switch(img_cuadro)
{
case 1:
hCuadro=(HBITMAP)LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_CUADRO1));
break;
case 2:
hCuadro=(HBITMAP)LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_LAVANDERA));
break;
default:
hCuadro=(HBITMAP)LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_CUADRO1));
break;
}
if (mapset==true)
{
//------------------------------------------- CUADRO
SelectObject(memHDC, hPlanta);
SetStretchBltMode(
hDC, // handle to DC
COLORONCOLOR // bitmap stretching mode
);
x=130;
y=90;
StretchBlt(
hDC,
0+x,
0+y,
240,
180,
memHDC,
0,
0,
400,
250,
SRCCOPY);
//------------------------------------------- MAPA
SelectObject(memHDC, hCuadro);
SetStretchBltMode(
hDC, // handle to DC
COLORONCOLOR // bitmap stretching mode
);
x=130+240;
y=90;
StretchBlt(
hDC,
x+0,
y+0,
320,
240,
memHDC,
0,
0,
320,
240,
SRCCOPY);
SelectObject(hDC,hbrush);
Rectangle(hDC,ptpuerta.x-5,ptpuerta.y-5,ptpuerta.x+5,ptpuerta.y+5);
txt_coord.x=150;
txt_coord.y=290;
}
else
{
txt_coord.x=150;
txt_coord.y=90;
}
SetBkMode(hDC, TRANSPARENT);
SetTextColor(hDC, RGB(100,100,120));
SelectObject(hDC,hfuente);
GetTextMetrics(hDC,&lptextmetrics); //recibimos sus valores en lbtextmetrics
sprintf(s,"OBRA:");
TextOut(hDC, txt_coord.x, txt_coord.y+lptextmetrics.tmHeight, s,strlen(s));
SelectObject(hDC,hfuenteItalica);
SetTextColor(hDC, RGB(100,100,120));
sprintf(s,"%s",cuadro);
TextOut(hDC, txt_coord.x, txt_coord.y+lptextmetrics.tmHeight*2, s,strlen(s));
EndPaint(hwndItem, &ps);
ReleaseDC(hwnd, hDC);
DeleteDC(memHDC);
DeleteObject(hCuadro);
DeleteObject(hPlanta);
DeleteObject(hbmp_alarma);
DeleteObject(hbrush);
return 0;
case WM_CREATE:
sprintf(cuadro,"--");
Sleep(10);
UpdateWindow(hwnd);
return 0;
case WM_CLOSE:
case WM_COMMAND:
num_alarmas--;
EndDialog(hwnd,0);
return 0;
}
return 0;
}
Thanks
|
|
|
|
|
I'm relatively new to C/C++ and had small question on pointers. Its like this:
int* p;<br />
int q;<br />
q = 15;<br />
p = &q;<br />
*p = 22;
With the above, i would have the value of 22 in the memory location inside p. Right? i guess so. I had to put an asterix before the p to set the value to 22.
Now see this,
struct node<br />
{<br />
int data;<br />
struct node* next;<br />
};<br />
<br />
struct node* newNode = malloc(sizeof(struct node));<br />
newNode->data = 15;
Now why is it that i dont have to put an asterix before newNode when i set the value of data to 15 (in the last line).
|
|
|
|
|
Mridang Agarwal wrote: Now why is it that i dont have to put an asterix before newNode when i set the value of data to 15 (in the last line).
Because you access a member variable of newNode with the arrow ( -> ). This member variable is not a pointer but an integer, so you have to treat it like a normal integer.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
Because the -> operator works on pointer variables.
Writing
newNode->data = 15;
is equivalent to (and a shorthand of)
(*newNode).data = 15;
Cheers
Steen.
"To claim that computer games influence children is ridiculous. 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"
|
|
|
|
|
Mridang Agarwal wrote: struct node* newNode = malloc(sizeof(struct node));
First of all the malloc requires typecasting to get correct pointer,
because malloc return void pointer.
The correct way is
struct node* newNode = (struct node*)malloc(sizeof(struct node));
Mridang Agarwal wrote: why is it that i dont have to put an asterix before newNode
As it is pointer.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
got it! thanks everyone. You guys really helped clear my head out.
|
|
|
|
|
Hi !!!
struct node
{
int data;
struct node* next;
};
struct node* newNode = malloc(sizeof(struct node));
newNode->data = 15;
Here you don't have to put the asterisk, because you have created an instance of the struct node and the integer variable data is not a pointer, so you don't have to and you are not allowed to put the asterisk before.
By.
-:KNOX:-
|
|
|
|
|
Hi,
I want to access some global variables from a DLL from another application in VC6. Is it possible ? I have tried but not successful.
Cyber Friend
|
|
|
|
|
Cyber Friend wrote: I want to access some global variables from a DLL from another application in VC6. Is it possible ? I have tried but not successful.
declare the variable in .h of DLL as
extern _cdecl __declspec(dllexport) int humm;
define the variable in .cpp file of DLL as
extern _cdecl __declspec(dllexport) int humm=0;
_cdecl ensures that the variable/function declared as C Style avoids mangling by C++ compiler.
Knock out 't' from can't,
You can if you think you can
-- modified at 10:03 Friday 19th May, 2006
|
|
|
|
|
|
Hi Steen,
I dont want to share data between two processes using dll. All I want to do is that, in dll I want to put some global variables and in other application I want to access these global variables. Is it possible as replied by the other guy.
Regards
CyberFriend
|
|
|
|
|
|
What do you mean by "other application"? If it's another program, then you want to share data between processes. If it's another module within your program you can do as A_Laxman wrote.
Cheers
Steen.
"To claim that computer games influence children is ridiculous. 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"
|
|
|
|
|
A_Laxman wrote: define the variable in .cpp file of DLL as
extern _cdecl __declspec(dllexport) int humm=0;
Why extern in definition...?
Nibu thomas
Software Developer
Faqs by Michael dunn
|
|
|
|
|
maybe it is some helpful to you
Here[^]
whitesky
|
|
|
|
|
Have you tried exporting functions to Set and Get the variable ?
|
|
|
|
|
Hi,
I want to display information stored in my database, that is only available for a user. I can use GetCurrentUser() to get the name of the currently logged in user, but I want to read other users to read their data without completey logging off and on again.
I have a dialogbox to ask the user for a username and the corresponding password.
Now I want to check, if this is the correct password for the user, asking my domain controller in my ADS.
Any hints?
Juergen
|
|
|
|
|
e-DJ wrote:
I have a dialogbox to ask the user for a username and the corresponding password.
Now I want to check, if this is the correct password for the user, asking my domain controller in my ADS.
see the LogonUser security API
The LogonUser function attempts to log a user on to the local computer, that is, to the computer from which LogonUser was called.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
e-DJ wrote: Now I want to check, if this is the correct password for the user, asking my domain controller in my ADS.
Can you use LogonUser() for this?
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
Nice to see you here:
Check for LogonUser()
Regards.
|
|
|
|
|