|
Hi,
I have a need to resize the ATL dialogs based on the screen resolution.
In the resource editor, If I just change the font of the dialog, then the dialog gets resized automatically. I need the same to do at runtime. This could be done in MFC by means of PreCreateDialog metod which could be implemented by the applications and the framework calls it whenever any dialog gets created. In this method we can make use of CDialogTemplate class and set a different font which actually resizes the whole dialog as well as all the controls on it automatically at runtime.
Is there any similar way for ATL. I know about the win32 API: DialogBoxIndirectParam(...) but don't know how to make use of it in ATL to load a dialog resource, modify the font and then launch the dialog.
Any help would be greatly appreciated.
Thanks
|
|
|
|
|
Hi,
Look at the code for ATL::CDialogImplBaseT<>::ExecuteDlgInit() in atlwin.h. That's what it does.
cheers,
AR
|
|
|
|
|
Hi,
I have been trying to develop a sidebar for windows media player similar to freeware iLike. Could anyone give some suggestions on how to attach a window to the media player.
Thanks
Smitha
|
|
|
|
|
I originally posted this on the C/C++/MFC forum but should have posted it here.
This program runs fine except when I try to delete/remove/erase an item as indicated below. No matter what I've tried with erase the program crashes.
Could someone please help here.
Thanks
Alan Kurlansky
PS. When I cut and pasted some characters got changed. I hope I fixed alll of them. I didn't see the options available below.
This program runs fine except when I try to delete/remove/erase an item as indicated below.
Thanks
Alan Kurlansky
PS. When I cut and pasted some characters got changed. I hope I fixed alll of them.
// MultiMap.cpp : Defines the entry point for the console application.
//
#include <windows.h>
#include <stdio.h>
#include <iostream>
#include <string>
#include <map>
using namespace std;
void testmultimap();
#include <tchar.h>
struct ASK {
int ival;
string key;
};
multimap<string, ASK *> mymm2;
multimap<string, ASK *>::iterator iter;
pair<multimap<string, ASK> ::iterator,multimap<string, ASK *>::iterator> ret;
int _tmain(int argc, _TCHAR* argv[])
{
testmultimap();
return 0;
}
//----------------------------------------------------------------------------------------------------------------
void testmultimap()
{
string key;
key.clear();
key.append("a");
ASK * Iptr = new ASK;
Iptr->ival = 10;
Iptr->key.clear();
Iptr->key.append(key);
mymm2.insert(pair<string,ASK *>(key, Iptr));
key.clear();
key.append("a");
Iptr = new ASK;
Iptr->ival = 20;
Iptr->key.clear();
Iptr->key.append(key);
mymm2.insert(pair<string,ASK *>(key, Iptr));
key.clear();
key.append("b");
Iptr = new ASK;
Iptr->ival = 30;
Iptr->key.clear();
Iptr->key.append(key);
mymm2.insert(pair<string,ASK *>(key, Iptr));
key.clear();
key.append("a");
ret = mymm2.equal_range(key);
int cnt(0);
for (iter=ret.first; iter!=ret.second; ++iter) {
printf("ival:%d key:[%s]\n", (*iter).second->ival, (*iter).second->key.c_str() );
// delete this single entry
// mymm2.erase(????);
}
printf("\n");
printf("2nd pass after 'a' erase\n");
ret = mymm2.equal_range(key);
for (iter=ret.first; iter!=ret.second; ++iter) {
printf("ival:%d key:[%s]\n", (*iter).second->ival, (*iter).second->key.c_str() );
}
printf("\n");
key.clear();
key.append("b");
ret = mymm2.equal_range(key);
for (iter=ret.first; iter!=ret.second; ++iter) {
printf("ival:%d key:[%s]\n", (*iter).second->ival, (*iter).second->key.c_str() );
}
printf("\n");
}
//----------------------------------------------------------------------------------------------------------------
|
|
|
|
|
I don't know how you compiled the code successfully.
I have to change the definition of ret to:
pair<multimap<string, ask*=""> ::iterator,multimap<string, ask="" *="">::iterator> ret;
The code runs well here.
and if you want to delete some items, you should save a temp iterator first, and forward the original iterator as normal like:
iter = ret.first;
while(iter!=ret.second){
printf("ival:%d key:[%s]\n", (*iter).second->ival, (*iter).second->key.c_str() );
multimap<string,ASK*>::iterator it = iter;
++iter;
mymm2.erase(it);
}
I think it will work as you want.
modified on Thursday, December 3, 2009 12:56 AM
|
|
|
|
|
Hello,
I have a VC++ 6.0 ATL Project.
I insert in this project a ActiveX OCX Component with following import routine in the header files.
I have access to the methods/function of the ActiveX with for example CComPtr<_grdView> pGrid;
The line #import "ActiveX_Name.ocx" creates a ActiveX_Name.thl .It was create by VC++6.0 compiler.
It's C++ source equivalent of Win32 type library ActiveX_Name.ocx.
I can look for the clsid id and register(CoGetClassObject( GetClsid(), CLSCTX_ALL, NULL, IID_IClassFactory2, (void**)&ipCF2); ) it in my programm.
Problem: How can I insert the event handler functions?
The BEGIN_MSG_MAP(MyClassName)function is only for the application Windows Message, not for the
message of the ActiveX Component.
Can you help me?
I a MFC Project with the same ActiveX ,there is the ActiveX message .BEGIN_EVENTSINK_MAP.. ON_EVENT ...
Greetings, jens
<<<<<<example of="" code="">>>>>>
#import "ActiveX.ocx" raw_interfaces_only, raw_native_types, no_namespace, named_guids
class MyClassName:
public CWindowImpl< MyClassName, CAxWindow >
{
public:
DECLARE_WND_SUPERCLASS(_T("MyClassName"), CAxWindow::GetWndClassName());
BEGIN_MSG_MAP(MyClassName)
MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnLeftMouseButton)//left doubleclick in activeX doesn't work
END_MSG_MAP()
// Handler prototypes:
// LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
// LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
// LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
CComPtr<_grdView> pGrid;
CComPtr<iunknown> pUnkCont;
CComPtr<iunknown> ipUk;
CLSID const& GetClsid() //CLSID_grdView
{
static CLSID const clsid
= {0x5ff50e07,0x9af6,0x4f2e,{0x81,0x4d,0x23,0x5c,0xad,0xc8,0x6b,0x73}};
return clsid;
}
<<<<<<<<>>>>>>>>
|
|
|
|
|
from memory, you need to handle 'event sinks' with an event sink ?map (much like a message map) - but Im afraid Ive forgotten the fine details - Im just trying to find an example to point you at ...
'g'
|
|
|
|
|
|
Does anybody know a tutorial for handle the described event from an activeX component without MFC?
Alternate, an VC++ 6.0 example project of an any activeX library will be also fine.
|
|
|
|
|
VC++6 on XP Pro
greetings all,
I've created an STL list object that stores =references= to objects. I've overloaded the less-than operator like numerous examples on the 'net say to do. The following code compiles and executes but does not sort - actually the order does change but not in a sorted order. I'm stumped - there must be some nuance I'm missing.
#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <list>
#include <iterator>
#include <vector>
#include <algorithm>
using namespace std;
struct pstchip_pin_wor {
string primitive;
string pin_name;
string pin_number;
pstchip_pin_wor( string aa, string bb, string cc) {
primitive = aa;
pin_name = bb;
pin_number = cc;
}
pstchip_pin_wor& pstchip_pin_wor::operator = (const pstchip_pin_wor &itemToCopy) {
this->primitive = itemToCopy.primitive;
this->pin_name = itemToCopy.pin_name;
this->pin_number = itemToCopy.pin_number;
return *this;
}
int pstchip_pin_wor::operator == ( const pstchip_pin_wor& itemToCompare) const {
if( this->primitive == itemToCompare.primitive && this->pin_name < itemToCompare.pin_name ) return 1;
return 0;
}
int pstchip_pin_wor::operator < ( const pstchip_pin_wor& itemToCompare) const {
if( this->primitive < itemToCompare.primitive ) return 1;
if( this->primitive == itemToCompare.primitive && this->pin_name < itemToCompare.pin_name) return 1;
return 0;
}
};
int main(int argc, char* argv[]) {
int nRetCode = 0;
list<pstchip_pin_wor*> wors_pstchip_pins;
wors_pstchip_pins.push_back( new pstchip_pin_wor( "Europe", "Spain", "Madrid" ) );
wors_pstchip_pins.push_back( new pstchip_pin_wor( "North America", "USA", "Washington DC" ) );
wors_pstchip_pins.push_back( new pstchip_pin_wor( "North America", "Canada", "Ottawa" ) );
wors_pstchip_pins.push_back( new pstchip_pin_wor( "Europe", "Germany", "Berlin" ) );
wors_pstchip_pins.push_back( new pstchip_pin_wor( "South America", "Brazil", "Sao Paulo" ) );
wors_pstchip_pins.push_back( new pstchip_pin_wor( "North America", "Mexico", "Mexico City" ) );
cout << "before sorting" << endl << endl;
for( list<pstchip_pin_wor*>::iterator ka = wors_pstchip_pins.begin(); ka != wors_pstchip_pins.end(); ka++ ) {
cout << (*ka)->primitive << "==" << (*ka)->pin_name << "==" << (*ka)->pin_number << endl;
}
wors_pstchip_pins.sort();
cout << endl << "after sorting" << endl << endl;
for( list<pstchip_pin_wor*>::iterator zm = wors_pstchip_pins.begin(); zm != wors_pstchip_pins.end(); zm++ ) {
cout << (*zm)->primitive << "==" << (*zm)->pin_name << "==" << (*zm)->pin_number << endl;
}
return nRetCode;
}
Would someone be kind enough to point what I'm doing wrong/not doing right?
TIA,
kerchunk
|
|
|
|
|
I've improved my testcase to use two lists, one a list of structs and the original list of pointers-to-structs
and added some code to populate, list, sort, and list again both lists. The list-of-structs sorts correctly while the list-of-pointers-to-structs does not. So it's got to be something with the how the overloaded operators are set up. Any ideas on how to adjust them to work right?
[code]
// sort_example.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <list>
#include <iterator>
#include <vector>
#include <algorithm>
using namespace std;
struct pstchip_pin_wor {
string primitive;
string pin_name;
string pin_number;
/* optional constructors */
pstchip_pin_wor( string aa, string bb, string cc) {
primitive = aa;
pin_name = bb;
pin_number = cc;
}
//overridding operators
pstchip_pin_wor& pstchip_pin_wor::operator = (const pstchip_pin_wor &itemToCopy) {
this->primitive = itemToCopy.primitive;
this->pin_name = itemToCopy.pin_name;
this->pin_number = itemToCopy.pin_number;
return *this;
}
int pstchip_pin_wor::operator == ( const pstchip_pin_wor& itemToCompare) {
if( this->primitive == itemToCompare.primitive && this->pin_name < itemToCompare.pin_name ) return 1;
return 0;
}
int pstchip_pin_wor::operator < ( const pstchip_pin_wor& itemToCompare) {
if( this->primitive < itemToCompare.primitive ) return 1;
if( this->primitive == itemToCompare.primitive && this->pin_name < itemToCompare.pin_name) return 1;
return 0;
}
};
//main function
int main(int argc, char* argv[]) {
int nRetCode = 0;
list<pstchip_pin_wor> rows_pstchip_pins;
list<pstchip_pin_wor*> wors_pstchip_pins;
//populate list
rows_pstchip_pins.push_back( pstchip_pin_wor( "Europe", "Spain", "Madrid" ) );
rows_pstchip_pins.push_back( pstchip_pin_wor( "North America", "USA", "Washington DC" ) );
rows_pstchip_pins.push_back( pstchip_pin_wor( "North America", "Canada", "Ottawa" ) );
rows_pstchip_pins.push_back( pstchip_pin_wor( "Europe", "Germany", "Berlin" ) );
rows_pstchip_pins.push_back( pstchip_pin_wor( "South America", "Brazil", "Sao Paulo" ) );
rows_pstchip_pins.push_back( pstchip_pin_wor( "North America", "Mexico", "Mexico City" ) );
wors_pstchip_pins.push_back( new pstchip_pin_wor( "Europe", "Spain", "Madrid" ) );
wors_pstchip_pins.push_back( new pstchip_pin_wor( "North America", "USA", "Washington DC" ) );
wors_pstchip_pins.push_back( new pstchip_pin_wor( "North America", "Canada", "Ottawa" ) );
wors_pstchip_pins.push_back( new pstchip_pin_wor( "Europe", "Germany", "Berlin" ) );
wors_pstchip_pins.push_back( new pstchip_pin_wor( "South America", "Brazil", "Sao Paulo" ) );
wors_pstchip_pins.push_back( new pstchip_pin_wor( "North America", "Mexico", "Mexico City" ) );
cout << "before sorting in list" << endl << endl;
for( list<pstchip_pin_wor>::iterator gh = rows_pstchip_pins.begin() ; gh != rows_pstchip_pins.end() ; gh++ ) {
cout << gh->primitive << "==" << gh->pin_name << "==" << gh->pin_number << endl;
}
rows_pstchip_pins.sort();
cout << endl << "after sorting" << endl << endl;
for( list<pstchip_pin_wor>::iterator uy = rows_pstchip_pins.begin() ; uy != rows_pstchip_pins.end() ; uy++ ) {
cout << uy->primitive << "==" << uy->pin_name << "==" << uy->pin_number << endl;
}
cout << endl << endl << "before sorting using pointers in list" << endl << endl;
for( list<pstchip_pin_wor*>::iterator ka = wors_pstchip_pins.begin() ; ka != wors_pstchip_pins.end() ; ka++ ) {
cout << (*ka)->primitive << "==" << (*ka)->pin_name << "==" << (*ka)->pin_number << endl;
}
wors_pstchip_pins.sort();
cout << endl << "after sorting" << endl << endl;
for( list<pstchip_pin_wor*>::iterator zm = wors_pstchip_pins.begin() ; zm != wors_pstchip_pins.end() ; zm++ ) {
cout << (*zm)->primitive << "==" << (*zm)->pin_name << "==" << (*zm)->pin_number << endl;
}
return nRetCode;
} //end-function
[/code]
|
|
|
|
|
If you really need to maintain a list of pointers, you can add one user-defined function (as global or as static member to the class) that compares two objects with pointers to them as parameters.
static bool less_than(pstchip_pin_wor* elem1, pstchip_pin_wor* elem2)
{
return *elem1 < *elem2;
}
Then you use the sort with the user-defined function as parameter.
wors_pstchip_pins.sort(pstchip_pin_wor::less_than);
|
|
|
|
|
Thank You for your reply! It's GMT -07:00 here so I'll give your suggestion a try on the morrow.
Thanks again,
kerchunk
|
|
|
|
|
I made the changes you suggested but now the code does not compile. Your instructions were clear - did I fat-finger something?
[code]
// sort_example.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <list>
#include <iterator>
#include <vector>
#include <algorithm>
using namespace std;
struct pstchip_pin_row {
string primitive;
string pin_name;
string pin_number;
/* optional constructors */
pstchip_pin_row( string aa, string bb, string cc) {
primitive = aa;
pin_name = bb;
pin_number = cc;
}
//overridding operators
pstchip_pin_row& operator = (const pstchip_pin_row &itemToCopy) {
this->primitive = itemToCopy.primitive;
this->pin_name = itemToCopy.pin_name;
this->pin_number = itemToCopy.pin_number;
return *this;
}
bool operator == ( const pstchip_pin_row& itemToCompare) {
if( this->primitive == itemToCompare.primitive && this->pin_name < itemToCompare.pin_name ) return true;
return false;
}
bool operator < ( const pstchip_pin_row& itemToCompare) {
if( this->primitive < itemToCompare.primitive ) return true;
if( this->primitive == itemToCompare.primitive && this->pin_name < itemToCompare.pin_name) return true;
return false;
}
};
struct pstchip_pin_wor {
string primitive;
string pin_name;
string pin_number;
/* optional constructors */
pstchip_pin_wor( string aa, string bb, string cc) {
primitive = aa;
pin_name = bb;
pin_number = cc;
}
//overridding operators
pstchip_pin_wor& operator = (const pstchip_pin_wor &itemToCopy) {
this->primitive = itemToCopy.primitive;
this->pin_name = itemToCopy.pin_name;
this->pin_number = itemToCopy.pin_number;
return *this;
}
bool operator == ( const pstchip_pin_wor& itemToCompare) {
if( this->primitive == itemToCompare.primitive && this->pin_name < itemToCompare.pin_name ) return true;
return false;
}
bool operator < ( const pstchip_pin_wor& itemToCompare) {
if( this->primitive < itemToCompare.primitive) return true;
if( this->primitive == itemToCompare.primitive && this->pin_name < itemToCompare.pin_name) return true;
return false;
}
// this function really just wraps pstchip_pin_wor::operator< so that it can accept pointers
static bool compareFunc( const pstchip_pin_wor* a, const pstchip_pin_wor* b) {
return *a < *b;
}
};
//main function
int main(int argc, char* argv[]) {
int nRetCode = 0;
list<pstchip_pin_row> rows_pstchip_pins;
list<pstchip_pin_wor*> wors_pstchip_pins;
//populate list
rows_pstchip_pins.push_back( pstchip_pin_row( "Europe", "Spain", "Madrid" ) );
rows_pstchip_pins.push_back( pstchip_pin_row( "North America", "USA", "Washington DC" ) );
rows_pstchip_pins.push_back( pstchip_pin_row( "North America", "Canada", "Ottawa" ) );
rows_pstchip_pins.push_back( pstchip_pin_row( "Europe", "Germany", "Berlin" ) );
rows_pstchip_pins.push_back( pstchip_pin_row( "South America", "Brazil", "Sao Paulo" ) );
rows_pstchip_pins.push_back( pstchip_pin_row( "North America", "Mexico", "Mexico City" ) );
wors_pstchip_pins.push_back( new pstchip_pin_wor( "Europe", "Spain", "Madrid" ) );
wors_pstchip_pins.push_back( new pstchip_pin_wor( "North America", "USA", "Washington DC" ) );
wors_pstchip_pins.push_back( new pstchip_pin_wor( "North America", "Canada", "Ottawa" ) );
wors_pstchip_pins.push_back( new pstchip_pin_wor( "Europe", "Germany", "Berlin" ) );
wors_pstchip_pins.push_back( new pstchip_pin_wor( "South America", "Brazil", "Sao Paulo" ) );
wors_pstchip_pins.push_back( new pstchip_pin_wor( "North America", "Mexico", "Mexico City" ) );
cout << "before sorting in list" << endl << endl;
for( list<pstchip_pin_row>::iterator gh = rows_pstchip_pins.begin() ; gh != rows_pstchip_pins.end() ; gh++ ) {
cout << gh->primitive << "==" << gh->pin_name << "==" << gh->pin_number << endl;
}
rows_pstchip_pins.sort();
cout << endl << "after sorting" << endl << endl;
for( list<pstchip_pin_row>::iterator uy = rows_pstchip_pins.begin() ; uy != rows_pstchip_pins.end() ; uy++ ) {
cout << uy->primitive << "==" << uy->pin_name << "==" << uy->pin_number << endl;
}
cout << endl << endl << "before sorting using pointers in list" << endl << endl;
for( list<pstchip_pin_wor*>::iterator ka = wors_pstchip_pins.begin() ; ka != wors_pstchip_pins.end() ; ka++ ) {
cout << (*ka)->primitive << "==" << (*ka)->pin_name << "==" << (*ka)->pin_number << endl;
}
wors_pstchip_pins.sort( pstchip_pin_wor::compareFunc);
cout << endl << "after sorting" << endl << endl;
for( list<pstchip_pin_wor*>::iterator zm = wors_pstchip_pins.begin() ; zm != wors_pstchip_pins.end() ; zm++ ) {
cout << (*zm)->primitive << "==" << (*zm)->pin_name << "==" << (*zm)->pin_number << endl;
}
return nRetCode;
} //end-function
[/code]
TIA,
kerchunk
|
|
|
|
|
You fattened the parameters of compareFunc with const specifiers. It works when you remove them.
If you want to define compareFunc with const parameters:
static bool compareFunc( const pstchip_pin_wor* a, const pstchip_pin_wor* b)
then you have to define the operator < as a const member:
bool operator < ( const pstchip_pin_wor& itemToCompare) const
modified on Wednesday, December 2, 2009 5:13 PM
|
|
|
|
|
OK I unfattened compareFunc by removing the two 'const's.
Under VC++6 the program now throws one compiler error:
---------
C:\mystuff\sort_example.cpp(127) : error C2664: 'void __thiscall std::list<struct pstchip_pin_wor *,class std::allocator<struct pstchip_pin_wor *> >::sort(struct std::greater<struct pstchip_pin_wor *>
)' : cannot convert parameter 1 from 'bool (__cdecl *)(struct pstchip_pin_wor *,struct pstchip_pin_wor *)' to 'struct std::greater<struct pstchip_pin_wor *>'
No constructor could take the source type, or constructor overload resolution was ambiguous
Error executing cl.exe.
----------
??? Do I need to overload the std::greater function? And if so how?
Thank You,
kerchunk
|
|
|
|
|
BUG: The STL list::sort() Function Doesn't Sort a List of Pointers
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q265109
The Standard Template Library (STL) list::sort function doesn't sort a list of pointers when a predicate function is defined for sorting.
VC6 is a ten-year old compiler now. The bug is not present in VC2008 or MinGW. Your code is implemented below with the workaround described in KB265109.
________________________________________________________________________________________
#include <iostream>
#include <string>
#include <list>
using namespace std;
struct pstchip_pin_wor
{
string primitive;
string pin_name;
string pin_number;
pstchip_pin_wor( string aa, string bb, string cc)
{
primitive = aa;
pin_name = bb;
pin_number = cc;
}
pstchip_pin_wor& pstchip_pin_wor::operator= (const pstchip_pin_wor &itemToCopy)
{
if(&itemToCopy != this)
{
this->primitive = itemToCopy.primitive;
this->pin_name = itemToCopy.pin_name;
this->pin_number = itemToCopy.pin_number;
}
return *this;
}
int pstchip_pin_wor::operator == ( const pstchip_pin_wor& itemToCompare) const
{
if( this->primitive == itemToCompare.primitive && this->pin_name < itemToCompare.pin_name )
return 1;
return 0;
}
int pstchip_pin_wor::operator < ( const pstchip_pin_wor& itemToCompare) const
{
return Compare(this, &itemToCompare);
}
static bool Compare(const pstchip_pin_wor* elem1, const pstchip_pin_wor* elem2)
{
if( elem1->primitive < elem2->primitive )
return 1;
if( elem1->primitive == elem2->primitive && elem1->pin_name < elem2->pin_name)
return 1;
return 0;
}
};
/* ADDED ACCORDING TO KB265109 */
template<>
struct std::greater<pstchip_pin_wor*> : public binary_function<pstchip_pin_wor* ,pstchip_pin_wor*, bool>
{
bool operator()(const pstchip_pin_wor* &elem1, const pstchip_pin_wor* &elem2) const
{
return pstchip_pin_wor::Compare(elem1, elem2);
};
};
/* ADDED ACCORDING TO KB265109 */
struct SortFunc
/* ADDED ACCORDING TO KB265109 */
: public greater<pstchip_pin_wor*>
/* ADDED ACCORDING TO KB265109 */
{
bool operator()(pstchip_pin_wor*& elem1, pstchip_pin_wor*& elem2)
{
return pstchip_pin_wor::Compare(elem1, elem2);
}
};
int main(int argc, char* argv[])
{
int nRetCode = 0;
list<pstchip_pin_wor*> wors_pstchip_pins;
wors_pstchip_pins.push_back( new pstchip_pin_wor( "Europe", "Spain", "Madrid" ) );
wors_pstchip_pins.push_back( new pstchip_pin_wor( "North America", "USA", "Washington DC" ) );
wors_pstchip_pins.push_back( new pstchip_pin_wor( "North America", "Canada", "Ottawa" ) );
wors_pstchip_pins.push_back( new pstchip_pin_wor( "Europe", "Germany", "Berlin" ) );
wors_pstchip_pins.push_back( new pstchip_pin_wor( "South America", "Brazil", "Sao Paulo" ) );
wors_pstchip_pins.push_back( new pstchip_pin_wor( "North America", "Mexico", "Mexico City" ) );
cout << "before sorting" << endl << endl;
for( list<pstchip_pin_wor*>::iterator ka = wors_pstchip_pins.begin(); ka != wors_pstchip_pins.end(); ka++ )
{cout << (*ka)->primitive << "==" << (*ka)->pin_name << "==" << (*ka)->pin_number << endl;}
wors_pstchip_pins.sort(SortFunc());
cout << endl << "after sorting" << endl << endl;
for( list<pstchip_pin_wor*>::iterator zm = wors_pstchip_pins.begin(); zm != wors_pstchip_pins.end(); zm++ )
{cout << (*zm)->primitive << "==" << (*zm)->pin_name << "==" << (*zm)->pin_number << endl;}
return nRetCode;
}
|
|
|
|
|
WOOHOO!! It works great! Good catch, I'd've never thought to check the compiler itself, and lo sure enough there's a KB against exactly this issue.
Thank You So Much for seeing me through this!
CASE CLOSED
kerchunk
|
|
|
|
|
How to get it without HWND?
If activex windowed i use GetRandomRgn(GDI) function,
and i want to get clipped region for windowless control the same as GetRandomRgn do it for windowed.
How to do it?
|
|
|
|
|
Hi ,
I am using transparent image in LoadBitmap image. When i compile code , then compiler shows error as
"The bitmap must be redrawn or converted to 3.x format" Anybody know how to convert bmp to 3.x format.
If I want to use GIf image in ATL COM to display it in any window then how can i use GIF image into window.
Regards
am
|
|
|
|
|
May be you can use ATL CImage class to display the image.
|
|
|
|
|
I want to render IWMPPlayer to play stream media online in my demo project. When i create such a com instance ant call put_URL, it start playing the media as i want successfully. But, the problem is that, i can't stop it except i close the application. Here is how i stop the playing:
IWMPControls* pICtrl;
m_pIPlayer->get_controls(&pICtrl);
pICtrl->stop();//it returns S_FALSE;
And, another problem is that, when i call put_URL to redirect the url to another server, there will be two active radio channel playing in the same time!
Why?
|
|
|
|
|
I have to embed an ActiveX control into an simple WIN32 app. The parent window is created with CreateWindow() and the control - a MS Flex Grid Control - is embedded with the following code (ATL):
#import "../msflxgrd.ocx"
using namespace MSFlexGridLib;
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
....
_Module.Init(NULL, hInstance);
AtlAxWinInit();
...
}
atlWndClassName = CAxWindow2::GetWndClassName();
axctrl = ::CreateWindow(atlWndClassName,
_T("{6262d3a0-531b-11cf-91f6-c2863c385e30}"),
WS_CHILD, 310, 10, 300, 300,
(HWND)hWndParent, (HMENU)10, hInst, NULL);
ShowWindow(axctrl, SW_SHOW);
UpdateWindow(axctrl);
Everything works fine with this example, but it is not possible to move from cell to cell with the arrow keys. When i connect Spy++ to the application, i can see, that WM_KEYDOWN and WM_KEYUP messages are sent to the Flex Grid Control. The same problem exists with the MS Calendar Control and other controls.
When these controls are embedded into the Microsoft ActiveX Control Test Container or into a MFC-Dialogbox the keyboard control works fine.
Has someone an idea, what code is necessary to support keyboard control for ActiveX controls in simple WIN32 apps?
|
|
|
|
|
Hello, folks,
I want a menu like WinXP start menu. If it has to many programs installed. the menu will split into more than one column.
Thanks
Hawk
|
|
|
|
|
I got it. use MFT_MENUBREAK or MFT_OWNERDRAW.
|
|
|
|
|