|
|
You have a handler for button clicks.
In that you use SetTimer() to get your timer running.
Windows will call your OnTimer() function.
There you do whatever needs to be done.
Now you should have more than enough to look up!
Failure is not an option - it's built right in.
|
|
|
|
|
I'll be nice and get you started, but you figure out the rest --- that's why you're in school, to use your brain.
Create a new member function like OnStartTimeButton(). Then you create the stuff that goes into that function. Like keep a counter or some variable to check each time to either start the time or stop the time. Enough said.
John P.
|
|
|
|
|
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I am trying to create a 4-bit bitmap from a 32-bit bitmap. Obviously this demands some sort of downcoversion from the 32-bit pixel values to the 4-bit values. I call GetDIBits with a PBITMIPINFO that is a 4-bit bitmap with a 16 color table. GetDIBits will do the downcoversion for me automatically right?
|
|
|
|
|
TheDelChop wrote: GetDIBits will do the downcoversion for me automatically right?
Yes.
I believe it creates the color table for you as well (based on the standard VGA palette according to the docs).
This article may or may not help: How To Convert Between Device-Dependent Bitmaps and DIBs[^]
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi all,
I have developed an VC++ (VS2005) application. It has a button on the form. When i click on the button, it executes another application using CreateProcess() and another window (application) pops up infront of the parent window. Parent waits (i am using WaitForSingleObject).
The problem is, if i click on the parent window, it shows "Not Responding" message. Here i am able click on parent window, but parent doesn't respond and shows white screen.
Can anyone please tell me how to disable the parent window until i click OK or Cancel of second window? It should be a kind of "Modal".
Is it possible?
Thank u.
|
|
|
|
|
Basically, you could do this:
EnableWindow(hwndMain, FALSE);
...wait for other app
EnableWindow(hwndMain, TRUE);
Using WaitForSingleObject() is halting all window message processing in your app, which is why
to the system, it's not responding. It's also not going to update its UI if you move other
windows over it.
To get around this, you may want to change the design a bit, something like:
1) Disable the main window
2) Start a second thread which launches the second app and waits
3) When wait completes on the second thread, post a message to the main window.
4) When the main window receives the message, enable the main window
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Mark Salsbery wrote: Using WaitForSingleObject() is halting all window message processing in your app, which is why
to the system, it's not responding. It's also not going to update its UI if you move other
windows over it.
That's where the MsgWaitForMultipleObjects API comes in handy. An example usage can be seen in ATL's AtlWaitWithMessageLoop function or you can use this ATL function directly.
Steve
|
|
|
|
|
Cool Steve!
I've never used MsgWaitForMultipleObjects(). Maybe I should take the time to go through the
list of synchronization functions and explore them thoroughly for gems.
Thanks for pointing that out!
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Anyone know of any classes or even a program that will convert pdf documents to html, preferably preserving as much of the formatting as possible?
I'm not really fussy about what language, but prefer something C++
|
|
|
|
|
Does this[^] link helpful?
|
|
|
|
|
Thanks whitesky, but I need it to go the other way PDF to HTML. That looks like it only creates PDF.
|
|
|
|
|
The goal of my code is to filter some specific IP packet,just like the firewall.But one of the function in my code was always failed.The error code is 87(error parameter).I really don't known where goes wrong.I was puzzled of this problem.Any help is much appreciated.
<code>#include "stdio.h"
#include "windows.h"
#include "Fltdefs.h"
#pragma comment(lib, "iphlpapi.lib")
void main(int argc, char* argv[])
{
DWORD err = NO_ERROR;
// Create a filter interface
INTERFACE_HANDLE hInterface;
PfCreateInterface(
0,
PF_ACTION_FORWARD,//PF_ACTION_DROP,
PF_ACTION_FORWARD,//PF_ACTION_DROP,
FALSE,
TRUE,
&hInterface);
// Bind the filter interface to a IP
BYTE localIp[] = {192,168,0,111};
BYTE remoteIp[] = {220,181,38,4};
PfBindInterfaceToIPAddress(hInterface, PF_IPV4, localIp);
FILTER_HANDLE fHandle;
// Fill the filter struct
PF_FILTER_DESCRIPTOR outFilter;
outFilter.dwFilterFlags = FD_FLAGS_NOSYN; always use this
outFilter.dwRule = 0; //always use this
outFilter.pfatType = PF_IPV4;
outFilter.SrcAddr = localIp;
outFilter.SrcMask = (PBYTE)"\xFF\xFF\xFF\x0";
outFilter.wSrcPort = FILTER_TCPUDP_PORT_ANY; outFilter.wSrcPortHighRange = FILTER_TCPUDP_PORT_ANY;
outFilter.DstAddr = 0;
outFilter.DstMask = 0;
outFilter.wDstPort = 1;
outFilter.wDstPortHighRange = 10000;
outFilter.fLateBound = LB_SRC_ADDR_USE_DSTADDR_FLAG|LB_DST_ADDR_USE_DSTADDR_FLAG;
outFilter.dwProtocol = FILTER_PROTO_ANY;
err = PfAddFiltersToInterface(hInterface, 0, NULL,1, &outFilter, &fHandle);
//PfAddFiltersToInterface always failed
if(err != NO_ERROR)
{
int exitcode = GetLastError();
printf("PfAddFiltersToInterface is Wrong\n");
printf("The error exit code is %d\n", exitcode);
//return ;
}
printf("Try to connect to the internet...\n");
char ch=getchar();
printf("Filter Enabled!");
// Remove the filter interface
PfRemoveFilterHandles(hInterface, 1, &fHandle);
PfUnBindInterface(hInterface);
PfDeleteInterface(hInterface);
return;
} </code>
|
|
|
|
|
Hi i am rewriting a piece of MFC(vc++6)code in VS2005 (MFC).
There is a code as shown below..
<br />
ofstream file;<br />
file.open("abc.seg", ios::out|ios::binary);<br />
Is this code wrong. Well as no intellisence IS coming up for ios in this and even in msnd i could not find any info about ios::out and ios::binary..
I guess there must be some changes in the same. Well though i am not getting error at the moment. I can build it. What coudl be the reason...???
So could any one shed some light over it and also what exactly that parameter is doing....
Thanks
SS
|
|
|
|
|
Software_Specialist wrote: ...in msnd i could not find any info about ios::out and ios::binary..
Why not? It's all right here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
oh thanks
So do we have to now use ios_base instead of ios....
i was looking for ios::out ...So is there any documentation or anything from where i could see what all is changed in VS2005 MFC. I guess in earlier version ios::out and ios::binary was supported...
Thanks for replying back...
|
|
|
|
|
Software_Specialist wrote: So do we have to now use ios_base instead of ios....
No. ios is a typedef of basic_ios , which is derived from ios_base .
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
ios is a struct buried away deep in the C files of the runtime (CRT) library your code is linked to e.g. MSVCRT.DLL. out and binary are memebers or enum values or some such of ios which form bit flags for the mode for low level io. Intellisense is a bit lacking on the CRT, especially if the CRT sources are not in your projects source search path.
This stuff is all still valid but a little old fashioned in terms of naming conventions, use of language features and structuring of the code which makes it hard to understand these sources. No worries
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
ah okay
so intellisence doesnt work for ios here...
I was bit cofused because this ios:: gives me intellisence but there is no out or binary option in it. And now i tried with ios_base:: and even this is not giving me any intellisence..So anyway i guess its allright to stick to ios::out and ios::binary as you said..
Thanks a lot
|
|
|
|
|
Software_Specialist wrote: I was bit cofused because this ios:: gives me intellisence but there is no out or binary option in it.
I've not ever seen enum items show up in the Intellisense list.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: I've not ever seen enum items show up in the Intellisense list.
They show up in VS 2003 .NET
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Nopes they are showin up in VS2005(MFC).
|
|
|
|
|
Hi
I want to display a jpeg format picture in Visual C++ 6 and I want to ask that can I use CImage for that? CImage is under Visual Studio 2005 in msdn wep page.If I can use it in Visual c++ 6 how can I do that? If not is there any other simple way?
Thanks
|
|
|
|
|
You can also use of OleLoadPicture .For CImage class a short code is
#include AtlImage.h
CImage m_Image;
m_Image.Load("C:\\1.hpg");
m_Static.SetBitmap(m_Image.Detach());
Im not sure you can use of CImage on the VC6.0 or no but also on the codeproject is an article its name CXImage.
|
|
|
|