|
Can you give us a sample of the OnInitUpdate function? We can't really make any educated guesses without any clues.
|
|
|
|
|
john5632 wrote: But If I override OnInitUpdate it is not executed in my drived class.
How are you verifying this?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
may be u forgot to attach the ID of the form in the .H classe file !!
is the form loaded or no ? and what kinf of errors do u ve got ?
"The Ultimate Limit Is Only Your Imagination."
|
|
|
|
|
Hallo,
I have a Windows Service written in Visual C++. It`s a loop that does certain things, and starts from the beginning after waiting a few seconds.
My problem is, that when there occurs an error in the code, a messagebox pops up. And the code is not executed anymore, because you have to click on "ok" first. The messagebox is showed from some external library functions, so I can`t go to the source code.
Is there any possibility to redirect all message boxes to a logfile or something like that, and continue executing the program without a click by the user?
Thank you!
|
|
|
|
|
Well, first of all, if there are errors popping up, shouldn't you rather try to figure out what causes them and try to fix it, besides, maybe the user has to/wants to know about these problems, so "supressing" message boxes might not be a good idea. Depending on how the message boxes are displayed, i can think of a possible way to do what you want if you insist.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
Code-o-mat wrote: i can think of a possible way to do what you want
Please show how can the ::MessageBox() can be suppressed and corresponding message be directed to some file.
|
|
|
|
|
Sorry for the late answer, wasn!t near net access for a day. So, you could try hooking the MessageBoxA and/or MessageBoxW API functions and provide your own implementations to write to a log file. I don't know what you are actually doing so i can't really judge but i still don't think supressing message boxes intended for the user is a BAD IDEA. Anyways, for api hooking, see API hooking revealed[^] here on Code Project.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
Thank you for the Link, I will try this.
As I described i`m working at a Windows Service. It is a loop that changes things in a database and send mails and things like that, so there is no user in front of the computer at all, and when a message box pops up, the whole service stops, and mails are not sent anymore. So this service has to continue running when an error occurs. I just want the error in a logfile to see what happened and fix it later.
|
|
|
|
|
I see, with no user at the box it makes more sense. Tell me if you run into trouble with the hooking and i will help if i can.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
Hi Folks,
Please tell me how can i obtain the thread id of the window/application which have keyboard focus?
Regards,
John.
|
|
|
|
|
Use GetForegroundWindow() and GetWindowThreadProcessId (...).
|
|
|
|
|
Hello,
I have an owner-draw listBox that while updating its flicks, I tried the solution of treating the event OnEraseBkgnd its didn't work, so I tried the other posibility - double buffering
void CIconListBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
HDC memDC1 = CreateCompatibleDC(lpDrawItemStruct->hDC);
HBITMAP hMemBmp = CreateCompatibleBitmap(lpDrawItemStruct->hDC,
scrW, scrH);
HBITMAP hOldBmp = (HBITMAP)SelectObject(memDC1, hMemBmp);
CDC *memDC=CDC::FromHandle(memDC1);
.
.
if(m_pImgClose)
m_pImgClose->Draw(memDC,0,pt1,ILD_NORMAL);
.
.
memDC->DrawText(line.word[1].str, -1, &rText, DT_LEFT);
.
.
SetTextColor(memDC1,oldcolor);
.
.
BitBlt(lpDrawItemStruct->hDC, 0, 0, scrW, scrH, memDC1, 0, 0,
SRCCOPY);
SelectObject(memDC1, hOldBmp);
DeleteObject(hMemBmp);
DeleteDC(memDC1);
}
for some resone its doing the background black instead of white as it was before the double buffer.
if anyone know what is my problem ,I would be very greatfull for him.
|
|
|
|
|
Before drawing on your memory device context, have you ever filled its background color? The CreateCompatibleBitmap produce a bitmap initially black, then you need to fill it with the color you want, e.g. using the CDC::FillSolidRect (MFC)[^] API.
|
|
|
|
|
thank you very much its solved my problem
|
|
|
|
|
Hi Guys, I am developing a MFC application using Microsoft Visual Studio 2008, i have a strange error, i dont know how to solve it, if any one know pls tell me the reason..
Error 1 general error c101008a: Failed to save the updated manifest to the file ".\Debug\Account Pro.exe.embed.manifest". The parameter is incorrect. mt.exe
|
|
|
|
|
I regularly see the same error with Visual C++ 2010 Express, but a rebuild always fixes it. I suspect some timing issues in the build process that causes mt.exe to fail. I have not researched the solution since it is always recoverable.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
I experienced too the same issue. Searching the Internet, I found an explaination of it: the build process basically moves through 3 steps:
- compiling
- linking
- embedding manifest
After the linking stage, you have a new exe file on your output folder, and the Manifest Tool (mt.exe) is called on it to embed the application manifest. If you have an AntiVirus that perform real-time scanning, is possible that immediately after the linking stage and before that the Manifest Tool gets access to the executable file, it find the new executable and lock the file to scan it for viruses; in that case, the Manifest Tool gets the file locked for writing and fails.
|
|
|
|
|
An interesting analysis; but I wonder why it only ever affects the manifest builder and never the compiler, linker or any other program I run?
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
It is not so strange for me: let's assume that the AntiVirus real-time scanner only scan executable files... Then the compiler could not be affected, because it gets source files and produces object files; the linker could not be affected because it gets object files and produce an executable file, but the AntiVirus is not able to scan the created executable until the linker closes the file. Then it seems that the only one tool that could be affected is the Manifest Tool as it gets an executable file that already exists and open it to modify its content.
Anyway, this is the only one explaination that I found, but I'm not sure that it's correct nor that it could be the only one reason for the Manifest Tool to fail... I found too something about this issue on the official technical blog of the VC++ team, and I wonder that they simply said: "after our tests, we was not able to reproduce the issue"
|
|
|
|
|
Yes, that makes sense, I may try modifying my anti virus settings to see if it has any effect.
Thanks for your comments.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Hi,
How to set control ID at runtime?
|
|
|
|
|
You can use SetWindowLong[^] e.g.:
SetWindowLong(handle_to_your_control, GWL_ID, the_new_id);
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
I'm testing in Dialog based Application.
I've remove the default title bar and draw bitmap in client region.
The problem is that when I set menu in this dialog, menubar is appeared at top of screen ,above of the bitmap titlebar.
How can I change the position of Menubar?
|
|
|
|
|
If you're not using the default title bar and drawing your own, then you will need to do the same in the case of its menu also.
You will need to draw the menu yourself and handle the button clicks on the menu items.
|
|
|
|
|
Is there anyway to create an Office 2010 style ribbon (Aero tabs and Backstage) with Microsoft's Windows Ribbon Framework?
|
|
|
|