|
here's a basic MsgPump function:
<br />
void MsgPump(DWORD dwLen )<br />
{<br />
MSG m_msgCur;
<br />
CWinApp *pWinApp = AfxGetApp(); <br />
<br />
DWORD dInitTime = GetTickCount();<br />
<br />
while (::PeekMessage(&m_msgCur, NULL, NULL, NULL, PM_NOREMOVE) &&<br />
(GetTickCount() - dInitTime < dwLen) )<br />
{<br />
pWinApp->PumpMessage();<br />
}<br />
<br />
}<br />
Call this periodically in the code where you do your work. You don't have to call it all the time, just once in a while. The dwLen is the number of ticks to wait. 200 is a good default.
-c
Software | Cleek
|
|
|
|
|
Thank you! It worked perfect. Even when dwLen=1 it is enough to make the second dialog accessable.
|
|
|
|
|
ryuki wrote:
wd->EndDialog(0);
EndDialog() is specific to modal dialog boxes.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Alternatively to the message pump, you can create a worker thread to do your job. There are some excellent articles in CodeProject about it (here for instance)
|
|
|
|
|
Hello, all. I'm trying to have the program I'm writing raise its class and thread priorities on a button click. I can change the thread priorities just fine, but I'm having trouble with the priority class. Here's the code from the function that I'm using to change the priorities:
HANDLE Hand;
BOOL Check;
DWORD Error;
Hand = GetCurrentThread();
Check = SetPriorityClass(Hand, HIGH_PRIORITY_CLASS);
Error = GetLastError();
Check = SetThreadPriority(Hand, THREAD_PRIORITY_HIGHEST);
Error = GetLastError();
Does anybody have any idea why I can change the thread priority but not the priority class?
Thanks,
Phillip
|
|
|
|
|
BOOL SetPriorityClass(
HANDLE hProcess, // handle to the process
DWORD dwPriorityClass // priority class value
);
GetCurrentProcess will give u the handle of the current process
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Thanks for your help! Your solution works great!
Thanks,
Phillip
|
|
|
|
|
Hello,
I am using a CRichEditCtrl-derived class and I am setting it to use a bitmap .FON font. .FON fonts use 8-bit encoding and thus cannot support more than 255 characters. Everything works fine when I type in english, but when I switch to another language-keyboard, the font inside the CRichEditCtrl changes to some default (arial). I suppose this has something to do with using unicode (I work in WinXP) encoding, which is 16-bit and thus it does not correspond to any character in the bitmap font.
So, is there a way I can work around this to show my bitmap font?
Have no fear of perfection - You will never reach it
|
|
|
|
|
Just curious if there is an easy way to programatically retrieve the timestamp of a digital certificate?
Thanks in advance,
Colin Soule
|
|
|
|
|
Is it possible to add to #_DEBUG and #_RELEASE modes in order to accomplish compiling certain parts of a program vs leaving it out of the finished executable? That is _RELEASE mode leaves out all the _DEBUG pieces of code but is it possible to have another version of _RELEASE for example called _BASIC or _PROFESSIONAL whereas parts of the program would be a part of the completed .exe in _PROFESSIONAL and be excluded in _BASIC?
So far I have just placed the following in StdAfx.h
#define _BASICRELEASE
#define _PROFESSIONALRELEASE
whereas, leaving both uncommented gives the Professional release and commenting out PROFESSIONALRELEASE will give me a BASICRELASE.
However I would like to accomplish this like I would with Project Settings so that it gets augmented to all of my DLL's. Is this possible?
I hope I described that well.
Thanks!
|
|
|
|
|
Yes, it is possible.
First, you'll probably want to clone your current "Release" configuration, so you can have a "Baisc Release" and "Professional Release". (In VS.NET, there is a "Configuration Manager" button if you go to Project Settings, you can do it there. I forget where it is in VS 6.)
Once you've done that, you can go to your Project settings, C/C++, Preprocessor, and there is a line saying "Preprocessor definitions". Just add, say, _BASICRELEASE as a preprocessor definition for the "Basic Release", etc.
"Fish and guests stink in three days." - Benjamin Franlkin
|
|
|
|
|
Thanks! I understand and have implemented it! Cool!!
|
|
|
|
|
I have recently spent some time getting some of my apps looking right on XP styles, by adding a manifest resource, and also modifying some controls that are custom-drawn.
However, if I use my xp-style-enabled controls in apps which do not have a manifest, and therefore draw using the old style, I find that my controls still draw with the current XP style. I have used IsAppThemed() as a way of determining how to draw my controls, but I have found that this returns TRUE even though the app is not XP-style-enabled, making the control look odd! I have tried using IsThemeActive but this also always returns TRUE.
Does anyone know how I can find out if the app is XP-styled (ie the other controls are using the XP-styles)?
"The way of a fool seems right to him, but a wise man listens to advice" - Proverbs 12:15 (NIV)
|
|
|
|
|
Dear Friends,
I would like to develop an application, which can display a image to a Projector instead of a Dialog's Display.
Please help to solve this problem. Is it possible to display the Dialog's display on a Projector? Any kind of suggesion will be highly appriciable. Please help me soon.
Thanking you in advance.
Billar
|
|
|
|
|
Billar wrote:
...display a image to a Projector...
Do you mean something like this that connects to the video card's S-video port?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Yes,
But I would like to develop an application which captures an image from camera and display it to a Projector.
Waiting for your response.........
Billar
|
|
|
|
|
I don't see that anything extra is required. Just display the image as you normally would, and if a projector is connected to the video card's S-video port, it will show up there too.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Does anyone know if it is possible to have a lib file that will contain a program which when a method (i.e. Run) is accessed by an external program the program in the lib file will start up a new thread and then execute itself whilst allowing the other program to carry on running?
If so is there any pitfalls I should be wary of and also is there any examples of how to do this? (I've never done libs before though I have done threading).
If it is not possible is there any other way of doing this? (the aim is 'fake' the combing of two programs together so that they appear as one, unfortunately bother programs need to be running at the same time and at present they communicate together using sockets). We cant just put the code straight into the other project and have it as a thread in it as the owners of the other program aren't allowed access to the source code for this program.
Not to sure I've explained this well, so if I havent then let me know and I'll try to give more details.
cheers,
Andy
|
|
|
|
|
I'll take a shot at describing what I've done in the past and you can decide if it is similar to what you are doing.
Let's say you have an MFC application project which contains some kind of user interface and application implementation. Let's also say that the application must link to a few, possibly many .lib files in order to build and link. It could be that the main app project is mostly the user interface and gui implementation and perhaps you have a complex situation where once the user configures something through the GUI, some complicated thread has to be started and will perform some task (such as opening a socket to some communication device such as an ethernet port or some other kind of port).
So you might have a lot of your code that is building and processing messages in an MFC extension DLL. So you must write that code within the DLL, compile it and have your application link to the resulting .lib files. Within the DLL, you would have exported a function, such as a RUN function of some kind, that the main application links to and calls. Perhaps the RUN function then uses AfxBeginThread to launch a thread which runs on it's own and performs whatever task it was designed to do. Meanwhile, Run returns to the main app which can move on to whatever task it needs to do next. I'm not sure if that is what you meant by Program within a lib file. The lib file is for linking but the .dll file is in the directory where the one and only .exe file and will contain run time info.
So if this concept is similar to what you are inquiring about, yes it can be done rather easily. Just don't forget to add some stop method along with the run method so that a thread shutdown method can be implemented to prevent crashes and memory leaks when the program is shut down. In my example, I'm really referring to one actual process (.exe) which links to .dll files containing functions that can be called. The .dll could also contain classes which contain the thread start stop functionality and that would be more OO. So perhaps the main app would link to a class that it could instantiate, and upon instantiation the class would launch it's own internal thread and kill the thread when the object is eventually destroyed using 'delete'.
Hope that helps; either way, my fingers got some good exercise.
Best Regards,
Shawn
|
|
|
|
|
hi everybody,
I am visual C++.NET & doing MFC Project with HTML support. Now I have to face serious problem when giving the path for Images in HTML.
for example:-
In the HTML page
But this path is a FIX ONE.when I use background="res/bg.gif" ,the Image is not displaying...
So what is the correct way to link Image with HTML Page in Visual C++.NET
|
|
|
|
|
Hi, try adding the image to you ressources then in the html use
<BODY background="res:/IMAGES/#144">
where IMAGES is the ressource type and 144 is the ressource ID.
|
|
|
|
|
I write very programs code with TCP/IP , IPX/SPX and netbios protocols that good work in win32 platform but I can not create a network connection between DOS and WIN32 , also I installed LSL.com DE22x.com(my net card driver) IPXODI.exe NETBIOS.exe in my dos workstation and installed IPX/SPX & NETBIOS protocols in my windows 2000 server station but my program in DOS workstation don't connect to my vc++ sample in windows station.
can you help me ?
Thanks
|
|
|
|
|
Hi,
I'd like to write a small DLL using MFC, which only should have a small dialog, and print some details on a printer. I'd like to call that DLL and display it's dialog from various MFC apps.
I simply don't know how to build an MFC-DLL containig a dialog, and what to notice. Do you have any hints for me how to begin, or a link to a tutorial?
Thank you very much in advance,
Erik
|
|
|
|
|
Select New from the File menu. On the New dialog, select the Projects tab. Select MFC AppWizard (dll), give the project a name, and click the OK button. Decide if you want a regular DLL or an MFC Extension DLL, and click the Finish button. Select Resource from the Insert menu. Select Dialog and click the New button. Populate the dialog template as necessary.
There are a few more steps (e.g., an exported function that will invoke the dialog) but these should get you headed in the right direction.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi all,
I've wrote an application based on the DirectX StillCap example, which allows the user to get the latest frame and then performs whatever segmentation methods they want on it. The problem which I have came across is that I appear to have more data than I am expecting! I'm expecting an 320x240 RGB image but the buffer I get is 233,472 long instead of 230,400 (i.e. 320x240x3).
Does anyone know what these extra 3,072 bits are (I'm guessing they may be header information)? And also where abouts in the stream they are appearing? as I'm not missing any information from the image when I save it so I'm assuming that is is probably at the end of the buffer (I've saved the buffer as a RAW image and then opened it up in Paint Shop Pro and everything appears fine)
Many Thanks,
Andy
|
|
|
|