|
Except combobox you can make each control at run time.
|
|
|
|
|
Any control can be created at runtime with CreateWindow() or
CreateWindowEx(). The lpClassName parameter determines the type of
control created.
For common control classnames, see Control Library[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Dear DirectShow experts,
I have got a DShow based audio application that can use DMO Audio Effects
(e.g. the DirectX built-in ParamEQ) and show their property pages in order
to let the user change the effect settings. The DMOs are handled through the
DMO Wrapper Filter of DShow.
All works fine since years under Win2k and XP, but not so with Vista. Audio
Processing also works as expected there, but if I try to get the Property
Page of an DMO, I get 0x80040154 (Class not registered) as result. What
might be the reason?
Here is the relevant part of the code:
-------
IBaseFilter* pIFilter = pMyFilter;
ISpecifyPropertyPages* lpSPP = NULL;
hRes = pIFilter->QueryInterface(IID_ISpecifyPropertyPages, (void**)&lpSPP);
if(hRes == S_OK)
{ // filter has property page
FILTER_INFO FilterInfo;
hRes = pIFilter->QueryFilterInfo(&FilterInfo);
if(SUCCEEDED(hRes))
{
CAUUID* pCAUUID = (CAUUID*)CoTaskMemAlloc(sizeof(CAUUID));
memset(pCAUUID, 0, sizeof(CAUUID));
hRes = lpSPP->GetPages(pCAUUID);
if(SUCCEEDED(hRes))
{
for (UINT j = 0; j < pCAUUID->cElems; j++)
{ // Create CPropertyPages and Property page sites.
IPropertyPage* pPropPage = NULL;
hRes = CoCreateInstance(pCAUUID->pElems[j], NULL, CLSCTX_INPROC_SERVER,
IID_IPropertyPage, (void **) &pPropPage);
ASSERT(pPropPage);
// with VISTA, this pointer is NULL and hRes == 0x80040154 (Class not registered)
// meanwhile with 2k and XP it works fine
if(pPropPage)
{ // further processing
}
}
}
if(pCAUUID->pElems)
CoTaskMemFree(pCAUUID->pElems);
CoTaskMemFree(pCAUUID);
}
}
lpSPP->Release();
-------
Thank you very much in advance for your advice!
Robert
|
|
|
|
|
If the program is the sort with a visible `int main(argc,argv)' function, the answer is easy.
But what in the Windows type of program that is called through a WinMain()? In Borland C++ 4.5, there are two system-declared variables _Argc and _Argv which on entry to WinMain point to the program's call argument table; but that does not work in Visual C++ 2008.
|
|
|
|
|
There's a Win32 function called GetCommandLine[^]
And CommandLineToArgv will split it into an array for you.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
|
|
http://www.alexfedotov.com/samples/enumrot.asp
I can enumerate objects in ROT using the code in the link.
How can I get objects exposed by these running objects ?
Will I use IMoniker::BindToObject for the rest ?
Regards...
|
|
|
|
|
It would help if I knew what you're trying to achieve but yes, generally you'd call BindToObject . In other scenarios you'd call BindToStorage .
Steve
modified on Thursday, December 20, 2007 9:33:44 PM
|
|
|
|
|
Hi,
I'm getting some terrible performance when calling ifstream close. It takes about the same amount of time to close() as it takes to read my 64 Mb of data! I've been playing around with it and found it only happens if I have been writing to a file recently. Here's my test code:
void readTest(const std::string & path)
{
ifstream in;
in.open(path.c_str(), ios_base::in | ios_base::binary);
char * buffer = new char[67108864];
in.read(buffer, 67108864);
SW_ELAPSED_MSG()
in.close();
SW_ELAPSED_MSG()
delete [] buffer;
}
void writeTest(const std::string & path)
{
ofstream out;
out.open(path.c_str(), ios_base::out | ios_base::binary);
char * buffer = new char[67108864];
out.write(buffer, 67108864);
out.close();
delete [] buffer;
}
int _tmain(int argc, _TCHAR* argv[])
{
writeTest("testfile");
SW_START();
readTest("testfile");
SW_ELAPSED_MSG()
return 0;
}
Note my macros do the timing and display it on screen. I don't believe there's any problem with that code.
So anyone know why? I'm closing the streams. Why is the read stream affected at all by the write stream? Also as you can see I have a flush() statement in there. It doesn't help, commented or not.
|
|
|
|
|
Hi,
I'm stumped.
Why does this code compile without problems but cause a runtime error? ("Debug Assertion Failed! ... Expression: vector iterators incompatible")
<br />
vector< vector<string> >::iterator vvsi_b = (a.Block()).begin();<br />
vector< vector<string> >::iterator vvsi_e = (a.Block()).end();<br />
<br />
for (; vvsi_b != vvsi_e; ++vvsi_b)<br />
{<br />
}<br />
</string></string>
a.Block() returns a const reference to a vector< vector< string > > object
I'm using Visual C++ 2005 Express.
Any help (and consequent hair retention) greatly appreciated.
Phil
|
|
|
|
|
Correction:
The quoted code should be:
vector< vector<string> >::iterator vvsi_b = (a.Block()).begin();
vector< vector<string> >::iterator vvsi_e = (a.Block()).end();
for (; vvsi_b != vvsi_e; ++vvsi_b)
{
// etc.
}
Phil
|
|
|
|
|
The codeproject message parser keeps removing part of the code I'm posting.
The code should refer to a vector of vector of string, but the string part keeps being removed from the post. How do I post so the code stays the way I want?
Phil
|
|
|
|
|
Member 73301 wrote: The code should refer to a vector of vector of string, but the string part keeps being removed from the post. How do I post so the code stays the way I want?
post code snippets between <pre> TAGS, i.e.
<pre>
...code here..
...code here...
</pre>
also when showing templates use the escape sequence for < (< ).
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.
[my articles]
|
|
|
|
|
Ok, the code that fails in Visual C++ 2005 Express is (if this formats ok):
vector < vector < string > > ::iterator vvsi_b = (a.Block()).begin();
vector < vector < string > > ::iterator vvsi_e = (a.Block()).end();
for (; vvsi_b != vvsi_e; ++vvsi_b)
{
}
Any idea why this causes the runtime error "Debug Assertion Failed! ... Expression: vector iterators incompatible" ?
Phil
|
|
|
|
|
Where is the assertion happening? What line in your code?
Steve
|
|
|
|
|
Thanks for replying.
The assertion isn't in my code as such it's in line 238 of the vector header file:
#if _HAS_ITERATOR_DEBUGGING
void _Compat(const _Myt& _Right) const
{
if (this->_Mycont == 0 || this->_Mycont != _Right._Mycont)
{
_DEBUG_ERROR("vector iterators incompatible");
_SCL_SECURE_INVALID_ARGUMENT;
}
}
#endif /* _HAS_ITERATOR_DEBUGGING */
I assume I could somehow disable iterator debugging to get around this error, but I would like to know why I'm getting the error in the first place. Am I doing something wrong? The iterators both come from the same vector object, so how could they be incompatible?
Phil
|
|
|
|
|
In a class or struct declaration in Visual C++ 2008, for example
class BMPheader{public: char BM[2]; long size; short u,v; long imagestart;};
or
struct BMPheader{char BM[2]; long size; short u,v; long imagestart;};
can I trust on that being an accurate description of the resulting byte pattern inside the computer, to match the format of a binary file that is read in? My experience here is:
Gnu C++ for DOS: no, because after each element was inserted 0 or 1 or 2 or 3 unused bytes, to get each byte to start at an address which was a multiple of 4, unless I inserted a special keyword to tell the compiler to pack the elements close.
Borland C++ 4.5 for Windows: yes.
|
|
|
|
|
You have not to worry about alignment, as far you are consistent on writing to and reading from file, for instance (error handling left to the reader)
struct BMPHeader bmphout;
...
FILE * fpout = fopen("foo.bin", "wb");
fwrite( &bmphout, sizeof(bmphout),1, fpout);
fclose(fpout);
and then
struct BMPHeader bmphin;
FILE * fpin = fopen("foo.bin", "rb");
fread( &bmphin, sizeof(bmphin),1, fpin);
fclose(fpin);
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.
[my articles]
|
|
|
|
|
But here I am reading from a file format which someone else (probably at Microsoft many years ago) invented. So I need to know how to make Visual C++ 2008 compile a struct or class with the elements in the same order as declared with no extra bytes inserted between.
|
|
|
|
|
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.
[my articles]
|
|
|
|
|
Anthony Appleyard wrote: But here I am reading from a file format which someone else (probably at Microsoft many years ago) invented.
Why are you not using the Microsoft structure definitions
that have been around just as long?
BITMAPFILEHEADER is packed with 2-byte alignment
BITMAPINFO and BITMAPINFOHEADER are packed with 1-byte alignment.
To see how that affects struct padding and alignment, see
align (C++)[^]
/Zp (Struct Member Alignment)[^]
etc...
If you're going to redefine these structs and expect them to match
everyone else, then you'll probably want to set your structure packing
the same as Microsoft's (see #pragma pack).
*edit* Also, using platform-specific types like "long" and "short" is a bad<br />
idea if you expect to match the Microsoft definitions.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
modified on Thursday, December 20, 2007 7:40:28 PM
|
|
|
|
|
Like DPtoLP, how to do it with GDI+,
use TransformPoints?
|
|
|
|
|
Yes, it looks promising.
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.
[my articles]
|
|
|
|
|
i has need code for windoz service when starting os.plz send politly.
|
|
|
|