|
ohhh, well, thanks for dashing...;)
|
|
|
|
|
I have a C program, using Visual C++6 development environment, running under Windows 98. I want to write some finalisation information and close a logging file when the program closes.
To do this, I watch for WM_QUIT in the message loop in WinMain(), and when this arrives, I write to the file and close it
This works fine when I shut down my program "normally" (click on "close" button or File / Exit), but when my program is running, and the user shuts down Windows, I do not detect this, so the finalisation info is not written.
How can I detect Windows shutting down? (as I said, preferably at the SDK level.)
|
|
|
|
|
catch WM_ENDSESSION in Single USer based OS ie 95/98/ME
catch WM_QUERYENDSESSION in Multi user based OS ie 2000 and above.
this Message is Send by Window OS when it is shuting down
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Thanks - that does the job!
|
|
|
|
|
Hi there,
Can anyone tell me how to set the initial postion of a deskband.
I have succesfull executed the Band Object Implementation Sample from MSDN
But the desk band Initially is always, docked on the taskbar.
What I want is, initially, the deskband to be docked on the right side of the screen.
Thanks in advance,
Kumar.
|
|
|
|
|
hey,
I have a Text box.I set its max range to 10 and min to 1 using the classwizad. when a entering a wrong value,MFC showing a message like "please enter the value between 1 and 10" .I need to change the Caption of this dialog. Now its showing the application name like "Appnam~1".
There is any simple way to set the caption of this dialod to predefined value?
Thanks in advance
shijuck
|
|
|
|
|
MFC uses the application name for this. You need to look at the AFX_IDS_APP_TITLE value in the
string table section of your resources.
Iain.
|
|
|
|
|
Hi!
I need to create a top-most window that display a full-screen movie. I want to prevent the user from switching from my application to another, ie disable the ALT-TAB key combinaison.
How can I do it?
Thks in advance!
Appstmd
http://www.atlence.com
|
|
|
|
|
Can anybody come to my help to guide me converting one format to another of audio/video files
|
|
|
|
|
Can you please specify which format you want to convert (to and from). Do you need code or tool?
ARSALAN MALIK
|
|
|
|
|
A good number of them are available here.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi All,
I have managed to Host (C#)Windows Froms Control in MFC Application.
MFC Application is Dialog based application where i did "Insert ActiveX Control" on a dialog and i am able to see the Control on Dialog.When i execute Program it runs fine.
Problem is after that when i Close Development Environment (VC++(6.0) IDE)and open it agian,it gives error "The ActiveX Control can not be instantiated"
"The ActiveX Control MyControl.MyControl1 Failed to initialize properly"
And in Design environment it shows Blue background on my control.But when i run it it runs fine.
It is very annoying ,every time i closes and opens the IDE error is shown.
Can anybody give some advice on this.
Thanks
TusharM.
|
|
|
|
|
how to restricted browser in vc++
vb is working web browser.
and vc++ is working or not..
|
|
|
|
|
I don't understand what do u want to say here
vc-programmer- wrote:
vb is working web browser.
and vc++ is working or not..
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Hi all:
In CP I came across a demo project, and when I start trying to grasp It's source code, the following declaration really comfuse me up!What this colon is all about?
Is anyone can give me a explanation? I appreciate that!
struct MP3FRAMEHEADER
{
unsigned emphasis : 2; // M
unsigned original : 1; // L
unsigned copyright : 1; // K
unsigned modeext : 2; // J
unsigned chanmode : 2; // I
unsigned privbit : 1; // H
unsigned padding : 1; // G
unsigned samplerate : 2; // F
unsigned bitrate : 4; // E
unsigned hascrc : 1; // D
unsigned mpeglayer : 2; // C
unsigned mpegver : 2; // B
unsigned framesync : 11; // A
};
|
|
|
|
|
The : n notation is specifying bit fields, in this case, 32 bits total. It's a hint to the compiler that it can store all those in a 32 bit unsigned int, although it doesn't imply any particular ordering. It saves you from having to use bitshifts and masking. You don't see it that often, but it is mentioned in language references.
Seems developers now pay as much attention to those as journalists (at least here in the UK) do to English grammar and punctuation references...
Steve S
Developer for hire
|
|
|
|
|
Thanks a lot.
But can you give me a example, or It's application?
|
|
|
|
|
It's very simple - say you're working in a very tight memory space (some kind of embedded system that doesn't have huge amounts of RAM)
On a normal PC, you'd probably just assign everything as ints
struct DATETIME
{
int nDay;
int nMonth;
int nYear;
int nHour;
int nMinute;
int nSecond;
}
making the assumption that each int is 32bits (4 bytes) then you'll see that each DATETIME will take 24 bytes of memory
Now, if you think about it, you don't need 32 bits for each of these variables
Day can be from 1 to 31 - so fits in 5 bits
Month can be from 1 to 12 - so fits in 4 bits
Year can be represented as 0..256 if you add on a year offset (and don't intend to use years in the far future or in the distant past) - so 8 bits
Hours: 0..23 - 5 bits
Minutes: 0..59 - 6 bits
Seconds: 0..59 - 6 bits
So if you total all those up (5+4+8+5+6+6) you get a total of 34 bits
struct NEWDATETIME
{
unsigned char nYear;
unsigned int nDay:5;
unsigned int nMonth:6;
unsigned int nHour:5;
unsigned int nMinute:6;
unsigned int nSecond:6;
}
The actual amount of memory used will vary depending on how inteligent the compiler is, but if it behaves correctly it'll use far less memory than the original struct (and if you've got thousands of these in memory, you'll see what a saving it'd be!)
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
struct NEWDATETIME
{
unsigned char nYear; // 8 bits is all we need
unsigned int nDay:5;
unsigned int nMonth:6;
unsigned int nHour:5;
unsigned int nMinute:6;
unsigned int nSecond:6;
}
So the colon operator in the declaration above simply means nDay, nMonth... takes several bits instead of 30 bits for each of them. Other than that there's no any different with the former declaration which is every member element in the DATETIME structure takes 30 bits regarding the implementation and assignment? Just out of memory consumption thinking?
Am I right?
|
|
|
|
|
Yup - basically if you type unsigned int nDay; you're saying "I want an int called nDay" and the compiler will likely allocate 32 bits for it.
If you have unsigned int nDay:5; you're saying "I only need 5 bits for this variable" - whether the compiler allocates 5 bits, or gives you a full 32 bits is up to the compiler, but if it works properly it'll let you save memory.
So in other words, 9 times out of 10 you'll probably never use it.
In the example you gave, it looks like it's something to do with parsing the data in an MP3 file - this is quite a common use of bitfields, since it lets you quickly read in an abstract binary file into sensible variables
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
Well, Thanks a lot.I really appreciate your patience!
Yes, I'm working on a MP3 file parsing!
And I'v got the example source code, but It seems hard to grasp!
|
|
|
|
|
See here.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I am comparing two bitmap files, when a match has been found between two bitmaps, the matched portion should be highlighted by drawing a rectangle around it.
pls help with some coding
|
|
|
|
|
How can I get parameters (signature) of a function exported by a C DLL? I am looking for a tool or any code that achieves this. Dependency Walker fails to show signature of C functions, why?
ARSALAN MALIK
|
|
|
|
|
That is why you need the header files for the dll/lib.
onwards and upwards...
|
|
|
|