|
kiran.pinjarla wrote: when i am include in my code it is showing errors
what code ? can you show some code ?
I'm sure you are messing with CComPtr
|
|
|
|
|
I am using CRegKey in my application. And for that i have included the
<altbase.h> file. when i am compiling it, it shows errors in the header file atlbase.h. i am not using the CComPtr.
KIRAN PINJARLA
|
|
|
|
|
is comdef.h defined in your app. Try including atlbase before it.
|
|
|
|
|
prasad_som wrote: is comdef.h defined in your app
no.
KIRAN PINJARLA
|
|
|
|
|
Where you declare this file atlbase.h ?
|
|
|
|
|
I've got a CWnd based class, that displays an image, which I want to be centred on the screen when the window is first shown.
The problem is that I can't find a suitable point to do this - the window needs to have been created, since GetClientRect() doesn't return a useful value until the window is fully created and displayed.
OnShowWindow() is called *before* the window is shown. Is there anything that gets called *afterwards*?
Currently I'm having to do my logic in OnSize, checking that it's the first time GetClientRect returns something other than (0,0,0,0), but that seems incredibly hacky to me
|
|
|
|
|
benjymous wrote: I've got a CWnd based class, that displays an image, which I want to be centred on the screen when the window is first shown.
Here I'm consfused a little. You want image to be centered on window, when first shown, aren't you?
How you are showing the image, using OnPaint()?
Can you give some more details ?
|
|
|
|
|
Sorry - I'll clarify
I've got a large bitmap being displayed in a smaller window, with scrollbars. When the window is opened, I need to set the scrollbars to display the centre part of the image, which can't be done until you know the size of the window
|
|
|
|
|
|
At the end of your creation code post a custom message to the window. The window will then handle the custom message as soon as it is finished being created and shown. There is where you can put your code.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Please, if somebody between you already tried to compile this existing code on this site (see the subject of the message), under
“Microsoft visual studio.NET 2003”,
say me how to make it go because I followed all the indications of the author(bollwerkj) but always the compiler does not manage to find the file “mscoree.lib” (note: I find this file on my hard disk under the way according to " C:\Program Files\Microsoft Visual Studio .NET 2003 \ SDK \ v1.1 \ Lib”! is it good?).excuse me if you see this question is weak, I am initial
|
|
|
|
|
Try asking in the forum attached to that article, rather than here (which isn't the right place to ask Managed C++ questions either)
|
|
|
|
|
How do I get the HINSTANCE of my dialog based application? I want to pass the HINSTANCE value in LoadStringW function as the first parameter.
|
|
|
|
|
Hi,
Try AfxGetInstanceHandle()
-----------
Mila
|
|
|
|
|
Thanks I actually found it. Please see if you can help me with the other question.
|
|
|
|
|
I found it myself. AfxGetInstanceHandle() will get the HINSTANCE of the app. But now LoadStringW(HINSTANCE hInstance, UINT nID, WORD wLanguageID); is returning zero. Why is this function failing? I am passing the correct language ID (1097).
|
|
|
|
|
Aljechin wrote: But now LoadStringW(HINSTANCE hInstance, UINT nID, WORD wLanguageID); is returning zero.
You need to pass value returned by AfxGetResourceHandle as first parameter.
|
|
|
|
|
That also didn't work. Here's what I am doing.
<br />
CString str;<br />
int ret;<br />
ret = str.LoadStringW((HINSTANCE)AfxGetInstanceHandle(),IDS_STRING102,(WORD)1097);<br />
if(ret)<br />
MessageBox(str,L"Welcome",MB_ICONINFORMATION);<br />
else<br />
{<br />
DWORD dwErr= GetLastError();<br />
}
GetLastError is returning 1815. But i can't find such an error in msdn. Why is this resource loading failing? IDS_STRING102 is an entry in a string table resource. It has the unicode value that must be loaded. If i directly use the unicode string in c++ file, it gets loaded.
|
|
|
|
|
dear, dear.
I mentioned AfxGetResourceHandle in my previous post.
Update you code like this,
CString str;
int ret;
ret = str.LoadStringW((HINSTANCE)AfxGetResourceHandle(),IDS_STRING102,(WORD)1097);
if(ret)
MessageBox(str,L"Welcome",MB_ICONINFORMATION);
else
{
DWORD dwErr= GetLastError();
}
And dont know why I was voted 1 for my previous post.
|
|
|
|
|
prasad_som wrote: AfxGetResourceHandle
Yes, in my previous post I told that also didn't work. Actually I edited it two minutes after posting. What could be the problem?
|
|
|
|
|
Aljechin wrote: GetLastError is returning 1815
This error code states,
"The specified resource language ID cannot be found in the image file."
See if you are going wrong there.
|
|
|
|
|
Actually this is the first time I am using Unicode in a string table. It works fine with non unicode strings. There is no error. Is there some special setting that I need to do in that string table or my project for loading the string successfully in runtime? I thank you very much for your time.
|
|
|
|
|
I'm not sure. How you are sending last parameter ? i.e. language Id.
From error it seems, its not defined in resource file.
Is it different from English ? If yes, is it defined in .rc?
|
|
|
|
|
prasad_som wrote: How you are sending last parameter ? i.e. language Id.
ret = str.LoadStringW((HINSTANCE)AfxGetInstanceHandle(),IDS_STRING102,(WORD)1097);<br />
It is unicode and of course different from english. I don't know if its defined in .rc file. How do I do that?
|
|
|
|
|
prasad_som wrote: How you are sending last parameter ? i.e. language Id.
<br />
ret = str.LoadStringW((HINSTANCE)AfxGetInstanceHandle(),IDS_STRING102,(WORD)1097);<br />
It's of course not english. I don't know if its defined in .rc. How do I do that?
|
|
|
|