|
In the resource the controls are specified in client co-ordinates. And the controls are placed in the client co-ordinates. So it should be placed same as the first one.
Can you show me the relevent codes?
- NS -
|
|
|
|
|
Hi - thanks for looking!
In the '.rc' file I have the following for each button control
CONTROL "",IDC_BTN_PA_001,"Button",BS_OWNERDRAW | NOT WS_VISIBLE,
12,305,40,18,WS_EX_RTLREADING
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
I hope you can help!
Thanks
69 Bay
|
|
|
|
|
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.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I am sorry, I ignored the DLU used in rc files. Thanks to Mark Salsbery.
- NS -
|
|
|
|
|
Hi,
I have to create a static library of a whole source code which contains ".c",
".cpp" files. I am using Microsoft Visual Studio 6.0, but i have the following error message which i am unable to solve.
The following is the problem,
fatal error C1853: 'Debug/<filename>.pch' is not a precompiled header file created with this compiler Error executing cl.exe.
I am inserting a ".c" file into my project which also needs to include "stdafx.h" but this header is not compatible with the C complier but this "stdafx" is an essential header for a VC++ project.
Please do help me on this issue of how to use the "stdafx.h" for a ".c" file.
Please note that I have also tried setting the "not using pre-complier header" Option in the Project->settings->C/C++ tab for every ".c" file I am using.
The following is the error i receive,
error C2146: syntax error : missing ';......
fatal error C1004: unexpected end of file found.
Advance thanks.
With regards,
Arul Prakash
Arul prakash
|
|
|
|
|
Whats the problem in renaming all the c files to cpp?
|
|
|
|
|
.C and .CPP files are treated differently by the compiler. (Or so I think).
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
prakashd wrote: fatal error C1853: 'Debug/.pch' is not a precompiled header file created with this compiler Error executing cl.exe.
I am inserting a ".c" file into my project which also needs to include "stdafx.h"
No! Dont do that!
Instead, switch your C-files individually to "Not using precompiled headers".
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
Hi jhwurmbach,
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.
main.obj : error LNK2001: unresolved external symbol "public: int __thiscall IperfMain::executeIperf(int,char * * const)" (?executeIperf@IperfMain@@QAEHHQAPAD@Z)
Debug/PorduceEXE2.exe : fatal error LNK1120: 1 unresolved externals
This are all the two errors i got.
Advance thanks.
Arul prakash
|
|
|
|
|
It seem as if the lib containing IperfMain::executeIperf does not get linked.
Check your linker settings.
Maybe you need to follow Karls advice and add "extern C " to the header/around the header inclusion.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
Hi jhwurmbach,
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
#include"ws2tcpip.h"
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
Arul prakash
|
|
|
|
|
|
* 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;
HGLOBAL hXmlContent;
HRESULT hr;
int iResult = 0;
// allocate global memory to copy the HTML content to
hXmlContent = ::GlobalAlloc( GPTR, ( ::_tcslen( kpszXML_in ) + 1 ) * sizeof(TCHAR) );
if (!hXmlContent)
return false;
::_tcscpy( (TCHAR *) hXmlContent, kpszXML_in );
// create a stream object based on the HTML content
hr = ::CreateStreamOnHGlobal( hXmlContent, TRUE, &pStream );
|
|
|
|
|
|
Thank you for the link.
I also found another way to do this.
LARGE_INTEGER pos;<br />
pos.QuadPart = 0;<br />
pOutStream->Seek((LARGE_INTEGER)pos, STREAM_SEEK_SET, NULL);<br />
<br />
char pszXml[4095];
ULONG cb=4095;<br />
ULONG cbRead=0;<br />
CString strXmlFromIStream;<br />
do <br />
{<br />
memset(pszXml,0,4095);<br />
hr = pOutStream->Read(pszXml, cb, &cbRead);<br />
strXmlFromIStream += pszXml;<br />
} while(cbRead!=0);
|
|
|
|
|
Hello everyone,
I am looking for some tutorials about how to use OLE Viewer. But I can not find any detailed tutorials. Any reference?
thanks in advance,
George
|
|
|
|
|
In which forum should I submit C questions???????
|
|
|
|
|
Just ask here!
Maxwell Chen
|
|
|
|
|
This is the forum...
- NS -
|
|
|
|
|
If you like to ask on the codeproject this forum is good choice.;)
|
|
|
|
|
Thanks and sorry for the late reply,
my ques is like that:
i have a struct built for ADT in a source file, and it compiles successfully.
the problem is that when i try to use it in the designated program, It doesn't recognize all of the members of the struct.
here is the relevant code:
this is the struct source file:
typedef struct data
{
char** colName;
const struct element_interface** ifc;
Element* temp_row;
}data;
typedef struct table_rec
{
char TabInitFlag;
int iterator;
data* localData;
char** last_found_array;
Matrix tableArray;
int tableWidth;
int last_found;
}table_rec;
header file:
typedef struct table_rec *Table;
application try to use:
Result rdb_del_customer(RestaurantDB rdb,const char* name)
{
Element passName[1];
int *count;
passName[0] = string_to_element(name);
count = (int*)malloc(sizeof(int));
tab_delete_rows(rdb->customers , rdb->customers->localData->colName , passName , 1 , count);
if(*count == 0)
return RES_NO_MATCH;
else
return RES_NO_ERROR;
}
it doesn't recognize the rdb->customer as a Table, pointer to table_rec Struct
Error message:
error C2037: left of 'localData' specifies undefined struct/union 'table_rec' c:\documents and settings\dan\my documents\visual studio 2005\projects\mtm_rst\mtm_rst\restaurantdb.c 61
and of course I want to use code project to ask my questions, it's my guide in
every step on my way to become a programmer excellent.
|
|
|
|
|
Put your structure in the header file instead of the source file.
|
|
|
|
|
I am not allowed to do this, this is what ADT programming is all about.
I must hide my implementation from the user(in this case me ),
so I only pass to the user the header interface to my ADT, and the object file,
he uses that to create he's own program using my module.
it's a school assignment :->
|
|
|
|
|
gizmokaka wrote: I must hide my implementation from the user(in this case me ),
Which implementation ? I just see a structure with data in it, no functions at all. How can somebody manipulate an 'object' without knowing what's inside.
How could you know that the structure contains a localData member if it is hidden ?
Hide implementation means that you put your function definitions in a cpp file and only 'show' (through a header file) the function prototypes.
|
|
|
|
|
true, and that's what I do,
only I am not allowed to reveal the members of the struct because
then the user of the ADT can change their type or value directly
which can hurt the functionality and integrity of the ADT.
|
|
|
|