|
The REFIID of Pocket Internet Explorer is: L"Microsoft.PIEDocView" .
cheers,
AR
|
|
|
|
|
Thanks for your answer,
I found that CLSID of the "Microsoft.PIEDocView" which was {F5AFC7EF-1571-48B6-A69C-F1833F4C3A44} , I changed the CLSID of CWebBrowser to that, and the Message blew was writen:
...
Load module: browsres.96.dll
Persistence not supported on OLE control {F5AFC7EF-1571-48B6-A69C-F1833F4C3A44}.
>>> Result code: 0x00000000
Load module: WEBVIEW.DLL
...
and the control did not create.
Do you know waht can I do with that?
Regards
Miss_F
|
|
|
|
|
Hi,
Maybe you didn't call ::CoInitializeEx() or otherwise initialize properly.
For diagnostic, compile the ATL sample in <Windows Mobile [5 | 6]\Samples\PocketPC\CPP\ATL\Minipie> and/or the WTL adaptation in <WTL8>\Samples\MiniPie and run the result on your device.
On success, your development environment is OK and there is a problem in your code, otherwise the problem is on your development platform.
cheers,
AR
|
|
|
|
|
Hi,
Thanks a lot for your help,
i run the sample and it works properly, i think i must change my codes.
Regards
Miss_F
|
|
|
|
|
In a header file I have
#define NOMINDEX 0
...
#define ETABLESIZE 5
In the source file that includes this header, the following doesn't seem to work (it's writing 0 to the buffer (and in the watch window in VS, it's saying it doesn't recognise the symbols defined)
sprintf_s( eBuff, 16, "%d", energyTable[ETABLESIZE*sel + NOMINDEX] );
if I add this line before it, "e" is correctly assigned to 5
int e = ETABLESIZE;
sprintf_s( eBuff, 16, "%d", energyTable[ETABLESIZE*sel + NOMINDEX] );
In other parts of my cpp file I use these constants and they seem to work correctly.
Have I done something incredibly stupid?
cheers
Lee
|
|
|
|
|
The answer of course is, yes, I was doing something incredibly stupid. I really ought to try the count to 10 rule before posting
unsurprisingly,
sprintf_s( eBuff, 16, "%.0f", energyTable[ETABLESIZE*sel + NOMINDEX] );
works rather better, since energyTable is a float array
DOH!
sorry.....
|
|
|
|
|
Could it be that your sel variable is 0 and you just didn't notice?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
It should work, indeed. That stated, why don't you use an enum for your symbols?
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]
|
|
|
|
|
I want to get the info about all (currently 4) cpu-cores I have.
The most information I get is with the WMI-system (WIN32_processor).
I found at all web-pages the same sample-code for the WMI-access with C++.
I changed it for my needs and it works almost fine. The only
problem is that it gives me only the data for CPU0, but not
the 3 others.
As soon as i change the WQL request to ("SELECT * FROM Win32_Process")
the "while (pEnumerator)"-loop works fine and I get all processes currently running.
So I don't understand why the WQL request returns only the first CPU...
Thanks a lot for any help!
best regards
Peter
>>>> Output >>>>
Number of processors: 4 // from GetSystemInfo()
DeviceID : CPU0
LoadPercentage : 7
Name : Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz
>>>> code >>>
#define _WIN32_DCOM
#include <iostream>
using namespace std;
#include <comdef.h>
#include <wbemidl.h>
# pragma comment(lib, "wbemuuid.lib")
int main(int argc, char **argv)
{
HRESULT hres;
SYSTEM_INFO siSysInfo;
// Copy the hardware information to the SYSTEM_INFO structure.
GetSystemInfo(&siSysInfo);
cout << "Number of processors: " << siSysInfo.dwNumberOfProcessors << endl;
// Step 1: --------------------------------------------------
// Initialize COM. ------------------------------------------
hres = CoInitializeEx(0, COINIT_MULTITHREADED);
if (FAILED(hres))
{
cout << "Failed to initialize COM library. Error code = 0x"
<< hex << hres << endl;
return 1; // Program has failed.
}
// Step 2: --------------------------------------------------
// Set general COM security levels --------------------------
// Note: If you are using Windows 2000, you need to specify -
// the default authentication credentials for a user by using
// a SOLE_AUTHENTICATION_LIST structure in the pAuthList ----
// parameter of CoInitializeSecurity ------------------------
hres = CoInitializeSecurity(
NULL,
-1, // COM authentication
NULL, // Authentication services
NULL, // Reserved
RPC_C_AUTHN_LEVEL_DEFAULT, // Default authentication
RPC_C_IMP_LEVEL_IMPERSONATE, // Default Impersonation
NULL, // Authentication info
EOAC_NONE, // Additional capabilities
NULL // Reserved
);
if (FAILED(hres))
{
cout << "Failed to initialize security. Error code = 0x"
<< hex << hres << endl;
CoUninitialize();
return 1; // Program has failed.
}
// Step 3: ---------------------------------------------------
// Obtain the initial locator to WMI -------------------------
IWbemLocator *pLoc = NULL;
hres = CoCreateInstance(
CLSID_WbemLocator,
0,
CLSCTX_INPROC_SERVER,
IID_IWbemLocator, (LPVOID *) &pLoc);
if (FAILED(hres))
{
cout << "Failed to create IWbemLocator object."
<< " Err code = 0x"
<< hex << hres << endl;
CoUninitialize();
return 1; // Program has failed.
}
// Step 4: -----------------------------------------------------
// Connect to WMI through the IWbemLocator::ConnectServer method
IWbemServices *pSvc = NULL;
// Connect to the root\cimv2 namespace with
// the current user and obtain pointer pSvc
// to make IWbemServices calls.
hres = pLoc->ConnectServer(
_bstr_t(L"ROOT\\CIMV2"), // Object path of WMI namespace
NULL, // User name. NULL = current user
NULL, // User password. NULL = current
0, // Locale. NULL indicates current
NULL, // Security flags.
0, // Authority (e.g. Kerberos)
0, // Context object
&pSvc // pointer to IWbemServices proxy
);
if (FAILED(hres))
{
cout << "Could not connect. Error code = 0x"
<< hex << hres << endl;
pLoc->Release();
CoUninitialize();
return 1; // Program has failed.
}
// Step 5: --------------------------------------------------
// Set security levels on the proxy -------------------------
hres = CoSetProxyBlanket(
pSvc, // Indicates the proxy to set
RPC_C_AUTHN_WINNT, // RPC_C_AUTHN_xxx
RPC_C_AUTHZ_NONE, // RPC_C_AUTHZ_xxx
NULL, // Server principal name
RPC_C_AUTHN_LEVEL_CALL, // RPC_C_AUTHN_LEVEL_xxx
RPC_C_IMP_LEVEL_IMPERSONATE, // RPC_C_IMP_LEVEL_xxx
NULL, // client identity
EOAC_NONE // proxy capabilities
);
if (FAILED(hres))
{
cout << "Could not set proxy blanket. Error code = 0x"
<< hex << hres << endl;
pSvc->Release();
pLoc->Release();
CoUninitialize();
return 1; // Program has failed.
}
// Step 6: --------------------------------------------------
// Use the IWbemServices pointer to make requests of WMI ----
// For example, get the name of the operating system
IEnumWbemClassObject* pEnumerator = NULL;
hres = pSvc->ExecQuery(
bstr_t("WQL"),
bstr_t("SELECT * FROM Win32_Processor"),
WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
NULL,
&pEnumerator);
if (FAILED(hres))
{
cout << "Query for processors failed."
<< " Error code = 0x"
<< hex << hres << endl;
pSvc->Release();
pLoc->Release();
CoUninitialize();
return 1; // Program has failed.
}
// Step 7: -------------------------------------------------
// Get the data from the query in step 6 -------------------
IWbemClassObject *pclsObj;
ULONG uReturn = 0;
while (pEnumerator)
{
HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1, &pclsObj, &uReturn);
if(0 == uReturn)
{
break;
}
VARIANT vtProp;
VariantInit(&vtProp);
// Get the value of the Name property
hr = pclsObj->Get(L"DeviceID", 0, &vtProp, 0, 0);
wcout << " DeviceID : " << vtProp.bstrVal << endl;
VariantClear(&vtProp);
VariantInit(&vtProp);
// Get the value of the Name property
hr = pclsObj->Get(L"LoadPercentage", 0, &vtProp, 0, 0);
wcout << " LoadPercentage : " << vtProp.uintVal << endl;
VariantClear(&vtProp);
VariantInit(&vtProp);
// Get the value of the Name property
hr = pclsObj->Get(L"Name", 0, &vtProp, 0, 0);
wcout << " Name : " << vtProp.bstrVal << endl;
VariantClear(&vtProp);
pclsObj->Release();
}
// Cleanup
pSvc->Release();
pLoc->Release();
pEnumerator->Release();
CoUninitialize();
return 0; // Program successfully completed.
}
>>>> Output >>>>
Number of processors: 4
DeviceID : CPU0
LoadPercentage : 7
Name : Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz
modified on Thursday, February 5, 2009 8:48 AM
|
|
|
|
|
How many processors do you actually have? I think you'd have to agree that there's only 1. That is why WMI only returns one Win32_Processor record. However, Win32_Processor has a NumberOfCores property that should return '4' for you - it returns '2' for me (I only have an E6600, so only two cores).
|
|
|
|
|
1) The last lines of my entry show the output of my application. Fact: I have 4 cores.
2) I use VisualStudio 2005 and there I cannot find any "NumberOfCores" at WIN32_processor...??
3) I need the LoadPercentage of each core and not only one of them...
|
|
|
|
|
Pasy_m wrote: 2) I use VisualStudio 2005 and there I cannot find any "NumberOfCores" at WIN32_processor...??
See here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Ok. I found it, but that's value I already get with GetSystemInfo(). I still need to get the MWI-objects for all four CPU-cores...
|
|
|
|
|
It seems to be a problem at the window-side. I could test my software on a single-core CPU with Hyperthreading (number of cores = 2) and in this case I got the data for both "cores"...
|
|
|
|
|
Hi friends,
I had tried to stretch a Gif image and unable to do
My code is :
CImage image;
HDC dc = GetWindowDC()->GetSafeHdc();
BYTE *m_buffer;
CFile file;
if( !file.Open( MAKEINTRESOURCE(IDR_GIF1), CFile::modeRead) )
return false;
long m_buffer_size = (long)file.GetLength();
m_buffer = new BYTE[m_buffer_size];
if ( file.Read(m_buffer, m_buffer_size) != m_buffer_size )
return false;
file.Close();
IStream *pIstream;
CreateStreamOnHGlobal(NULL, TRUE, (LPSTREAM*)&pIstream);
ULARGE_INTEGER ulnSize;
ulnSize.QuadPart = m_buffer_size;
pIstream->SetSize(ulnSize);
LARGE_INTEGER lnOffset;
lnOffset.QuadPart = 0; //starting location is 0
pIstream->Seek(lnOffset, STREAM_SEEK_SET, NULL);
ULONG mysize;
pIstream->Write(m_buffer,m_buffer_size,&mysize);
image.Load(pIstream);
CRect rectDest;
rectDest.top = 0;
rectDest.bottom = 50;
rectDest.left = 0;
rectDest.right = 50;
image.StretchBlt(dc, rectDest, PATCOPY);
image.Draw(dc,0,0);
Kindly help me ..
Thanks in Advance..
|
|
|
|
|
Try SRCCOPY rather than PATCOPY?
|
|
|
|
|
Thanks for your kind reply,
I had tried it and doesn't work
i hope the coding itself getting wrong
if you have any other method
kindly send me
Thanks & Regards,
Jeeva
|
|
|
|
|
OK, here's the answer I was going to give you before I realised that PATCOPY doesn't work and SRCCOPY does (by trying it).
You have a whole load of steps - any one of which could be failing. You don't check returned status codes - any one of them could be failing and you don't know. So, try adding some error checking so you know what's going wrong.
Also, what's with the IStream and HGlobal stuff? You don't need that to read a CImage from a file - here's the code I'm using in my OnPaint :
PAINTSTRUCT ps;
CDC * drawDC = BeginPaint(&ps);
CRect rcClient;
GetClientRect(&rcClient);
CImage image;
image.Load(_T(image filename));
image.StretchBlt(*drawDC, rcClient, SRCCOPY);
EndPaint(&ps);
Simpler, no? Simple's good.
|
|
|
|
|
Great it works well,
Thanx for your answer
With regards,
Jeeva
|
|
|
|
|
Hi all,
I have made a dialog based application in vc2008, my problem is while my application is running if i press T it pops up a message from application...
I am not getting why i am getting this problem....
How can i remove this......
|
|
|
|
|
VCProgrammer wrote: if i press T it pops up a message from application...
Which message ? What does it say ?
|
|
|
|
|
hi guys!
I currently need a modeless dialog in wich i need this behavior.
The modeless dialog shows, and then if i click it's parent will bring the parent dialog to top most. But i can not achieve this behavior, i create the modeless dialog but when i click the parent window it becomes active but the modeless child window stay on top.
I tried to use setparent but my app crashes. i am using something like this:
<pre>CMydialog * dialog = new CMydialog();
dialog->Create(IDD_DIALOG);
// dialo->SetParent(this);
dialo->ShowWindow(SW_SHOW);</pre>
but when i uncomment setparent it crashes. Please someone help me, i am a noob in this!
|
|
|
|
|
Try this,
In .h file
......
CMyDialog* dialog;
.....
In .cpp file
.....
if (dialog != NULL)
m_pDlg->SetFocus ();
//
// If the dialog box doesn't already exist, create it.
//
else
{
dialog = new CMyDialog;
dialog->Create (IDD_OPTIONS);
m_pDlg->ShowWindow (SW_SHOW);
}
|
|
|
|
|
Thanks dude!
But i know now how to do what i asked for, is use the desktop window like it's parent
dialog->Create (IDD_OPTIONS, GetDesktopWindow());
and that´s it.
|
|
|
|
|
Hi,,
I have a file abc.reg.I want to install the registry file , but the main point is the RUN dialog as well as the conformation dialog should be hidden to the user. After shell execute the installation should be done silently.
Any help is appriciated.
Regards,
KDevloper
|
|
|
|
|