|
Ok. Here what I want.
I have to print the files (sending to the printer).
I want to send next file after the current file is finished printing.
To do so, I can catch the messages that sent from printer (the printer that can send the messages to application) and respond differently to different messages like
. record the time of the file starts printing when application recieves STARTDOC message,
. record the time of the file finished printing, number of pages printed, and print the next one when application recieves ENDDOC message.
How to recieve the messages from printer.
The printer sends the messages like window messages to the application.
I used RegisterWindowMessage() and add ON_REGISTER_MESSAGE(printermsg,OnPrinterMessage) in the MESSAGE_MAP. I have no problem getting messages from printer.
Here the prolem comes,
My application has the button called "PRINT" and "STOP".
When user click on PRINT all the files get printed one after another. but it stop printing immediately when STOP button get hits.
So what should I do to look at printer messages to print one file after another, and at the same time, whatching if the STOP button get hited to stop printing immediately.
Thank you.
|
|
|
|
|
CPU usage increases for list view for same app under XP
-------------------------------------------------------
I've been working on an application for several years which uses MS ListView controls to display large grids of data (perhaps 50 lines by 100 columns).
background: The application displays market data, amongst other things, from electronic exchanges.
The application updates individual cells relatively rapidly.
I handled the CustomDraw events to provide formatting such as colors.
The list view is in virtual mode.
All was well on Win2000. CPU usage was reasonable. However, when I open the same window under XP, the CPU usage seems to increase dramatically.
I used the ATLControls.h list view wrapper as a thin wrapper around the control, and compiled under VC6, SP5.
Does anyone have any clues?
Thanks in advance
Dan Hill
|
|
|
|
|
Run per-method profiling on the application to determine which methods are using up the most CPU time. Also, try disabling the XP themes and run in classic mode to see if that is the problem (shouldn't be, but it never hurts to try).
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I have developed a Simple MFC GUI to allow a user to display and control an activity.
The program works fine on a PC with Visual Studio installed, but when I transfer the program
to a Laptop computer I get an Assertion Failure line 410 of file occmgr.cpp.
I build a Deployment & Install project to formally install the program, but still keep
getting the same error.
The pogram uses a DLL and events, the DLL is present on the Laptop.
I am stuck of things to try.
|
|
|
|
|
What is on this line?
What is it asserting ?
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Dont have any other information apart from the fact that can install the program on another PC without Visual Studio and it runs OK, but not on this Laptop computer.
We did try and install on other program and it failed in the same way!?!
|
|
|
|
|
Search for occmgr.cpp in your visual studio install directory
open it and go to line 410
You'll get some more info by doing this
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
section of file occmgr.cpp
if(pOccDlgInfo->m_pItemInfo[i].nId)
{
COleControlSiteOrWnd *pTemp =
new COleControlSiteOrWnd(
::GetDlgItem(pWndParent->GetSafeHwnd(), pOccDlgInfo->m_pItemInfo[i].nId),
pOccDlgInfo->m_pItemInfo[i].bAutoRadioButton);
ASSERT(pTemp->m_hWnd); !!!! This is Line 410 !!!! if(posOld)
|
|
|
|
|
The problem is a known issue to the VS.NET 2003, you can find the resolution in the following KB:
BUG: "HRESULT - 0x80010106" Error When You Run a Managed C++ Application
http://support.microsoft.com/?id=824480
However, for a MFC application, the managed entry point function should be
modified as:
//in Appname.cpp
...
#define _WIN32_WINNT 0x501 //for Windows2000, please use 0x0500
#include <objbase.h>
#include <stdio.h>
#using <mscorlib.dll>
using namespace System;
extern "C" void WinMainCRTStartup();
[System::STAThread]
int mymain() //the new entry point
{
//Initialize COM
HRESULT hr = CoInitialize(0);
//Initialize the CRT
WinMainCRTStartup();
//uninit
CoUninitialize();
return 0;
}
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Placed the code in but get error:-
c:\Test_GUI_New\Test GUI1.cpp(16): fatal error C1190: managed targeted code requires '#using <mscorlib.dll>' and '/clr' option
Help, I am sure that are almost there.
|
|
|
|
|
Played about with the compile options, now getting error:-
Test GUI1 error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup
Help!
|
|
|
|
|
|
Still get the linker error:-
Test GUI1 error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup
No idear what to do now!?!
|
|
|
|
|
Is there any known solution for dynamically compiling code, even simple one, for example to keep reasonable performance when evaluating a user-defined function in a graph application (instead of interpreting) ?
something like:
double (*fn)(double x) ;
...
fn = Compile("{return sin(x);}") ;
res = fn(3.14) ;
I've tried generating some assembly code from the expression and putting it in a char array that I can execute. This works, but it's platform specific and it's reinventing the wheel.
An other solution that I did not test would be to directly call the compiler and for example generate a dll you can call afterwards, but It's not really clean nor portable !
Any ideas for any clean solution ?
Application of that could also be a "compiling spreadsheet" etc...
Mooze
|
|
|
|
|
Well, C++ code is not interpreted, so there probably isn't a "clean" solution, not without re-inventing the wheel (as you say.) You could try embedding Perl or Python into your app.
"Fish and guests stink in three days." - Benjamin Franlkin
|
|
|
|
|
Yes, I could, and I actually did it in some cases, but it does not solve the (interpreting) performance problem. It seems .net allows some sort of dynamic compilation, but the whole thing remains interpreted as far as I understand.
Thanks anyway
|
|
|
|
|
I've never written a DLL before so this may be a dumb question. In a project I'm working on I'm wanting to put some of the functionality in a DLL. I created it using the MFC DLL Wizard, but I'm not sure if I'm going about creating it correctly. After it created it's base classes I added my own to the project and am adding my functionality to it. Is that correct or should I be adding everything to the classes it created? Also how do I go about using the DLL? Can I simply include the headers in my other project or will I have to use LoadLibrary and such? Thanks for the help.
- Aaron
|
|
|
|
|
There are 2 ways to export things from DLLs
1. Via DEF files
2. Via _declspec(import) & _declspec(export)
And there are two ways to get it into the client:
1. Via Implicit linking - IE with a .LIB file
2. Via Explict linking - IE LoadLibrary/GetProcaddress
Which you choose very much depends on what you want to do. For the most part, people use Implicit linking and DEF files - simply as DEF files make adding/removing functionality to/from the DLL easier.
If your a beginner, id stick to _declspec and implict linking.
Have a read of
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/_core_using_implicit_linking.asp
To get you started.
|
|
|
|
|
Hi,
I am developing an application in win32.
My computer is in a network.
I want to get the list of all the computers connected in the network neighbourhood.
Is there any API to achieve this?
Pls guide?
|
|
|
|
|
Were you aware that you posted this twice?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi,
I am developing an application in win32.
My computer is in a network.
I want to get the list of all the computers connected in the network neighbourhood.
Is there any API to achieve this?
Pls guide?
I am doing a multi threaded application that involves exchange of data.
ONE UI THREAD
AND 3 WORKER THREADS.PLS LET ME HOW TO EXCHANGE THE DATA BETWEEN THESE 3 WORKER THREADS.
FOR EX:THE FIRST THREAD WILL GIVE THE SECOND THREAD THE 2 NUMBERS AS ARGUEMENTS.the second thread should return the first thread the sum.
Pls help
|
|
|
|
|
ykutanoor wrote:
I want to get the list of all the computers connected in the network neighbourhood.
Is there any API to achieve this?
See my response to abdul here.
ykutanoor wrote:
I am doing a multi threaded application that involves exchange of data.
ONE UI THREAD
AND 3 WORKER THREADS.PLS LET ME HOW TO EXCHANGE THE DATA BETWEEN THESE 3 WORKER THREADS.
FOR EX:THE FIRST THREAD WILL GIVE THE SECOND THREAD THE 2 NUMBERS AS ARGUEMENTS.the second thread should return the first thread the sum.
Pls help
This was responded to here.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I have a vector of CString objects that have up to a few hundred words in each CString. For each CString object is there a way in the STL to do something like in VB where I could say MyArray() = split(str,' ') Doing this in VB would fill the dynamic array with each substring that was found in between the spaces. Any help would be appreciated. Thanks In Advance
If it's broken, I probably did it
bdiamond
|
|
|
|
|
You could try implementing your own split function.
CStringArray Split (CString csWords, CString csOn)
{
int index;
CStringArray arr;
arr.SetSize (50);
while (csWords.GetLength () > 0) {
index = csWords.Find (csOn);
if (index == -1) break;
arr.Add (&(csWords.Left (index)));
csWords.Delete (0, index);
}
arr.Add (csWords);
retrun arr;
} I haven't tested it, but it should work.
- Aaron
|
|
|
|
|
thanks!!
If it's broken, I probably did it
bdiamond
|
|
|
|