|
amitmistry_petlad wrote: ofn.hwndOwner
It is handle to owner of dialog, not to the dialog.
You may need to use OFNHookProcOldStyle . Handle WM_INITIDIALOG message there. And center the window with given code.
|
|
|
|
|
Like I said, I was not sure if it would help. That code depends on having the handle to the window that you want to center on the screen. There are ways to override common windows behavior called hooking that will allow you to do what you want, so I suggest that you look that up. You will need to dig a little deep and remember that each window has its own class name (not a C++ class name), look up ‘CreateWindow’ in the MSDN and you will have a start on what I am referring too.
I would like to be of more help, but it is the middle of the night here and I should be asleep.
P.S. Next time post your reply to the post you are replying to or I might not notice it.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
amitmistry_petlad wrote: ...it's WIN32.
So how about stating all of your requirements in your initial post!?
Be sure and specicy the OFN_ENABLEHOOK flag. In response to the WM_INITDIALOG message in the hook procedure, simply call CenterWindow() .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
This is a very old function and I do not know if it will help.
void Window_Center(HWND hWnd) {
RECT rc;
int w,h;
GetWindowRect(hWnd,&rc);
w = 1+rc.right-rc.left;
h = 1+rc.bottom-rc.top;
rc.left =(GetSystemMetrics(SM_CXSCREEN)-w)>>1;
rc.top =(GetSystemMetrics(SM_CYSCREEN)-h)>>1;
MoveWindow(hWnd,rc.left,rc.top,w,h,TRUE);
}
If that does not help, start searching for the multitudes of FAQs on the NET because it is a common question.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
exploite environment:2003SP1 PlatformSDK + VC6
error information:
error LNK2001: unresolved external symbol _IID_IHTMLInputElement
error LNK1120: 1 unresolved externals
error code:
CComPtr<ihtmlinputelement> *pIInput;
hr=pDisp->QueryInterface(IID_IHTMLInputElement , (void**)&pIInput);
|
|
|
|
|
It doesnt have any problem on the VS2005
|
|
|
|
|
MyNothing wrote: hr=pDisp->QueryInterface(IID_IHTMLInputElement , (void**)&pIInput);
Use __uuidof(IHTMLInputElement) instead of IID_IHTMLInputElement .
Modify your code to,
CComPtr<IHTMLInputElement> pIInput;
hr=pDisp->QueryInterface(__uuidof(IHTMLInputElement), (void**)&pIInput);
|
|
|
|
|
MyNothing wrote: IID_IHTMLInputElement
try __uuidof(HTMLInputElement)
|
|
|
|
|
ThatsAlok wrote: try __uuidof(HTMLInputElement)
You meant to say __uuidof(IHTMLInputElement), isn't it ?
|
|
|
|
|
prasad_som wrote:
You meant to say __uuidof(IHTMLInputElement), isn't it ?
ohh sh*t.. you have posted correct reply more than 2 hr before me.. is cp clock playing with me..!
|
|
|
|
|
ThatsAlok wrote: is cp clock playing with me..!
Its happening for last 2-3 days, reported by many people already. Some thing to do with day light saving.
You missed I from IHTMLInputElement in your reply.
|
|
|
|
|
Not only that ..........
He also missed I from sh*t ........
|
|
|
|
|
Ranjoy Guha wrote: He also missed I from sh*t ........
just try write sh*t with i and post it on cp..
|
|
|
|
|
Ranjoy Guha wrote: He also missed I from sh*t ........
See before commenting on someone!
|
|
|
|
|
Sir
Thats just a joke............
I am extremely sorryf I have hurt you....
Regards
Ranjoy
|
|
|
|
|
Ranjoy Guha wrote: I am extremely sorryf I have hurt you....
its' ok dear.. i am jokin too
|
|
|
|
|
|
In your assignment to LPCTSTRs, you are setting them to the address of temporary local strings, created by Left and Mid. In the CString case, it's making a copy of the temporary strings, that's why it works.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
I am tired, but I would like to know where ‘p_strToken’ is assigned to point to anything, because your code snippet does not show it and that is what you are asking about.
I suggest using ‘\n’ and ‘\r’ instead of ‘10’ and ‘13’ (line-feed and carriage return). Also checking for just one could lead to problems, because either one exist or both exits and if the latter you will miss a character and problems will ensue (think about it).
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
This is medium is to slow.
I assumed it was done every while loop, but what you have just posted still does not show it. What you are showing is how you are using it after it has been assigned. How are you assigning it; What line of code show us what ‘p_strToken’ is pointing too? This may not help me or anyone else solve the problem, but it may help you to do so; as that my be where the problem lays.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Sorry for my poor grammar, when I get online the English language starts looking like a second language to me.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
I know but it irritates me when it type things like “This is medium is to slow.”. What the <blank> is that? It sounds like I am trying to translate from another language.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Norm,
The piece of code you are showing me shows how it is used after ‘p_strToken’ is assigned to point to a variable of type CString. If you are not assigning it, making it point to a variable of that type, before you use it then the only thing that is saving you from a systems crash is because modern systems have the option of only crashing your application. This line of code 'CString * p_strToken = NULL ' says that it points to nothing and this line of code '*p_strToken += ch; ' says we assume that it is pointing to something. The question remains that you have not shown any code where you assign ‘p_strToken ’ to point to anything but air, which means the line you highlighted will probably cause the compiler to give an error message. If it does not then something bad usually follows, other than the garbage output you mentioned.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Hi having a bit of trouble here using CMap...
So here is where it all begins, from application start routine:
PropertyFileReader o_Reader;
if(o_Reader.Load(sFileName))
{
CString sProperty1 = o_Reader.GetProperty("Property1");
...
...
}
PropertyFileReader's Load method is as such:
BOOL PropertyFileReader::Load(CString sFileName) {
BOOL bSuccess = TRUE;
CString * p_strToken = NULL;
CString csKey;
LPCTSTR pKey;
CString csVal;
LPCTSTR pVal;
... code ...
BOOL bEndOfLine = FALSE;
...
oFile.Open(sFileName, CFile::modeRead);
rowNo = 0;
columnNo = 0;
while(oFile.Read(&ch, sizeof(char)) > 0) {
... code ...
if(columnNo==0) {
if(p_strToken!=NULL) {
delete p_strToken;
p_strToken = NULL;
}
p_strToken = new CString();
}
if(ch!=13 && ch!=10)
{
*p_strToken += ch;
}
... code ...
bEndOfLine = ( ch == 10 || ch == 13);
if(bEndOfLine) {
p_strToken->TrimLeft();
p_strToken->TrimRight();
if( ((CString) *p_strToken).GetLength()>1) { // skip blanks at the end of each line in input file
index = p_strToken->Find('=', 0);
if(index> 0) {
// QUESTION: Option 2 works but don't understand why Option 1 does not.
// OPTION 1: This will NOT work - when GetAt some of the values will become jibberish
pKey = p_strToken->Left(index);
pVal = p_strToken->Mid(index+1);
// OPTION 2: This works. I don't know what's the difference ...
csKey = p_strToken->Left(index);
csVal = p_strToken->Mid(index+1);
lstProperties.SetAt(csKey, csVal);
}
columnNo = 0;
rowNo++;
bEndOfLine = FALSE;
}
} else {
columnNo++;
}
}
... mode code ...
oFile.Close();
return TRUE;
}
And to lookup property from a CMap:
CString PropertyFileReader::GetProperty(CString csKey)
{
CString csVal;
oProperties.Lookup(csKey, csVal);
return csVal;
}
In PropertyFileReader class:
class PropertyFileReader {
...
void Load(CString sFileName);
CString GetProperty(CString csKey);
...
CMap<cstring, lpctstr,="" cstring,="" lpctstr=""> oProperties;
...
}
Many thanks and sorry about the correction.
|
|
|
|
|
norm wrote: Option 2 works but don't understand why Option 1 does not.
How you are verifying this ? Have you used lookup to check back at some point of time ?
norm wrote: // OPTION 1: This will NOT work - when GetAt some of the values will become jibberish
Can you explain this ? GetAt is not member of CMap , isn't it ?
|
|
|
|