|
Can't you use the SetWindowPos (and optionally play with the Z-Order) for the one being Maximized? Or does this not fill your requirements?
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Cannot you just handle WM_SIZE message, sizing your window height to screen height minus the dialog's height (and moving it at the bottom of the dialog) on maximize request?
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]
|
|
|
|
|
Yes,
I used that one also.I can get my required window size.But in that maximized window, the title of my child window,system menu,staus bar all are missing.simpla window without caption,without mimnimize,maximize bar is get displayed.When i double click on the bar,then the window comes to previous position with caption and system menu.
I coded like this
void CChildFrame::OnSize(UINT nType, int cx, int cy)
{
CMDIChildWnd::OnSize(nType, cx, cy);
int XBorder = GetSystemMetrics(SM_CXMAXIMIZED);
int YBorder = GetSystemMetrics(SM_CYMAXIMIZED);
switch (nType)
{
case SIZE_MAXIMIZED:
MoveWindow(40,60,XBorder-50,YBorder-40,FALSE);
break;
}
}
Anu
|
|
|
|
|
Why don't you use the size of the (top) dialog to accordingly resize your frame window?
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]
|
|
|
|
|
I couldnot get you point?
Anu
|
|
|
|
|
You said you have a dialog box at the top of the screen. In order to make your frame window appear just below it, you must know (and use) the dialog's height, or am I wrong?
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]
|
|
|
|
|
Can someone clarify me the following question - unfortunately I cannot understand it from MSDN docs. There are several messaging libraries in Windows - see http://msdn.microsoft.com/en-us/library/ee663283(VS.85).aspx. The question is: can some of them be used to the following task: to read mails from POP3 mailbox on ANY (not only Microsoft Exchange Server) mail server? For instance, I see on http://msdn.microsoft.com/en-us/library/ms710599(VS.85).aspx description of some IPOP3Transport interface, but with remark 'Do not use'. "http://msdn.microsoft.com/en-us/library/ms709613(VS.85).aspx" says "New applications should not use this set of interfaces and schemas. These interfaces and schemas exist for backward compatibility with legacy applications".
So, this "Windows Mail" is obsolete and should not be used anymore? I am confused. Can someone explain me?
|
|
|
|
|
Personally I keep far away from 'MS solutions' for just the reasons you described. What i did (years ago) open a socket and read the mail. The Pop3 protocol is really simple.. Next, you will get your emails as files and you have to get bodies and attachments out. Pop3 and the email format is described and available on internet, open for us all.
Besides of some nasty 'ms-enhancements' in the email adresses, email is pretty standard.
I read the pages you provided: forget it they are just wrappers around the real thing. If you do not want to follow my advice above use the mail-classes of your programming language, they should be reasonably standard.
Send me a private mail if you need more advice...
Rozis
|
|
|
|
|
Hi All,
At one place in my code i need to run IOCTL_DISK_DELETE_DRIVE_LAYOUT, that execute smoothly. This IOCTL code make the disk signature as zero so it can not be initialize.
I need to initialize this disk using code. Is there any API or any function that can initialize the disk?
Please suggest me some way to initialize it using c++ code.
Thanks
MChauhan
|
|
|
|
|
What you want to Initialize?
Величие не Бога может быть недооценена.
|
|
|
|
|
Well I got it that is IOCTL_disk_create_disk.
|
|
|
|
|
Hi,
Is there any MFC method to convert CString object to char array? please tell me how to do this.
Thanks in advance.
Regards,
jo
hi
|
|
|
|
|
It is not at all good to convert a CString to char array
unless you are sure that it doesn't contain any UNICODE character.
well there a lot of methods
one of them is
CString csdata = "asdsadasdda";
char* cdata = csdata.GetBuffer();
//When you have done all your needs, use ReleaseBuffer().
csdata.ReleaseBuffer();
Величие не Бога может быть недооценена.
modified on Monday, January 25, 2010 1:36 AM
|
|
|
|
|
Adam Roderick J 09 wrote: char* cdata = csdata.GetBuffer();
Calling GetBuffer is not a good solution in this case, even if you call ReleaseBuffer afterward. There's no need to use GetBuffer because CString already defines casting operators (which returns the same type of what GetBuffer returns, so it depends on the UNICODE settings). Using GetBuffer is very bad practice and should be avoided.
|
|
|
|
|
thanks for correcting me.
Величие не Бога может быть недооценена.
|
|
|
|
|
CString s(_T("Hello World"));
TCHAR* pStr = new TCHAR[s.GetLength() + 1];
lstrcpy(pStr, s);
_putts(pStr);
delete [] pStr;
|
|
|
|
|
Thanks joe
i have one more problem. please check the code below
here pdmFile,pdmSecFile are two CFile objs.
CString strLine;
totlen = pdmFile.GetLength();
for(int i = 0; i < totlen; i++)
{
UINT lBytesRead = pdmFile.Read(ch,1);
if(ch[0] == '\n')
{
int totl = strLine.GetLength();
TCHAR* pStr = new TCHAR[strLine.GetLength() + 1];
lstrcpy(pStr, strLine);
pdmSecFile.Write(pStr, totl+1);
delete [] pStr;
pdmSecFile.Flush();
strLine.ReleaseBuffer();
strLine.Empty();
}
strLine.AppendChar(ch[0]);
}
pdmFile.Close();
pdmSecFile.Close();
iam trying to read each line from the first file and writing to second file.
i am getting the out put but after every character its printing NULL character. please check the code and give me some solution to get the desired output.
Thanks in advance!
Regards,
jo
hi
|
|
|
|
|
First, there is no need to do the copy operation. pdmSecFile.Write((LPCTSTR) pStr, strLine.GetLength() * sizeof(TCHAR)); is sufficient (which also elminates the int totl = line.)
Second, you are writing out the NULL character with totl+1.
Third, the Flush is not needed.
Fourth, ReleaseBuffer is not needed.
Fifth, you should append the char immediately, and then test. Otherwise the last return never gets written.
Sixth, the last line may never get written if it doesn't end in a return.
Seventh, just use CStdioFile and have it read the entire string for you!
|
|
|
|
|
Thanks joe for your comments.
i changed code like this to eliminate char array.
CFile pdmFile;
CFile pdmSecFile;
pdmFile.Open(_T("c:\\strucadv15\\Work\\testpdms\\mod\\testpdms.pdm"),CFile::modeRead);
pdmSecFile.Open(_T("c:\\strucadv15\\Work\\testpdms\\mod\\testpdms_changed.pdm"),CFile::modeCreate | CFile::modeReadWrite);
CString strLinee;
totlen = pdmFile.GetLength();
for(int i = 0; i < totlen; i++)
{
UINT lBytesRead = pdmFile.Read(ch,1);
if(ch[0] == '\n')
{
pdmSecFile.Write(strLinee, strLinee.GetLength());
strLinee.Empty();
}
strLinee.AppendChar(ch[0]);
}
pdmFile.Close();
pdmSecFile.Close();
but still i got the same output like, after every character its appending one NULL
please give me some solution.
Regards,
Jo
hi
|
|
|
|
|
totlen = pdmFile.GetLength(); <- This gives you no of chars in the file.
So for loop iterates for each char and you are inserting null char: -> strLinee.AppendChar(ch[0]);
You should look for a new line char to get the no of lines in the file.
|
|
|
|
|
Thanks Maya!
what you said is correct...
but i solved that problem in different way, I guess this is the easiest way. any how I am keeping that code here, it will be helpful for others.
I used CStdioFile instead of CFile, that really simplifies my work.
CStdioFile pdmFile;
CStdioFile pdmSecFile;
pdmFile.Open(m_sPdmFileName, CStdioFile::modeRead);
pdmSecFile.Open(_T("testpdms_changed.pdm"),CStdioFile::modeCreate | CStdioFile::modeReadWrite);
CString sKey;
CString sValue;
POSITION pos;
while(pdmFile.ReadString(strLine))
{
pos = mapingStrings.GetStartPosition();
while(pos != NULL)
{
mapingStrings.GetNextAssoc(pos, sKey, sValue);
strLine.Replace(sKey,sValue);
}
pdmSecFile.WriteString(strLine);
pdmSecFile.WriteString(_T("\n"));
}
pdmFile.Close();
pdmSecFile.Close();
Regards,
Jo
hi
|
|
|
|
|
That's not correct. He reads a character at a time and then appends it. The problem is that the concatenation operation is likely creating a UNICODE string.
|
|
|
|
|
Member 4399771 wrote: after every character its appending one NULL
You are writing a UNICODE string to the file. Each AppendChar() converts the character to a UNICODE character and appends it to the string. During your write, you'll also note that only half the string is being written. (CString::GetLength() returns the number of characters, not the number of bytes.)
|
|
|
|
|
hi ..
Use _tcscpy() to copy from CString to TCHAR array;
ex-
CString csMystring = L"Hi all";
TCHAR tchChar[MAX_PATH];
memset(tchChar, 0x00, MAX_PATH);
_tcscpy(tchChar, csMystring);
Hope it will help.
Thanks
MChauhan
|
|
|
|
|
Hello community, ive got a problem i hooked a function that has virtual table inside it and calls other functions:
Decompailed with hex rayz :
signed int __cdecl sub_4594F5()<br />
{<br />
signed int result;
<br />
result = -691773993;<br />
dword_4B0068 = (unsigned int)sub_40511C ^ 0xD6C45DD7;
dword_4B006C = (unsigned int)sub_438213 ^ 0xD6C45DD7;
dword_4B0070 = (unsigned int)sub_424041 ^ 0xD6C45DD7;
dword_4B0074 = (unsigned int)sub_42A4FC ^ 0xD6C45DD7;
dword_4B0078 = (unsigned int)sub_410B73 ^ 0xD6C45DD7;
dword_4B02F8 = (unsigned int)((char *)sub_416A34 + 4) ^ 0xD6C45DD7;
<br />
return result;<br />
}
This is second function from the virtual table that i want to hook
<br />
int (__cdecl* pointermy_sub_438213)(int, int, int, int);<br />
<br />
int __cdecl testmy_sub_438213(int a, int b, int c, int d)<br />
{<br />
<br />
return pointermy_sub_438213(a, b, c, d);<br />
<br />
}
This is the hooked vtable func i used ms detours to hook it :
<br />
int (__cdecl* pPBVTBLsub_4594F5)();<br />
<br />
<br />
int __cdecl myPBVTBLsub_4594F5()<br />
{<br />
<br />
int dword_4B006C;<br />
dword_4B006C = (unsigned int)testmy_sub_438213 ^ 0xD6C45DD7;<br />
<br />
return pPBVTBLsub_4594F5();<br />
}<br />
<br />
So in shortly the testmy_sub_438213 wont get hooked, so anyone knows what im doing wrong or mybe my aproach is false and this way cant be done vtable hooking any input is really welcome.
|
|
|
|