|
srimayank11_codeproject wrote: Kindly help me out by sending tips and useful codes.
Using Buttons (Windows Explorer and Controls)[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi,
I am moving from C# to VC++ to test to see if it will meet my timing requirements.
I am not familiar with VC++.
I want to add an ActiveX control that fills a dialog box. So the size of the control will always match the size of the dialog when it is resized. This is easily done in C# .NET using the Anchor property.
How can I do this in VC++? Can it be done by setting properties or do I have to create extra code to achive this?
By the way I am using Visual Studio 2003 to create my code for an MFC application.
Thanks,
Liam
|
|
|
|
|
I think you will need to handle the WM_SIZE message:
void CTheDialog::OnSize(...)<br />
{<br />
CRect rect;<br />
GetClientRect(&rect);<br />
m_Control.MoveWindow(&rect);<br />
}
Now the control will completely occupy the client area of the dialog.
this is this.
|
|
|
|
|
Khan++, thanks for the reply this worked for a while now it is failing an assertion:
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\src\mfc\winocc.cpp
void CWnd::MoveWindow(int x, int y, int nWidth, int nHeight, BOOL bRepaint)
{
ASSERT(::IsWindow(m_hWnd) || (m_pCtrlSite != NULL));
...
Can you explain why this is?
Also I would like to be able to have a fixed offset from a border. Can this be done easily.
Thanks
|
|
|
|
|
You will need to set a boolean variable at class level:
BOOL m_bInitialized;
And initialize it to FALSE in the constructor.
m_bInitialized = FALSE;
And set it to TRUE in the OnInitDialog() function.
m_bInitialized = TRUE;
Also send a resize message explicitly after setting it TRUE :
SendMessage(WM_SIZE,0,0);
Now modify OnSize() like this:
OnSize()<br />
{<br />
CDialog::OnSize().....
<br />
if (m_bInitialized == TRUE)<br />
{<br />
Resize the client control here.<br />
}<br />
<br />
}
To set an offset you could:
CRect rect;<br />
...<br />
rect.DeflateRect(10,10,10,10);
this is this.
|
|
|
|
|
For some strange reasons all icons in my CListCtrl decided to loose some colors and turn into dull 256 ones. If I display them using CStatic one by one they still have their 16\32 bits but if I'll attach the same image list to list control they turn into 256 ones on display. I have not owner drawn functions or something like that so it can't be the problem.
--------------------------------
Human stupidity is infinite.
|
|
|
|
|
Am I always asking something hard nobody knows about or something dumb nobody things worth of attention ?
--------------------------------
Human stupidity is infinite.
|
|
|
|
|
Hello,
I have a strange problem: I have an Edit Box which is set to Multiline and WantReturn. But if I want to set the text to the edit box with SetWindowText() it seems the \n in the text is completly ignored.
Does anyone have a clue why ?
With best regards,
Benedikt
|
|
|
|
|
|
What do you mean by 'completely ignored' ? You mean that the text following it is not on a new line ?
I think you have to specify \n\r (or \r\n, don't remember exactly) in order to have a new line.
|
|
|
|
|
|
Yeah thank you.
That was the problem. I was too long working with consoles
|
|
|
|
|
Hi guys,
Can somebody help me in opening and closing the cd-rom drive programatically.
<marquee direction="up" height="30" scrolldelay="1" step="1" scrollamount="1" hspace="0" vspace="0">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
|
I tried this before, it did not work out. May be I will try it again.
Thanks khan.
<marquee direction="up" height="30" scrolldelay="1" step="1" scrollamount="1" hspace="0" vspace="0">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Hi
How to know the serial number of the processor, motherboard, Hd,.... of the PC where is running my application?
I found that I can obtain the HD serial number with GetVolumeInformation(),
but I have problems with the other devices.
Can you help me?
Have a nice code day
|
|
|
|
|
|
Thanks,
but I have some problems to use the functions Win32_DiskDrive.
I have to define these symbols using 'Cimwin32.mof'.
But, How can I use this strange (for me ) files 'mof'?
And also it needed namespace '\root\cimv2', but the compiler give some errors!
If it is a problem, I'm writing a simple MFC doc\view application.
Thank you
Have a nice code day
|
|
|
|
|
_Russell_ wrote: If it is a problem, I'm writing a simple MFC doc\view application.
this article will help
http://www.codeproject.com/system/UsingWMI.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
For cpu-id look for the assembly function cpuid.
|
|
|
|
|
Thank you very much.
It works!
Do you know others assembly functions to know the other devices id (ram, motherboard)?
Have a nice code day
|
|
|
|
|
how to change the readonly option of a record set to upateonly or appendonly..
i am getting an error "recordset readonly"when i go for adding a record thru ODBC api in vc++
if(m_pSet->CanAppend())
{
m_pSet->AddNew();
m_pSet->m_programname="parser";
m_pSet->m_paraname= "main";
if(m_pSet->Update())
TRACE("Row Added OK\n");
else
TRACE("Row Not Added\n");
} // end if CanAppend()
else
MessageBox("Cannot Append");
thanks in advance
Get
|
|
|
|
|
Check out the third parameter of CRecordset::Open() .
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
wrote an application that uses twain for scanning an images using
a scanner.
when the scanner is not connected I get the return value and want to
display my own popup but there is another popup from the scanner.
I tried to call :
ShowOwnedPopups(DefWnd(NULL)->m_hWnd,false);
("DefWnd(NULL)->m_hWnd" has my main window handle).
Still the popup is shown. I think that probobly the popup is generated by
the operating system (Windows).
Is anyone can help me on this?
Thanks,
Lior.
|
|
|
|
|
1)Actually, what i am doing is to integrate two separate Excel & access automation applications into one.
2)First, i finish Excel automation(used excel9.olb(library) & included excel9.h as header file).Upto now it works fine.
3)Now The problem begins. For access automation functionality i use msacc9.olb & include access9.h as header file.As soon as i compile, even before adding any functionality, it shows class redefinition errors for _Application etc.
Apparently, these are due to the object models of Excel & Access which have some same class names like _Application etc. which cause the clash.
There seems nothing wrong with the code but with the libraries of access & excel which have some same class names.
How should i resolve the clash?Please, Please, Please Help!!
Ankush Mehta
|
|
|
|