|
This is from MSDN
"Quote"
FIX: The CDialog::Create() function returns an incorrect value when a dialog box is created in Visual C++
View products that this article applies to.
This article was previously published under Q193099
"Unquote"
Sample:
// Create a modeless dialog box. In this example, m_pModeless is a
// member variable of type CModeless where CModeless is a CDialog-
// derived class. IDD_MODELESS is the ID number of a dialog-box template
// resource.
m_pModeless = new CModeless;
if (m_pModeless->Create(IDD_MODELESS, this) && ::IsWindow(m_pModeless->m_hWnd))
{
// ... succeeded in dialog-box creation.
}
else
{
// ... failed in dialog-box creation.
}
Once again from MSDN.
For me personally. I have always created the dialog box first, tested it as a modal dialog and then made it modeless by creating it as follows:
LogonDlg* pDlg = new LogonDlg;
// create it if necessary
LogonDlg * pApp = (LogonDlg*)AfxGetApp()->m_pMainWnd;
if (pApp->m_hWnd == NULL && !pApp->Create(LogonDlg::IDD))
{
CTraceLog::TraceMsg( "InitInstance failed to create LogonDlg" );
return FALSE;
}
pApp->SetVisibility( SW_HIDE );
|
|
|
|
|
hi!
i have made a dialog based(windowed) mfc activex control ,i want to make it transparent and again retain the previous state according to user choice.kindly help me.
thanx in advance
|
|
|
|
|
What do you mean make it transparent?
|
|
|
|
|
To make it transparent means to hide the dialog when required and unhide it(show it back)as required.
|
|
|
|
|
The way to do this is to use:
::ShowWindow( SW_HIDE or SW_SHOW )
Usually one would add a method to the control as:
BOOL LogonDlg::SetVisibility( int nCmd )
{
BOOL bRet = ShowWindow( nCmd );
if( nCmd == SW_SHOW )
SetForegroundWindow();
return bRet;
}
|
|
|
|
|
::ShowWindow( SW_HIDE or SW_SHOW )
hides and show the control not the dialog.
please tell me how to do it for a dialog.
if u have done it by ::ShowWindow( SW_HIDE or SW_SHOW ) then kindly tell the detailed code of it.
|
|
|
|
|
The ShowWindow API can be used inside any dialog. There is no more to it than just that. It is usually made a part of a method which also includes the SetForegroundWindow but that is all. Experiment with it. Its the only way to become familiar with something.
As for the theory:
A modeless dialog is a window that has no exclusive rights to system resources such as the cursor. It can remain on the desktop in a hidden state while the rest of the control is active and busy with other things and can be hidden and brought to the foreground at will.
I think that in your case the control is only a dialog and that is why you perceive the control to be hidden and shown. That is not true. The control cannot be hidden because running code does not subscribe to the concept of being hidden etc. Only a GUI element can go through these states and that is what ShowWindow is designed for.
|
|
|
|
|
I want to load an array and print the array using pointer. But I can't do it with the program below whose output is also provided...
#include<stdio.h>
#include<conio.h>
void main()
{
int a[2][2],i,j,m,n,**p;
clrscr();
printf("\nEnter the order:");
scanf("%d%d",&m,&n);
printf("\nEnter the elements:\n");
for(i=0;i
|
|
|
|
|
Please, use the 'code block' button to surround your code snippet with <pre> tags, since, as you may see, your code, as it stands, is unreadable.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi apart from that I can not read your code either, I would guess you are going on past end over your array ( see the output of the strange numbers) .
So either fix your post, or you try to find the line where you ran over the border.
Cheers
You have the thought that modern physics just relay on assumptions, that somehow depends on a smile of a cat, which isn’t there.( Albert Einstein)
|
|
|
|
|
Gjm wrote: I want to load an array and print the array using pointer.
Are you wanting something like this:
void main( void )
{
int a[2][2],i,j,m,n,*p;
printf("\nEnter the order:");
scanf("%d%d", &m, &n);
printf("\nEnter the elements:\n");
for (i = 0; i < m; i++)
{
for (j = 0; j < n; j++)
{
scanf("%d", &a[i][j]);
}
}
p = a[0];
printf("\n\nThe elements are:\n");
for (i = 0; i < m; i++)
{
printf("%d\n", *(p + i));
}
}
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
|
can you explain ur problem in more detail,
like how u are opening one port etc..
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
|
did u try to call openport two times with two different ids?
modified on Monday, June 22, 2009 7:20 AM
|
|
|
|
|
|
jitendrapothuru wrote: hCommn = NULL;
Of course, if you only have one single handler for all your COM ports, this is not going to work. You have to use one handler for each of the COM port you want to open...
|
|
|
|
|
|
jitendrapothuru wrote: so should i have multiple handlers for multiple comports to be opened then....
hCommn= NULL is jus only initialisation na...
Is there something missing in your sentence, because I don't understand it at all ??
Anyway, are you using mutliple instances of your class or only one instance ? If you are using multiple instances of the class then it's fine but if you are using only one instance, you will "share" the handle for all COM ports, which won't work.
Later on, how are you accessing the COM port ? Please post some useful code...
|
|
|
|
|
|
So, for my other question: how many instances of the class did you create ? Show the code where you create the class.
And please use the pre tags when posting code snippets because it is almost impossible to read now...
|
|
|
|
|
|
Which class are we talking about from the start of this discussion ?
CCommnCtrl of course, the one where all your code to access your COM port is...
|
|
|
|
|
|
jitendrapothuru wrote: this is the class to open the port and i have created only one instance of the class
So, you have multiple ports but you only create one instance of the class, which means you only have one single COM handle. So, you'll only be able to access the last opened port.
If you want to manipulate multiple COM ports, you have to create one instance of the class for each COM port you want to access and use all of these instances to access the different ports (one instance of the class relates to one single COM port).
|
|
|
|