|
The OLE control is obviously failing on creation, leading to your other errors. If it works with another
program on the same machine, then you are missing something specific. It may be that the other piece of
software is using a similar ocx, or even an older version.
Are you running AfxOleInit in your CMyApp::InitInstance member function?
Have you looked to see what 0x80040154 means?
Another trick is to use regmon from www.sysinternals.com to see where CoCreateInstance is failing.
You may have a different version (and therefore different GUID) of the ole control on your machines.
etc.
Happy hunting,
Iain.
|
|
|
|
|
Iain,
You were correct. The OLE control was failing on creation, because although it was registered, my application could not find it. It turns out that the path of the .ocx control MUST be in the OS search path in this case, and then re-registered with regsvr32 IN THE NEW PATH.
This was a lesson to me not to drill down into valuable, working code searching for runtime errors not directly caused by that code.
Thank you,
-DK
|
|
|
|
|
Sounds like you've had a frustrating last couple of days.
Mind you, its always nice when the solution in non-obvious.
Less embarassing at least!
Glad you've cracked your problem,
Iain.
|
|
|
|
|
How to change font of Cdialog programmatically ?
I use Create(IDD, CWnd*) function.
thanks.
|
|
|
|
|
Add a CFont member variable to the dialog's declaration. In the dialog's OnInitDialog() method, use:
LOGFONT lf = {0};
lstrcpy(lf.lfFaceName, "Arial");
m_font.CreateFontIndirect(&lf);
SetFont(&m_font);
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Your method is not work,
also
virtual OnSetFont(Font*) - for settinf font,
not works.
Works:
http://www.codeguru.com/Cpp/W-D/dislog/fonthandling/article.php/c2023
Problem now- how to acces private members of CDialog,
if I want to create reuseable class for CDialogs
for font change ???
|
|
|
|
|
vgrigor wrote:
Your method is not work,
My apologies. The code snippet I provided was from a project in my archives. Those are from many years ago and apparently do not work with newer versions of MFC.
vgrigor wrote:
file:///E:/Doc/www.codeguru.com/dialog/ChangeDefaultDialogFont.shtml
This is a file only accessible by you. From what I could find CodeGuru has no such article.
vgrigor wrote:
how to acces private members of CDialog,
The dialog itself can access all members, regardless of their privilege.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I changed link. PLease , See above.
|
|
|
|
|
Code from above article do not work for ActiveX,
do you know how to correct it for that purpose?
<br />
int Create_WithHelper(int IDD, CWnd* pParentWnd, int isModal, int size, CString FontName = "MS Sans Serif")<br />
{<br />
<br />
CDialogTemplate dlt;<br />
int nResult;<br />
<br />
if (!dlt.Load(MAKEINTRESOURCE(IDD))) return -1;<br />
<br />
<br />
dlt.SetFont("Arial", 14); <br />
LPSTR pdata = (LPSTR)GlobalLock(dlt.m_hTemplate);<br />
<br />
<br />
m_lpszTemplateName = NULL;<br />
<br />
HINSTANCE hInst = AfxFindResourceHandle(MAKEINTRESOURCE(IDD), RT_DIALOG);<br />
<br />
BOOL bResult ;<br />
<br />
m_hDialogTemplate = dlt.m_hTemplate;<br />
<br />
<br />
<br />
if(isModal) <br />
{<br />
nResult = <br />
DoModal();<br />
}<br />
else<br />
{<br />
bResult = <br />
CreateIndirect( dlt.m_hTemplate, pParentWnd);<br />
}<br />
<br />
<br />
<br />
GlobalUnlock(dlt.m_hTemplate);<br />
<br />
if(m_hWnd == 0 )<br />
ASSERT(0);
<br />
<br />
return bResult; <br />
<br />
};<br />
|
|
|
|
|
CFont *font = new CFont;
font->CreateFont(14,0,0,0,1200,0,0,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_DONTCARE,"Arial");
m_example.SetFont(font);
the first number is the size. play around with the numbers for your liking.
I have a class called label.cpp label.h if you need it. It makes 3d fonts and all. Send me an email to junkmail4tony@comcast.net with a subject line of would like label class files. I will happily send it to you.
|
|
|
|
|
win32newb wrote:
...if you need it.
I don't, but vgrigor might.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
It sounds like the .ocx file has not been properly registered. You can register it with the regsvr32.exe program.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hello,
i have a little problem with the interpretation of CreateNamedPipe(...)
what exactly is the difference between the dwOpenMode flag FILE_FLAG_OVERLAPPED and the dwPipeMode flag PIPE_WAIT, and which of those is used if both are specified?
Thanks in advance!!
|
|
|
|
|
hph wrote:
what exactly is the difference between the dwOpenMode flag FILE_FLAG_OVERLAPPED and the dwPipeMode flag PIPE_WAIT...
One relates to the calling thread, while the other relates to the pipe itself.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
ok, thanks! and what does this mean ?
|
|
|
|
|
See if these two help:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ipc/base/createnamedpipe.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ipc/base/named_pipe_type_read_and_wait_modes.asp
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
yes it helped, thank you, i got it!
|
|
|
|
|
Hi All!
How to debug the system wide hooks? Any artical or material will be highly appreciated.
Regards,
Bilal Anjum
|
|
|
|
|
Hi all!
I have a question regarding the computer's virtual memory.
I am writing a program to simulate all kind's of combinations of a poker hand. To do this I wrote 5 while statements. This will give a complexity of about O(50 exp 5) = O(312 500 000) in the last while statement I will do some calculations. The problem is that when I run the program a run out of virtual memory ( I have increased the limit to 4GB ). I am confused why I run out of memory, I did't think the while statements would consume any memory (almost) . Could it be that I have a memory leak in the calculations that I make.
So I guess my question is; will these while statements use all the computer's virtual memory depending on the complexity?
Thanx!
Martin_j
|
|
|
|
|
martin_j wrote:
I have increased the limit to 4GB.
Not possible, even if you were using Windows 2000 AS or DS with the /3GB switch.
martin_j wrote:
So I guess my question is; will these while statements use all the computer's virtual memory depending on the complexity?
No, while statements do not use memory in the quantity you are asking.
It sounds like you need to open the Performance Monitor when your program starts and watch its memory consumption.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Are you allocating any memory in these while loops ???
You need to check ur system performance.
Is there any considerable amount of harddisk space left ?
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
Thanx for your answer.
I do call a procedure in the last while statement wich is using pointers. So I'm afraid I do not delete these pointers properly.
While I check the system performance I can see that I use more and more virtual memory. It stops at about 2.1GB (all used) and then fills the RAM. Thereafter the program crashes.
I do have about 100GB frre space on the hard drive.
I talked to a friend and he proposed that I should use case statements instead. What would be the differense?
/Martin
Martin_j
|
|
|
|
|
I think... the you should delete your pointers properly!
|
|
|
|
|
martin_j wrote:
So I'm afraid I do not delete these pointers properly.
Properly or not, are you deleting them at all? Remember that every new must have a matching delete .
martin_j wrote:
I should use case statements instead. What would be the differense?
Instead of what? The switch/case statement is synonymous with the if/else statement.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Sorry, I meant do/until.
I do delete all pointers as far as I can see.
Is there an easy way to debug the program and see if there is a memory leak?
/Martin
Martin_j
|
|
|
|