|
How i can get the list of processes currently running in Windows CE remote process viewer?
|
|
|
|
|
Hi,
I'm trying since a while to add some counters to perfmon.
Searching through MSDN brought me to those interesting pages:
Performance Monitoring Reference
Manually Defining Performance Objects
I tried the code snippets given by MS in the second link and it compiled,
but I didn't saw any new Objects in perfmon when running it.
So I instantiated an object of each class (MyPerfObject, MyPerfMonManager) and checked the available methods from the PerfMonManager, also without success.
Has anyone some knowledge about this theme and can give me a working example?
Thanks in advance
|
|
|
|
|
|
Hello,
In my application, I send a print command to my view from a (modal) dialog:
pView->OnCmdMsg(ID_FILE_PRINT, 0, 0, 0);
How can I wait until the printing process has been finished?
Background: In my dialog I want to be able to print other data than loaded into the current view. For this purpose, I save the state of the current view, load another document, print it and afterthe document has finished printing I reload the old document again and close the dialog.
Thank you and regards,
Niki
|
|
|
|
|
I have forgotten a very important issue: The view is a CHtmlView. So my view does not have an own printing mechanism
|
|
|
|
|
Printing is heavily abstracted in windows - this is one of the main selling points they had waaaaaaay back when. But that means you shove data at the print spooler - and you know when that is finished.
But that may then shove data at some remote machine which may or may not complete then.
That may then go to a fancy print system which could batch your print for late at night, for its own convenience.
None of this gets fed back to you.
You could do this:
while (1)
{
if (MessageBox (_T("Has the paper come out yet?"), MB_YESNO | MB_ICONQUESTION) == IDYES)
break;
}
Being slightly serious, the OnCmdMsg (ID_FILE_PRINT, 0, 0, 0) shouldn't return until it's finished its bit of the printing process.
Iain.
|
|
|
|
|
Hello and thank you for your answer!
I do not want to check if the document has printed successfully but it should just be successfully appended to the queue (before the new document is loaded).
I think I managed this (the following code is done in a modal dialog):
CString currentUrl = pView->GetLocationURL();
pView->Pall();
while(pView->GetReadyState() != READYSTATE_COMPLETE)
{
((CMyApp*)AfxGetApp())->Yeild();
}
pView->OnCmdMsg(ID_FILE_PRINT, 0, 0, 0);
pView->Navigate(currentUrl);
EndDialog(FALSE);
The OnCmdMsg(ID_FILE_PRINT) does nothing more than ExecWB(OLECMDID_PRINT,...) in the IWebBrowser2.
And now my "backup question" is.
You said:
"Being slightly serious, the OnCmdMsg (ID_FILE_PRINT, 0, 0, 0) shouldn't return until it's finished its bit of the printing process."
Are you sure that ExecWB(OLECMDID_PRINT,...) will block until the currently loaded document has been printed so that I can issue the next Navigate(...) call just afterwards?
In my tests it works but I am not sure about this.
Regards,
Niki
|
|
|
|
|
I confess I have not printed from an HtmlView, so take my logic with some skepticism.
From the docs:
Executes a command on an OLE object and returns the status of the command execution using the IOleCommandTarget interface.
It does not say "queue up some thready thing". So S_OK, means the job is *done*.
Iain.
|
|
|
|
|
You could obtain a PRINTER_INFO_2[^] structure which contains the number of jobs in the printer que. The Status member should return PRINTER_STATUS_PRINTING while printing and PRINTER_STATUS_WAITING when finished.
If you wanted to track individual print jobs you could use the JOB_INFO_1[^] or other associated print job structures to track the job. The Status member will return JOB_STATUS_PRINTED when the job has completed. It should be noted that older printers and/or port monitor drivers may always return JOB_STATUS_PRINTED information for job status. Your mileage may vary.
Some documentation:
http://support.microsoft.com/kb/158828[^]
Some sample code:
#include <winspool.h>
HANDLE YourClass::OpenDefaultPrinter(ACCESS_MASK dwMask)
{
HANDLE hPrinter = INVALID_HANDLE_VALUE;
PRINTER_DEFAULTS pDef;
DWORD dwSize;
ZeroMemory(&pDef, sizeof(pDef));
GetDefaultPrinter(NULL, &dwSize);
TCHAR* szBuffer = new TCHAR[dwSize];
if(NULL != szBuffer)
{
if(GetDefaultPrinter(szBuffer, &dwSize))
{
pDef.DesiredAccess = dwMask;
OpenPrinter(szBuffer, &hPrinter, &pDef);
}
delete szBuffer;
}
return hPrinter;
}
DWORD YourClass::GetPrintQueCount()
{
DWORD dwNeeded = NULL;
PRINTER_INFO_2 *pInfo = NULL;
DWORD dwRet = 0;
HANDLE hPrinter = OpenDefaultPrinter();
if(INVALID_HANDLE_VALUE != hPrinter)
{
GetPrinter(hPrinter, 2, (LPBYTE)pInfo, 0, &dwNeeded);
if(0 < dwNeeded)
{
pInfo = static_cast<PRINTER_INFO_2 *>(GlobalAlloc(GPTR, dwNeeded));
if(NULL != pInfo)
{
if(GetPrinter(hPrinter, 2, (LPBYTE)pInfo, dwNeeded, &dwNeeded))
{
dwRet = pInfo->cJobs;
}
}
GlobalFree(pInfo);
}
ClosePrinter(hPrinter);
}
return dwRet;
}
Good Luck,
-David Delaune
|
|
|
|
|
How to change rectangle backround of tooltip window to other shape?
|
|
|
|
|
Have a look at TTS_BALLOON.
Beyonf that, do a search here on codeproject for all sorts of tooltip replacements. The built in class is handy, but it runs out of unsefulness VERY rapidly.
Iain,
|
|
|
|
|
ok. Thanks for your reply.
|
|
|
|
|
System: Windows XP / Vista / 32 / 64
Language: C++
I need information about all network controllers
of the PC my application is running on.
(Usually 1 onBoard and 1 additional network card)
And I need their maximum transfer rate
(10MBit, 100MBit or 1GBit)
I already know how to get their IP-addresses
with gethostbyname() and the h_addr_list.
But on that way I don't get any info about their
maximum speed. (maybe the card is a 1GBit controller,
but it is connected with a 100MBit switch...
then the current max. speed should be 100MBit)
Thanks for your help
|
|
|
|
|
Pasy_m wrote: Hardware info about the network controllers
Did you see Computer System Hardware Classes (Windows)[^]?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
The MIB_IFROW Structure[^] can tell you the network speed for each device.
Sample usage:
#include "Iphlpapi.h"
#pragma comment(lib, "iphlpapi.lib")
VOID CNetworkToolBox::EnumNetworkSpeeds()
{
BYTE *pBuf=NULL;
DWORD dwSize=0;
DWORD dwResult=0;
PMIB_IFTABLE pMIBTable;
GetIfTable(NULL,&dwSize,FALSE);
pBuf=new BYTE[dwSize];
pMIBTable=reinterpret_cast <PMIB_IFTABLE >(pBuf);
CString szBuf;
if(NO_ERROR == GetIfTable(pMIBTable,&dwSize,FALSE))
{
for(UINT i=0; i < pMIBTable->dwNumEntries; ++i)
{
if(MIB_IF_TYPE_LOOPBACK != pMIBTable->table[i].dwType)
{
if(MIB_IF_OPER_STATUS_CONNECTED == pMIBTable->table[i].dwOperStatus
|| MIB_IF_OPER_STATUS_OPERATIONAL == pMIBTable->table[i].dwOperStatus)
{
szBuf.Format("%d@%s",pMIBTable->table[i].dwIndex,pMIBTable->table[i].bDescr);
TRACE2(_T("%s network speed in bits per second: %ld\n"),szBuf,pMIBTable->table[i].dwSpeed);
}
}
}
}
delete []pBuf;
}
Best Wishes,
-David Delaune
|
|
|
|
|
Pasy_m wrote: (maybe the card is a 1GBit controller,
but it is connected with a 100MBit switch...
then the current max. speed should be 100MBit)
The overall throughput will be 100M, but the NIC itself will be 1G to the switch.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
This Code gives output as Access violation ...Can anybody tell me what is wrong there....
#include <windows.h>
#include <stdio.h>
void main()
{
char * szTemp, *cmdline;
cmdline = (char *)malloc(sizeof (char) * 1000);
if(cmdline)
{
strcpy(cmdline, "skdjofhdsjfodhfjdhgkjfhgkjdfhgkfhgkjdfhgk");
int len = strlen(cmdline);
szTemp = (char *)malloc(sizeof (len) + 1);
if(szTemp)
{
strcpy(szTemp, cmdline);
puts(szTemp);
}
}
if(cmdline)
{
free(cmdline);
cmdline = NULL;
}
if(szTemp)
{
//Access Violation When We Free szTemp
free(szTemp);
szTemp = NULL;
}
return;
}
|
|
|
|
|
Oh, yes, it is veeeeery interesting.
BTW: The error is in the line below, can you spot it?
Aabid wrote: szTemp = (char *)malloc(sizeof (len) + 1);
Hint: sizeof(len) is 4!
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Aabid wrote: szTemp = (char *)malloc(sizeof (len) + 1);
I believe it should be (char *)malloc(sizeof (char)* len + 1);. actually you need to have buffer copy commandline into szTemp. but instead of allocating proper buffer to it, you are allocating on buffer for 4 character + 1 for NULL.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
ThatsAlok believe it should be (char *)malloc(sizeof (char)* len + 1);.
That should be
sizeof(char) * (len+1)
if sizeof(char) was indeed relevant...
Pardon my nitpick attitude.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: if sizeof(char) was indeed relevant...
Yeap i know.. Old programming bad-habit
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Actually it is a good habit and proves helpful when dealing with TCHAR s.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Please check the statement
szTemp = (char *)malloc(sizeof (len) + 1);
check with following
szTemp = (char *)malloc(len + 1);
|
|
|
|
|
sorry I was late..
Please ingnoe
|
|
|
|
|
Hi!
how do i work with
#pragma command, to ignore a warning number in my project? (in Compiling)
please help me
Zo.Naderi-Iran
|
|
|
|