Forgive me for what is probably a very simple question!
I have 2 dialog applications that I am working on. In one I have laid out several button controls into various positions (dialog is maximized).
I wish to read these positions into another dialog app and display buttons in the same position. I have tried to get the co-ordinates from the '.rc' file, but when I use these in my 2nd dialog, they do not appear in the correct position or size.
Is the problem that I need to use ClientToScreen() or ScreenToClient() to convert the co-ords that I have?
I have looked, but have been unable to find a tutorial that will help me with this - anyone know of one?
In the '.rc' file I have the following for each button control
CONTROL "",IDC_BTN_PA_001,"Button",BS_OWNERDRAW | NOT WS_VISIBLE,
What I would like to do is use the '.rc' file from the 1st app to load up a 2nd app with the same resources, in the same locations. What I want to do is read in the co-ordinates and size (12,305,40,18 in the above example) into my 2nd app, and interpret the information to make the 2nd app display a button in the same location - either by SetWindowPos(), or MoveWindow(), or any other method that you may know of
In the resource, the units are dialog units (DLUs).
From the docs:
"A DLU is based on the size of the dialog box font, normally 8-point MS Sans Serif.
A horizontal DLU is the average width of the dialog box font divided by four. A vertical
DLU is the average height of the font divided by eight."
For an example of how to convert DLUs to pixels, you may want to check out the
_AfxConvertDialogUnitsToPixels() function in the MFC source code or the
ConvertDialogUnitsToPixels() method in the ATL _DialogSizeHelper class.
Thanks, It's working yar... I have created the standard library. Now i have to implement in the console application. I have import standard library in to console application. Finally i got two error. Can u please give me some solution's.
It's working fine. But i got link error called
error LNK2001: unresolved external symbol _getaddrinfo@16
Debug/pro.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Note: I have included
and I have linked Ws2_32.lib.
please note i'm using MSVC 6.
please tell how to use getaddrinfo()
in VS 6. Thanks Mr.jhwurmbach
* The xmlparser XmlLite from microsoft uses IStream to read and write xml.
It is described how to copy text into a stream, but not how to read the text back from the stream. Do you know how to do this?
Code to write text to IStream.
IStream * pStream = NULL;
int iResult = 0;
// allocate global memory to copy the HTML content to
hXmlContent = ::GlobalAlloc( GPTR, ( ::_tcslen( kpszXML_in ) + 1 ) * sizeof(TCHAR) );
::_tcscpy( (TCHAR *) hXmlContent, kpszXML_in );
// create a stream object based on the HTML content
hr = ::CreateStreamOnHGlobal( hXmlContent, TRUE, &pStream );