|
Hi all!
I have a really strange problem in my project. It is a rather large windows application with a lot of different Dialogs. I'm using VisualStudio 2003 and the projcet is a Win32 (not .Net) project.
The problem is that Windows (or something) sends strange WM_WHATEVER to my main window.
I added the function:
BOOL CApp::PreTranslateMessage(MSG* pMsg)
{
//Onni is blocking a nasty kind of message
char txt[100];
if((pMsg->message == WM_DEVICECHANGE || pMsg->message == WM_TIMECHANGE || pMsg->message >= 0xc0000))
{
MessageBox(NULL, itoa(pMsg->message, txt, 16), "Caught Windows Message", MB_OK);
pMsg->wParam= NULL;
return TRUE;
}
return CWinApp::PreTranslateMessage( pMsg );
}
This blocks all messages above 0xc000 (and the WM_DEVICECHANGE and WM_TIMECHANGE but I know I dont want them, it causes a crach every time if I let them trough)
In the MSDN I read that messages above 0xc000 are application defined. And that a certain function is responsible for giving uniqe values to all the applications that wants to create new messagetypes.
I have tried to block them all. This works on most computer. But sooner or later it gets stuck in a loop: I click the ok button in "Caught WindowsMessage" and as soon as the messagebox is gone another with the same number shows up. An eternal loop, all thats left to do is Ctrl-Alt-Delete.
If I let them all trough the program crashes after a few minutes with no explanation. And when I run it in debug mode I can trase the error through the callstack to the PumpMessage() with a Windows Messages with a number like 0xc0d1
Whats going on?
I never asked for those messages!
How do I get rid of this problem?
The application is due to be realeased soon and panik is creeping up on me.
Some describing smileys:
/Onni
Onni Qvickstrom
onni.qvickstrom@genline.se
|
|
|
|
|
Messages in the range 0xC000 - 0xFFFF are registered messages, registered using RegisterWindowMessage .
If you don't understand a message you should always pass it down to DefWindowProc , which MFC will do for you if you don't add a handler.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Thats what I did initially.(Let all the messages through.) The problem was probably something completly different.
I reinstalled VS7 and cleaned up a few ASSERTION errors in my code. And pof! The problem was gone.
Thanks for you help!
Some describing Smiles:
/Onni
|
|
|
|
|
Hi all,
I want my application to output some short text on screen when critical error happens. I saw some programs did that (normally with sound mute setting etc) but have no idea how is it possible?
Appreciate any help, or even better some sample code . Thank you in advance.
Will
|
|
|
|
|
|
What I've forget?
There is Ownerdraw Combobox class (C++ but not MFC), when creating as dropDOWN type Control it works well ( when change selection in ListBox part - Edit part's text also changes), in the same way navigation correct displays text in static part at choice not Ownerdraw, but when style is Ownerdraw dropdownLIST - in static part I see nothing! Though at losing the focus of this combobox the text appears.
Help plz., any advice or small example!
Tanks.
|
|
|
|
|
Can anyone help me with an image i extracted from an XML file where it was encoded using bin.base64? It doesn't seems to be any of the known formats. Please contact with me by e-mail.
|
|
|
|
|
Hey all,
I'm trying to figure out how to directly write to a device in Windows. Basically, what I'm wanting to do is create an image of a device (specifically, a CompactFlash card that doesn't use a filesystem Windows recognises), store it as a file, modify it and dump it back to the card.
Currently, in version 0.001 of my program, I'm just calling dd for Windows using ShellExecute - this works perfectly, but obviously this isn't exactly acceptable for the final product! (and in the kludgy way I've done it, it locks the whole program and I can't implement a progress bar etc etc)
I'm HOPING it's as easy as using fopen and just treating it like a file from then on (sorry, that's my Unix background speaking)...
Any help would be much appreciated.
|
|
|
|
|
these Api may help you in achieving above
- CreateFile
- ReadFile
- WriteFile
you can refer for documentation of above api's in MSDN library.
"I Think this Will Help"
[Vote One Here,.....]
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
Thanks for that - the MSDN entry for CreateFile explains it all quite nicely. I actually feel pretty foolish now since that's the same naming convention used in "dd for Windows" for accessing the drive (that is - \\.\x: where x is the driver letter)... Obviously I now know why!
|
|
|
|
|
And Frankly Speaking i never used these api's i have just used the wrapper of it when i communicating with smart cards.
hope it's work well for you
"I Think this Will Help"
[Vote One Here,.....]
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
I have a negative double number, say, -11.0, when I use pow() to find its power of 1/3, I return NAN.
double a = -11;
double power = pow(3, -1);//1/3
double result = pow(a, power);
the result is not equal to (-11)^(1/3), but is NAN
However, when I change the power = 3, the result is normal.
Is that pow() cannot find a x^y for x<0 and y<1?
thanks
|
|
|
|
|
I guess that pow does not find roots of -ve numbers since all even roots are imaginary.
If you are always getting the cube root for your negative numbers.
You can do the following:
1) Make the number positive.
2) Get the cube root of the positive number.
3) Make the answer negative (multiply by -1).
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Hello all...
I've been developping an application to render Videoclips or still images to fullscreen, with the ability to fade smoothly between clips.
I was facing a great CPU consumption (>50%) using DirectShow Filters and VMR9. Furthermore it was quite hard to make the system stable since the filtergraph is modified each time a video clip of a different format is added.
Now I was checking out the Video for Windows (VfW) capability of the Platform SDK. I wonder if it would be worth a look at. An advantage of DirectShow surely is the independence of formats, as much as I know VfW works mostly with AVI.
Does anybody have some experience with VfW?
How about the other formats like MOV or MPG?
Regards
|
|
|
|
|
DirectShow supersedes Video For Windows, with a very few exceptions - a very small number of the AVI functions from memory. If you need help on issues this specific to DirectShow it may be better to contact a more specific forum. I've found DirectXAV to be very helpful in the past.
Microsoft have also announced that DirectShow support will be deprecated in the near future and a new improved multi-media API will be made available. From what I can remember it's on a similar timescale to avalon, I'm not sure what will happen to VfW support when this happens.
|
|
|
|
|
Hi.
Does anybody know an open source resource editor/compiler,
desirable - compatible with VC++ 6.0?
Thanks.
|
|
|
|
|
|
|
how do you read an argument passed to a dialog application?
For example, i have compiled a dialog application in c drive named "test.exe"
how do i modify the code so that it can read the argument passed into it?
for example if i type in command prompt:
c:\>test mod
the application should read the argument 'mod' passed into it
how can i do that?
|
|
|
|
|
hi
In your App Class Add following into InitInstance()
// Get Command line arg.
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
then look for members of CCommandLineInfo .
or
u can also use
::GetCommandLine();
look more about this in MSDN
Jetli
Constant Thing In World Is Change.
|
|
|
|
|
|
|
In addition to Jetli's suggestion, you always have access to __argc and __argv .
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I’m working in images transportation methods; the images I’m working on are facial photos. It has white background. It’s capacity 80KB for BMP and 11KB for JPG.
My problem that I can move these types of images by 1KB size only. So I used “Lead tools” (www.leadtools.com) as compression tool which compressed it till my 1KB exactly by J2K extension. However, I lost some of the quality to reach the limit I need even after I decompress it again. On the other hand, I need the image after it’s transported to be printed on an ID cards; therefore I need it with good quality.
That’s why I’m looking for either a compression tool that compress the image till that extend with good quality, or the have a tool could fix the decompressed image by adjusting the sharpness ,.. Etc. BTW, all mentioned solutions are going to be done automatically on the runtime, no user should handle these issues.
Any ideas to help me.
Thanx all
|
|
|
|
|
You can use the PNG format to losslessly compress an image (i.e. you won't lose any image quality) but it won't reduce the file size by anything near as much as JPEG compression does (since JPEG works by throwing away "less important" data, which is why the quality goes down)
Something else to try is that the JPEG format has a quality setting - so you can experiment with what quality you use when compressing your images until you find the right trade-off between quality and size.
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|