|
Hi,
I have a problem with getting a transparent static control to draw correctly on a WTL dialog. Everything I do works, but only if the text color is black.
Message handler is like this:
<small>MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnCtlColorStatic)</small>
Then I have a method to handle it:
<br />
<small>LRESULT OnCtlColorStatic(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);</small>
and in the code I do like this:
<small>LRESULT MainDialog::OnCtlColorStatic(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)<br />
{<br />
HWND hWnd = (HWND)lParam;<br />
HDC hDc = (HDC)wParam;<br />
<br />
COLORREF m_crTextColorMaroon;<br />
m_crTextColorMaroon = RGB( 128, 0, 0 );<br />
HBRUSH hbr;<br />
hbr = (HBRUSH)m_crTextColorMaroon;<br />
<br />
if( hWnd == (HWND)GetDlgItem(IDC_FILE) ||<br />
hWnd == (HWND)GetDlgItem(IDC_FILESIZE)) <br />
{<br />
::SetTextColor( hDc, m_crTextColorMaroon );<br />
::SetBkMode(hDc, TRANSPARENT);<br />
return (LRESULT) GetStockObject (HOLLOW_BRUSH);<br />
}<br />
<br />
return 0;<br />
}</small>
So far so good, everything works. I am only changing the color of the controls that will represent a label, the other static controls on the dialog should display text in the black color. So this works perfectly when the dialog gets displayed.
Now the user changes the language on the menu, and I do this:
<small>SetDlgItemText( IDC_FILE, (LPCTSTR) SomeNewText);</small>
and the text gets drawn over the previous text, making it indecipherable.
What is wrong with this code? Why doesn't the static controls clear its content before the new text is drawn.
If I use <small>SetDlgItemText(...)</small> with any other static control that is not handled in the <small>OnCtlColorStatic</small> method, it gets drawn correctly.
Thanks for your help.
Sarajevo, Bosnia
|
|
|
|
|
You're returning HOLLOW_BRUSH which paints nothing. When the control asks you what brush to use as the background brush, you give it a brush that doesn't paint, so the old contents of the control aren't erased. I'd do this:
LRESULT MainDialog::OnCtlColorStatic(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
HWND hWnd = (HWND) lParam;
HDC hDc = (HDC) wParam;
if(hWnd == GetDlgItem(IDC_FILE) || hWnd == GetDlgItem(IDC_FILESIZE))
{
SetTextColor(hDc, RGB(128,0,0));
SetBkMode(hDc, TRANSPARENT);
}
bHandled = false;
return 0;
} This code changes the attributes of the DC that you care about, then lets the message go on to the default window proc, which will set the right background color.
|
|
|
|
|
Thanks for your help, Mike, but this does not work for me. Now all static controls display a black colored text. Yes, I can change the text and not to get it write over the previous one, but the text is not redish ( RGB(128, 0, 0)) but black.
Can I send you the app, it's only one dialog, just a few lines of code above the normal code generated for the ATL exe app?
Thanks.
Sarajevo, Bosnia
|
|
|
|
|
OK, this time I actually tested the code that I'm going to post.
LRESULT CMainDlg::OnCtlcolorstatic(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
LRESULT res = ::DefWindowProc(m_hWnd, uMsg, wParam, lParam);
HDC hdc = (HDC) wParam;
HWND hwnd = (HWND) lParam;
if(hwnd == GetDlgItem(IDC_STATIC1) || hwnd == GetDlgItem(IDC_STATIC2))
{
SetTextColor(hdc, RGB(255,0,0));
SetBkMode(hdc, TRANSPARENT);
}
return res;
} The first line gets the default brush so the background looks right.
Last modified: 8hrs 3mins after originally posted --
|
|
|
|
|
Haha...okay, thanks a lot, you are right of course.
Thank you again.
Sarajevo, Bosnia
|
|
|
|
|
Hi
Im creating an application in VC++ 6.0.
This application is ATL/COM service exe. in which i need to write certain inform to the queue as well reading data from different queue and perform some process.
I could able to write the given data to the specified queue but unable to read from the queue..
The code i have given below (only MSMQ receive part), while running below mentioned code im getting HR failure error. (no other error mentioned in msdn is not occuring)
can any could help me to get out of this issue...
//code:
HANDLE header1:pen_Queue(unsigned short *Qname)
{
MQQUEUEPROPS QueueProps;
PROPVARIANT aVariant[10]; // Modify for additional properties.
QUEUEPROPID aPropId[10]; // Modify for additional properties.
DWORD PropIdCount1 = 0;
HRESULT hr=MQ_OK;
HANDLE hQueue = NULL;
ULONG MSG_BODY_LEN;
// Queue handle
DWORD dwFormatNameBufferLength = 100;
WCHAR wszFormatNameBuffer[100];
PSECURITY_DESCRIPTOR pSecurityDescriptor;
// Set the pathname of the queue (PROPID_Q_PATHNAME).
aPropId[PropIdCount1] = PROPID_Q_PATHNAME; // Property identifier
aVariant[PropIdCount1].vt = VT_LPWSTR; // Type indicator
aVariant[PropIdCount1].pwszVal = Qname;
PropIdCount1++;
// Set the label of the queue (PROPID_Q_LABEL).
aPropId[PropIdCount1] = PROPID_Q_LABEL; // Property identifier
aVariant[PropIdCount1].vt = VT_LPWSTR; // Type indicator
aVariant[PropIdCount1].pwszVal = L"Test Queue"; // Queue label
PropIdCount1++;
///Set Queue Size
aPropId[PropIdCount1]=PROPID_Q_QUOTA;
aVariant[PropIdCount1].vt =VT_UI4;
aVariant[PropIdCount1].bVal=5 ;
PropIdCount1++;
////////////////////////////////////////////////////////
// Add additional properties here. When adding properties,
// increment the indexes for the aVariant and aPropId arrays
// in their respective declaration statements above.
////////////////////////////////////////////////////////
////////////////////////////////////
// Set the MQQUEUEPROPS structure.
/////////////////////////////////////
QueueProps.cProp = PropIdCount1; // Number of properties
QueueProps.aPropID = aPropId; // Ids of properties
QueueProps.aPropVar = aVariant; // Values of properties
QueueProps.aStatus = NULL; // No error reports
pSecurityDescriptor = NULL; // Set default security descriptor
////////////////////////////
//Create the queue.
////////////////////////////
dwFormatNameBufferLength = sizeof(wszFormatNameBuffer)/sizeof(wszFormatNameBuffer[0]);
hr = MQPathNameToFormatName((unsigned short*)Qname,wszFormatNameBuffer,&dwFormatNameBufferLength);
if (FAILED(hr))
{
MessageBox(NULL,"hr failed","RECIEVE",MB_OK);
}
if(hr==MQ_OK)
{
hr = MQOpenQueue(
wszFormatNameBuffer, // Format name of the queue
MQ_RECEIVE_ACCESS, // Access mode
MQ_DENY_NONE, // Share mode
&hQueue // OUT: Queue handle
);
//return hQueue;
}
else
{
hr = MQCreateQueue(
pSecurityDescriptor, // Security
&QueueProps, // Queue properties
wszFormatNameBuffer, // Output: Format Name
&dwFormatNameBufferLength // Output: Format Name length
);
}
MQMSGPROPS pmsgprops;
MQPROPVARIANT *paVariant;
MSGPROPID * paPropId;
DWORD dwcPropId = 0;
//
// The output parameters to an asynchronous call to MQReceiveMessage
// should be kept intact until the operation completes, you should
// not free or reuse them until the operation is complete.
//
//pmsgprops = new MQMSGPROPS;
paVariant = new MQPROPVARIANT[ 10];
paPropId = new MSGPROPID[ 10];
//////////////////////////////////////////////////
// Prepare the message properties to be retrieved.
/////////////////////////////////////////////////
// Set the PROPID_M_BODY property.
paPropId[dwcPropId] = PROPID_M_BODY; //PropId
paVariant[dwcPropId].vt = VT_VECTOR|VT_UI1; //Type
paVariant[dwcPropId].caub.cElems = MSG_BODY_LEN ; //Value
paVariant[dwcPropId].caub.pElems = new unsigned char[ MSG_BODY_LEN];
dwcPropId++;
////////////////////////////////
// Initialize the MQMSGPROPS structure
///////////////////////////////
pmsgprops.cProp = dwcPropId; //Number of properties
pmsgprops.aPropID = paPropId; //Ids of properties
pmsgprops.aPropVar = paVariant; //Values of properties
//pmsgProps->aStatus = NULL; //No Error report
///////////////////////////////////////////////
// Receive the message using callback function
// ReceiveCallbackRoutine.
///////////////////////////////////////////////
//hr = MQReceiveMessage(hQueue,100,MQ_ACTION_RECEIVE,pmsgprops,NULL,NULL,NULL,NULL);
hr = MQReceiveMessage(
hQueue, // Handle to the Queue
100, // Max time (msec) to wait
MQ_ACTION_RECEIVE, // Action
&pmsgprops, // Properties to retrieve
NULL, // No OVERLAPPED structure
NULL, // Callback function
NULL,
MQ_NO_TRANSACTION // No Cursor
);
// the following error is occured
if (FAILED(hr))
{
MessageBox(NULL,"Error","RECIEVE",MB_OK);
}
Regards
shakumar
shakumar
|
|
|
|
|
CInternetSession session;
thrown an assertion error in afxwin1.inl Line 27.
what must i do?
|
|
|
|
|
Hi,
I am programming a COM object in C++, to be used in a Visual Basic Apllication.
I want to know if there is a way to separate the interface members with namespaces like this
Study.FramesOfReference.Series.Item()
where Study is a COM Object that contains a CoClass FramesOfReference which Contains a CoClass Series wich has a method Item()
Thank U very Much
Juan
JO
|
|
|
|
|
I need to create a shell extension similar to the already existing "Sent To->Email Recipient"
The only difference is that rather than creating a new mail message with a files as attachments, I want to create a new message with the file paths in the message body. Preferably I'd like to have the files linked so the recipient can just click on the link and have the file open up (everyone in the network has access to common network drive) ...
I've toyed around with just doing registry stuff (not using VC++ or ATL) and I got pretty close. It would work fine for 1 file, but if I selected 10 files, it would create 10 new messages (one for each file path).
... Anyways, I followed the excellent shell extension guide found here: http://www.codeproject.com/KB/shell/shellextguide1.aspx[^] and I have the extension all laid out the way I want it. It registers fine and is displayed perfectly.
I'd like to know what the best approach from here would be as far as actually creating a new email message... I tried using System::Diagnostics::Process::Start, but the .Net & clr stuff didn't seem to work out to well...
Any suggestions?
|
|
|
|
|
When I follow the link to the WTL documentation project:
http://www.codeproject.com/KB/wtl/wtldocs2.aspx[^]
I get an error message that's telling me that an error occurred in the page.
I could access the page a few weeks ago. Anybody else with this problem?
|
|
|
|
|
I encountered strange problem with WTL program I'm trying to make (please bear with me because I'm not a pro, programming is just my hobby). I'm trying to make a program to view any image directly from zip (something like CDisplay, but with FreeImage and ZipUtils).
I reused code of a WTL Bitmap viewer example (from original WTL package).
I'm switching 2 views in SDI application (see http://www.codeproject.com/KB/wtl/switchviews_wtl.aspx), one flicker-free image display (generic view) and a CListViewCtrl thumbnails list (not a control in client, I use whole view#2 window).
I build with VC8ExpressSP1 + Platform SDK2003R2 + WTL latest version.
Essential code:
<br />
class CMainFrame : public CFrameWindowImpl<CMainFrame >, public CUpdateUI<CMainFrame >,public CMessageFilter, public CIdleHandler, public C_ImgArchive<br />
{<br />
public:<br />
DECLARE_FRAME_WND_CLASS(NULL, IDR_MAINFRAME)<br />
<br />
CIAVView m_view;<br />
CThumbView m_thumbview;<br />
<br />
BEGIN_UPDATE_UI_MAP(CMainFrame)<br />
END_UPDATE_UI_MAP()<br />
<br />
BEGIN_MSG_MAP(CMainFrame)<br />
MESSAGE_HANDLER(WM_CREATE, OnCreate)<br />
.....<br />
CHAIN_MSG_MAP(CUpdateUI<cmainframe>)<br />
CHAIN_MSG_MAP(CFrameWindowImpl<cmainframe>)<br />
END_MSG_MAP()<br />
<br />
....}<br />
<br />
LRESULT CMainFrame::OnCreate(UINT , WPARAM , LPARAM , BOOL& )<br />
{<br />
<br />
m_hWndClient=m_thumbview.Create(m_hWnd, rcDefault, NULL,<br />
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | LVS_ICON | LVS_SINGLESEL | WS_EX_COMPOSITED);<br />
<br />
m_view_hWnd=m_view.Create(m_hWnd, rcDefault, NULL, <br />
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);<br />
<br />
....<br />
}<br />
<br />
<br />
<br />
class CIAVView : public CScrollWindowImpl<CIAVView ><br />
{<br />
public: <br />
DECLARE_WND_CLASS_EX(NULL, CS_HREDRAW | CS_VREDRAW, -1)<br />
BEGIN_MSG_MAP(CIAVView)<br />
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground)<br />
...<br />
CHAIN_MSG_MAP(CScrollWindowImpl<ciavview>)<br />
END_MSG_MAP()<br />
<br />
void DoPaint(CDCHandle dc);
...<br />
}<br />
<br />
class CThumbView: public CDoubleBufferWindowImpl<CThumbView, CListViewCtrl><br />
public:<br />
DECLARE_WND_SUPERCLASS(NULL, CListViewCtrl::GetWndClassName())<br />
<br />
CImageList m_ImageListThumb;<br />
<br />
BEGIN_MSG_MAP(CThumbView)<br />
... <br />
END_MSG_MAP()<br />
...<br />
}<br />
<br />
</ciavview></cmainframe></cmainframe>
The problem is: in debug version all is fine with window redrawing
but in release version my flicker-free window is never updated, even when it is the first-in-order ID view.
If I drag it's contents out of the screen, it gets redrawn at those parts that go out of screen.
When there is just one wiev, there's no problems. There is another issue with thumbnails-list not displaying properly, but I circumvent it with showing/creating thumbview window first. (playing with WS_CLIPSIBLINGS or WS_CLIPCHILDREN doesn't have any effect, except not drawing anything where it should)
I seem to me that my "flicker-free" view window never receives WM_PAINT message in release version.
Is this somehow related to debugger-window-activations -stuff (I vaguely remember reading somewhere something like that)...?
I can provide full source code if neccesary.
modified on Friday, December 14, 2007 9:13:09 PM
|
|
|
|
|
|
I can't find any tutorials on implementing WTL with COM. I have no knowledge of ATL itself. No decent guides around and none on here.
|
|
|
|
|
AFAIK, WTL is just an extension to ATL. Thus, you create COM the same way you would with ATL.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
My friend says I need to have ATL knowledge before tackling WTL with COM. Know any good ATL tutorials. Cause I can't find any decent ones on here from start to finish,
|
|
|
|
|
You won't find many tutorials on the web. However, I can recommend a book:
ATL Internals: Working with ATL
Second Edition
Tavares, Fertitta, Rector and Sells
ISBN: 0-321-15962-4
Geo
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Kuryn wrote: I have no knowledge of ATL itself
What about COM itself? If not the best book I ever read for COM was Inside COM[^]
No ATL in that book but IMHO knowing COM well is a prerequisite to understanding ATL.
For ATL did you try the MSDN Tutorial[^]?
|
|
|
|
|
WTL is more about GUI programming than COM. ATL itself has COM-related classes like smart pointers and IDispatch implementations.
|
|
|
|
|
Hi,
I need to create a windows service which should not be stopped unless and until I UnInstall my Program i.e it should be started automatically on startup.
I just want to know whether this is possible or not.If so how?
Any suggestions or relevant links would be helpful.
Thanks
Today is a gift, that's why it is called the present.
modified on Tuesday, December 11, 2007 1:43:13 AM
|
|
|
|
|
Look in MSDN for CreateService or OpenSCManager functions.
|
|
|
|
|
If you use Visual Studio there is an ATL Service Application Wizard that generates boiler plate project for creating a Windows Service.
Of course also on MSDN you will find more information like samples etc., for using the ATL Service wizard.
|
|
|
|
|
I've very recently started to build an app that works with some db items and having seen something sort of like it in php, tried to implement a DB -> object class.
But seeing that I'm kind of ... erm, let's say noobish and used pointers extensively in the class I've decided to try and get some feedback on if the code has some glaring big bad problems from my coding practices side that might let it work ok for 1 example or 2 but that could turn very ugly in some circumstances.
Background:
1. This will act as a base class, each table in the db will implement a new class actualyl defining values for field names, field <-> attribute, links to other objects etc.
2. Will be in a multithreaded app but while different instances will be used in different threads, 1 instance won't be simultaneously used in 2 threads, at least that's what I believe atm.
3. Connection pointer is global, kept alive forever if needed.
4. Not even close to finished, not even current methods, still some error checking to do and possibly more.
So, all I want is if possible some pointers to stuff I terribly messed up and should avoid doing in my code from now on. Basicly learned all from C/C++ on my own from my own code, with what php experience I had and the 6-7 years of experience doing algorithms in pascal, so my approach to solid programming didn't even include threads, avoiding memory "destruction", pointers and all the nice stuff c/c++ on windows has to offer.
Next post should possibly contain 2 more listings, this class' header and a derived class.
DBItem.cpp
<code>
#include "stdafx.h"
#include "DBItem.h"
#include "DB_Obj1.h"
DBItem::DBItem(int nId, _ConnectionPtr pConnectionGeneral)
{
pConnDB = pConnectionGeneral;
pRstDB.CreateInstance(__uuidof(Recordset));
nIid = nId;
}
DBItem::~DBItem()
{
pRstDB->Close();
pRstDB.Release();
pRstDB.Detach();
ds.mAttr.clear();
ds.mAttrFields.clear();
ds.mAttrLoaded.clear();
ds.mAttrModified.clear();
ds.mDeps.clear();
ds.mLinks.clear();
ds.sIdField.~basic_string();
ds.sTableName.~basic_string();
ds.sTittleAttr.~basic_string();
ds.sTreeLink.~basic_string();
while (!mMessages.empty())
{
mMessages.pop();
}
}
BOOL DBItem::Load()
{
char *sztempQuery;
string sQuery, sFldName;
int i;
FieldPtr pField;
FormLoadQuery(&sztempQuery);
sQuery = sztempQuery;
free(sztempQuery);
if (ExecuteQuery(sQuery))
{
for (i = 0; i < pRstDB->Fields->Count; i++)
{
pField = pRstDB->Fields->GetItem(_variant_t((long)i, VT_I4));
sFldName = pField->Name;
ds.mAttr[ds.mAttrFields[sFldName]] = pField->Value;
ds.mAttrLoaded[ds.mAttrFields[sFldName]] = TRUE;
}
}
else
{
AddMessage(DB_ERROR, "Error while executing load query. Check previous message!");
return FALSE;
}
return TRUE;
}
_variant_t DBItem::GetAttr(string sAttr)
{
_variant_t vAttr;
if (nIid == 0)
{
vAttr.vt = VT_NULL;
return vAttr;
}
if (!ds.mAttrLoaded[sAttr])
{
if (!Load())
{
vAttr.vt = VT_NULL;
}
else
{
vAttr = ds.mAttr[sAttr];
}
}
else
{
vAttr = ds.mAttr[sAttr];
}
return vAttr;
}
BOOL DBItem::ExecuteQuery(string sQuery)
{
try
{
pRstDB = pConnDB->Execute(sQuery.c_str(), NULL, adCmdText);
}
catch (_com_error &e)
{
AddMessage(DB_EXCEPTION, "Exception in DBItem::ExecuteQuery(), Class '" + GetClass() + "', ID " + ToString(nIid) + " Error: " + (string)e.ErrorMessage());
return FALSE;
}
return TRUE;
}
void DBItem::AddMessage(int nMsgType, string sMessage)
{
string stempMessage;
stempMessage = ToString(nMsgType) + sMessage;
mMessages.push(stempMessage);
}
string DBItem::GetName()
{
_variant_t vVar;
string stempName = "";
vVar = GetAttr(ds.sTittleAttr);
try
{
stempName = vVar.operator _bstr_t().operator const char *();
}
catch (_com_error &e)
{
AddMessage(DB_EXCEPTION, "Exception in DBItem::GetName(), Class '" + GetClass() + "', ID " + ToString(nIid) + " Error: " + (string)e.ErrorMessage());
stempName = "";
}
return stempName;
}
DBItem *DBItem::GetObject(string sAttr)
{
DBItem *mliInstance;
_variant_t vIdAttr;
unsigned long dInstId;
vIdAttr = GetAttr(sAttr);
dInstId = vIdAttr.operator long();
mliInstance = GetInstance(ds.mLinks[sAttr], dInstId);
return mliInstance;
}
DBIList *DBItem::GetInstances()
{
DBIList *pVector;
DBItem *mliInstance;
char *sztempQuery;
string sQuery;
unsigned long ulID, ulCount;
long i;
FieldPtr pField;
FormGetIDsQuery(&sztempQuery);
sQuery = sztempQuery;
free(sztempQuery);
if (ExecuteQuery(sQuery))
{
ulCount = pRstDB->Fields->Count;
pVector = new DBIList(ulCount);
for (i = 0; i < pRstDB->Fields->Count; i++)
{
pField = pRstDB->Fields->GetItem(_variant_t((long)i, VT_I4));
ulID = pField->Value.ulVal;
mliInstance = GetInstance(GetClass(), ulID);
pVector->push_back(mliInstance);
}
return pVector;
}
else
{
AddMessage(DB_ERROR, "Error while executing ID query. Check previous message!");
return NULL;
}
}
string DBItem::GetClass()
{
return (string)"DBItem";
}
DBItem *DBItem::GetInstance(string sClassName, unsigned long nId)
{
if (sClassName == "DB_Obj1")
return new DB_Obj1(nId, pConnDB);
return NULL;
}
void DBItem::FormLoadQuery(char **szQuery)
{
string stempQuery;
stempQuery = "SELECT * FROM ";
stempQuery += ds.sTableName;
stempQuery += " WHERE ";
stempQuery += ds.sIdField;
stempQuery += "=";
stempQuery += ToString(nIid);
*szQuery = (char *) malloc(stempQuery.length() + 1);
if (*szQuery == NULL)
{
}
else
{
memset(*szQuery, 0, stempQuery.length() + 1);
memcpy(*szQuery, stempQuery.c_str(), stempQuery.length());
}
}
void DBItem::FormGetIDsQuery(char **szQuery)
{
string stempQuery;
stempQuery = "SELECT "
stempQuery += ds.sIdField;
stempQuery += " FROM ";
stempQuery += ds.sTableName;
*szQuery = (char *) malloc(stempQuery.length() + 1);
if (*szQuery == NULL)
{
}
else
{
memset(*szQuery, 0, stempQuery.length() + 1);
memcpy(*szQuery, stempQuery.c_str(), stempQuery.length());
}
}
string DBItem::ToString(int nConvertable)
{
string stempConvert;
char *sztempConvert;
sztempConvert = (char *) malloc(16);
memset(sztempConvert, 0, 16);
_itoa(nConvertable, sztempConvert, 10);
stempConvert = sztempConvert;
free(sztempConvert);
return stempConvert;
}
string DBItem::ToString(long nConvertable)
{
string stempConvert;
char *sztempConvert;
sztempConvert = (char *) malloc(16);
memset(sztempConvert, 0, 16);
_ltoa(nConvertable, sztempConvert, 10);
stempConvert = sztempConvert;
free(sztempConvert);
return stempConvert;
}
</code>
modified on Friday, December 07, 2007 4:27:26 AM
|
|
|
|
|
As posted earlier, 2 more listings, header for class and derived class.
DBItem.h
<code>#define DB_ERROR 1
#define DB_EXCEPTION 2
class DBItem;
typedef pair<string, string> ssPair;
typedef vector<DBItem*> DBIList;
struct DataStructure
{
map<string, _variant_t> mAttr;
map<string, BOOL> mAttrLoaded;
map<string, BOOL> mAttrModified;
map<string, string> mAttrFields;
map<string, string> mLinks;
map<string, ssPair> mDeps;
string sIdField;
string sTableName;
string sTittleAttr;
string sTreeLink;
};
class DBItem
{
public:
DBItem(int nId, _ConnectionPtr pConnectionGeneral = NULL);
virtual ~DBItem();
_variant_t GetAttr(string sAttr);
string GetName();
DBItem *GetObject(string sAttr);
DBIList *GetInstances();
virtual string GetClass();
protected:
DBItem *GetInstance(string sClassName, unsigned long nId);
DataStructure ds;
private:
_ConnectionPtr pConnDB;
_RecordsetPtr pRstDB;
int nIid;
stack<string> mMessages;
BOOL bNoLogging;
BOOL Load();
void FormLoadQuery(char **szQuery);
void FormGetIDsQuery(char **szQuery);
BOOL ExecuteQuery(string sQuery);
void AddMessage(int nMsgType, string sMessage);
string ToString(int nConvertable);
string ToString(long nConvertable);
};</code>
DB_Obj1.cpp
<code>#include "stdafx.h"
#include "DB_Obj1.h"
DB_Obj1::DB_Obj1(int nId, _ConnectionPtr pConnectionGeneral) : DBItem(nId, pConnectionGeneral)
{
_variant_t vtNull;
vtNull.vt = VT_NULL;
ds.mAttr["Id"] = vtNull;
ds.mAttr["Name"] = vtNull;
ds.mAttr["State"] = vtNull;
ds.mAttrFields["IdObj"] = "Id";
ds.mAttrFields["ObjName"] = "Name";
ds.mAttrFields["CurrentState"] = "State";
ds.mAttrLoaded["Id"] =
ds.mAttrLoaded["Name"] =
ds.mAttrLoaded["State"] =
ds.mAttrModified["Id"] =
ds.mAttrModified["Name"] =
ds.mAttrModified["State"] = FALSE;
ds.mLinks["State"] = "DB_StateObj";
ds.mDeps["someone_depends_on_me_somehow"] = make_pair((string)"DB_SomeObj", (string)"IdObj1");
ds.sIdField = "IdObj";
ds.sTableName = "objects1";
ds.sTittleAttr = "Name";
ds.sTreeLink = "";
}
DB_Obj1::~DB_Obj1()
{
}
string DB_Obj1::GetClass()
{
return (string)"DB_Obj1";
}</code>
modified on Friday, December 07, 2007 4:30:04 AM
|
|
|
|
|
VC6 - WTL 8
I'm currently updating my software UI to Vista and I wonder what the Windows Explorer "toolbar" is (Vista Aero style) ?
I would like to show my coolbar's toolbars with the same look as the Windows Explorer one (the one with Organize, view,...). But at the moment my toolbars look like the menu one.
When I drag MiniSpy over the "toolbar" (the one with Organize, view,...) it says class name is DirectUIHWND.
Does it mean it is an owner drawn component or is it the famous Ribbon bar control ?
The menu itself has the ToolBarWindow32 class and a different look, so that toolbar is obviously something different.
Any clue of the control name, style, manifest setting,... ?
Yarp
www.senosoft.com
Yarp
http://www.senosoft.com/
|
|
|
|
|
Direct UI is an internal MS library that they have not documented.
|
|
|
|
|