|
That you instantiate the CWnd -derived classes does not mean that they will be displayed. You'll have to call Create and - depending on the styles you set - ShowWindow . You'll also have to move the windows in response to the parent resizing. This is accomplished by handling WM_SIZE in the view (you'll get a function called OnSize ), checking for window existence by testing the m_hWnd member of CScreenX.
|
|
|
|
|
Hi guys
I have a problem , but only happens in XP.
When I open a dialog in my app, I do a movewindow related to the parent position. In W2K the windows is placed exactly where I want and when I execute my app in XP it appears in a higher place than in W2K.
Do you know why could this happens?
What is different in XP that my window is not placed in the same place than in w2K?
Another related question.
Why depending the size of the dialog in W2K it appears correctly and in XP the scrollbars appear?
Best Regards
Doc
|
|
|
|
|
Thank you for your Best Regards
This is intriguing.
I cant be sure exactly, but if you're sure you're code complies with MS dox completely, it wud help if you posted the relevant code.
I would sure like to replicate this !
Bikram Singh
|
|
|
|
|
Thanks in advance for your help
CRect rect,rect3;
m_pParent->GetWindowRect(rect3);
GetWindowRect(rect);
MoveWindow(rect3.left+381,rect3.top+123,rect.Width(),rect.Height(),TRUE);
m_pParent it's a pointer to the dialog parent class.
And Best Regards
Doc
|
|
|
|
|
I suspect there are two problems here.
In MoveWindow() you are using two rects that have different origins
This is from CWnd::MoveWindow in MSDN...
For a top-level CWnd object, the x and y parameters are relative to the upper-left corner of the screen. For a child CWnd object, they are relative to the upper-left corner of the parent window’s client area.
so you need to change the code like this
CRect rect,rect3;
m_pParent->GetWindowRect(rect3);
GetWindowRect(rect);
GetParent()->ClientToScreen(&rect);
MoveWindow(rect3.left+381,rect3.top+123,rect.Width(),rect.Height(),TRUE);
The second problem is the use of constants (381 & 123). All sizing and position calculations need to be relative ALWAYS or you will get lots of problems when you change resolution or other display settings.
I suspect that you had to add these because you didnt call ClientToScreen()
What are you trying to acheive here? Is it to put the child window in the center of the parent?
|
|
|
|
|
Hi Josh
Thanks for your accurate explanation.
The cause to use 2 different rects, is because I use the size (width and height : rect) of the child window to put the child window in a certain point of the parent window (rect3).
What I'm really trying to do is to align the child window in a certain point in the parent window.
What I'm not understand is why in W2K is working always well in all resolutions and in XP not.
Do you know a better way to do this?
Thanks in advance. Anyway, I'll try your solution.
Best Regards
Doc
|
|
|
|
|
Hi,
I try to DLLExport a C++ class that contains an STL container, which gives a a compiler warning. I have "half of an idea" about the why, but it's a bit fuzzy.
I recently found a MSKB article describing what to do in this case - however, I cannot find it anymore. Any suggestions?
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist || Agile Programming | doxygen
|
|
|
|
|
I presume you're talking about warning 4251.
"If your project declares a class class __declspec(dllexport), and that class has members of the std::* type, you see C4251 warnings. Because all your code is built with the std::* class now statically linked, you can ignore these warnings. To explicitly disable those warnings, use the following notation: #pragma warning(disable: 4251)"
This is what I do, and I've never had any problems with it.
Hope it'll help you as well.
|
|
|
|
|
I have an application that needs data from a Database, which will be very large ~ 200K bytes.
I was thinking to exporting this database to a Comma Spearated Format file and creating a library of this data.
e.g.
static int myData1 [64][8] = {0};<br />
static float myData2 [64][8] = {0};<br />
static bool myData3 [128][8] = {0};
The above data arrays would be popluated by a program reading this CSF file
giving:-
static int myData1 [32][32] =<br />
{ <br />
{{1,0},{0,0},{0,0},{0,1},{0,1},{0,0},{0,0},{0,0}, <br />
{0,0},{0,0},{1,0},{0,0},{0,0},{0,0},{0,1},{0,0}, <br />
{0,0},{0,0},{0,0},{0,0},{0,0},{1,0},{0,0},{0,0}, <br />
{0,0},{0,1},{0,0},{0,0},{0,0},{0,0},{0,1},{0,0}, <br />
...
...
etc
i.e. writing the declarations and filling in the initial values (writing the cpp code to a file).
The library would then be built and included in my program.
My question is how to access this data as the library will have no functions, just data.
What I am treying to do is create/fill and be able to use a data structure quick and simple in my program.
Any comments!
|
|
|
|
|
Can anybody help me in replacing a substring:
string s1 = "Here goes string - sample string";
string s2;
...
s1.replace...
...
...
s2 must be "Here goes solution - sample solution"
XPiS
|
|
|
|
|
s2 = s1.Replace("string", "solution");
Check the syntax at MSDN here [^]
...Plug & Pray...
|
|
|
|
|
HI,
I have a Barcode reader ,,that is attahced with COM port.
I wanaa make application that recv the data when i read from Barcode reader ,, n show it ..
any sample .. help
thanx
|
|
|
|
|
I'm looking for a method to get Per Thread CPU Usage in VC++.
I know you can get total with PerformanceCounter _Total - but
I want per thread CPU Usage.
Thanks alot .
|
|
|
|
|
See GetThreadTimes() API.
onwards and upwards...
|
|
|
|
|
Thank you very much .
Your guide is very good .
|
|
|
|
|
That's what the szInstanceName member of PDH_COUNTER_PATH_ELEMENTS is for. The threads (instances) are 0-based. See my response here. Change szObjectName to "Thread", assign szInstanceName a value, change szParentInstance to the name of the process that has the threads.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thanks a'lot for your guide .
|
|
|
|
|
It appears to me that IE, if challenged by a web server for authorization will send my current username/password and try and authorise me with those before asking for another username/password.
Is there something I can get obtain from the system to authorise a user with without having to ask for and supply the username/password? It looks like C# has something along these lines in CredentialCache.DefaultCredentials, but I need pure Win32 methods.
|
|
|
|
|
i have created a VC++ application. The .exe depends on few dlls. one of them is MSJET35.dll. i converted the dll into MSJET35.lib. now, i want to statically link this library with my exe so that it runs independently on any machine irrespective of the presence of MSJET35.dll. but i do not know how to link statically with a library. need help, suggestions on this matter
|
|
|
|
|
You can't convert a DLL to a static lib without the source code. Most likely, you've succeeded in creating an import lib for the DLL. MSJET32.DLL sounds like a MS ODBC-DLL, there's no chance you'll ever be able to link it statically to your app
|
|
|
|
|
HI~
How to search a substring from LPWSTR?
Also I cannot extract a character like string class
e.g
I cannot do this:
LPWSTR a_string = _T("abcdef")
if (a_string[2] == 'c'){...}
How to extract a character is the string is LPWSTR type?
Thanks
|
|
|
|
|
LPWSTR a_string = _T("abcdef");
if (a_string[2] == (WCHAR)'c'){...}
...Plug & Pray...
|
|
|
|
|
Dimitris Vassiliades wrote:
(WCHAR)'c'
Actually the correct syntax is L'c' for wide-char literals. (Your code will work but I didn't want the original poster to get the idea that casts are the solution for string-related stuff.)
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Actual sign at the laundromat I go to: "No tinting or dying."
|
|
|
|
|
LPCTSTR SubString( LPCTSTR lpExpression, // [in] Pointer to a string to extract the substring from
ULONG nStart, // [in] Starting point
LONG nLength = -1 ) // [in] how far to go from the startig point, use -1 to go the end of lpExpression
{
if( nLength < 0 )
nLength = strlen(lpExpression) - nStart;
ULONG nPos = 0;
PTCHAR lpResult = new TCHAR[512];
for( ULONG i = nStart; i < (ULONG)(nStart+nLength); i++ )
{
// put the current char from lpExpression into lpResult
lpResult[nPos++] = lpExpression[i];
}
// add the null byte to lpResult;
lpResult[nPos] = '\0';
// return the substring
return lpResult;
}
|
|
|
|
|
Hi,
i m recving data from bar code reader ,, on Socket
In which format a bar code reader send data ..
i m not properly formating it.
2 .... as to format integer
CString s;
int value
DWORD dval
s.Foramt( "%d" , value);
wt i will use for DWORD in place of "%d" in format
thanx
|
|
|
|
|